Module: Lite3::SQL
- Defined in:
- lib/internal_lite3/sql.rb
Overview
This module provides some basic, consistent access to the
underlying database library(es) (currently sequel
).
Class Method Summary collapse
-
.close_all ⇒ Object
Close and remove the underlying database connections.
-
.gc ⇒ Object
Disconnect and delete all database handles and associated metadata that are no longer needed (i.e. because their corresponding
DBM
s have been closed or reclaimed). -
.threadsafe? ⇒ Boolean
Tests if the underlying database libraries are threadsafe.
Class Method Details
.close_all ⇒ Object
Close and remove the underlying database connections. This does
not invalidate existing Lite3::DBM
objects; they will recreate
the connections when needed.
The main use for this is for safely forking the current process.
You should call this just before each fork
to avoid potential
corruption from duplicated database handles.
This should not be called while a database operation is in
progress. (E.g. do not call this from the block of
DBM.each
.)
87 |
# File 'lib/internal_lite3/sql.rb', line 87 def self.close_all() return HandlePool.close_all end |
.gc ⇒ Object
Disconnect and delete all database handles and associated
metadata that are no longer needed (i.e. because their
corresponding DBM
s have been closed or reclaimed).
Returns a hash mapping the path to each open database file to the number of live DBM objects referencing it. (Note that DBM objects that have gone out of scope but are not yet finalized count as "live"; as a result, this will differ across Ruby implementations due to differing garbage collector semantics.)
You normally won't need to explicitly call this, but it's useful for testing and debugging.
74 |
# File 'lib/internal_lite3/sql.rb', line 74 def self.gc() return HandlePool.gc; end |
.threadsafe? ⇒ Boolean
Tests if the underlying database libraries are threadsafe.
(Currently, it always returns true, since Sequel does that for us.)
58 59 60 |
# File 'lib/internal_lite3/sql.rb', line 58 def self.threadsafe? return true end |