Sha256: 60b7d33c6b1db15f87c598e8583a360044f0dd91d03e96d911ae1020e1392d8b
Contents?: true
Size: 906 Bytes
Versions: 27
Compression:
Stored size: 906 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 # Yield the connection if one has been made. def all_connections yield @conn if @conn end # Disconnect the connection from the database. def disconnect(opts=nil) return unless @conn db.disconnect_connection(@conn) @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 def pool_type :single end CONNECTION_POOL_MAP[[true, false]] = self end
Version data entries
27 entries across 27 versions & 2 rubygems