Sha256: 4ad1783d2a28459c809ea9e4e02bbee697351dd79bbf03d52c4e66c98948ac36
Contents?: true
Size: 803 Bytes
Versions: 25
Compression:
Stored size: 803 Bytes
Contents
# This is the fastest connection pool, since it isn't a connection pool at all. # It is just a wrapper around a single connection that uses the connection pool # API. class Sequel::SingleConnectionPool < Sequel::ConnectionPool # The SingleConnectionPool always has a size of 1 if connected # and 0 if not. def size @conn ? 1 : 0 end # Disconnect the connection from the database. def disconnect(opts=nil, &block) return unless @conn block ||= @disconnection_proc block.call(@conn) if block @conn = nil end # Yield the connection to the block. def hold(server=nil) begin yield(@conn ||= make_new(DEFAULT_SERVER)) rescue Sequel::DatabaseDisconnectError disconnect raise end end CONNECTION_POOL_MAP[[true, false]] = self end
Version data entries
25 entries across 25 versions & 1 rubygems