class Sequel::SingleConnectionPool
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.
Public Instance Methods
all_connections() { |conn| ... }
click to toggle source
Yield the connection if one has been made.
# File lib/sequel/connection_pool/single.rb, line 12 def all_connections yield @conn if @conn end
disconnect(opts=nil)
click to toggle source
Disconnect the connection from the database.
# File lib/sequel/connection_pool/single.rb, line 17 def disconnect(opts=nil) return unless @conn db.disconnect_connection(@conn) @conn = nil end
hold(server=nil) { |conn ||= make_new(DEFAULT_SERVER)| ... }
click to toggle source
Yield the connection to the block.
# File lib/sequel/connection_pool/single.rb, line 24 def hold(server=nil) begin yield(@conn ||= make_new(DEFAULT_SERVER)) rescue Sequel::DatabaseDisconnectError disconnect raise end end
pool_type()
click to toggle source
# File lib/sequel/connection_pool/single.rb, line 33 def pool_type :single end
size()
click to toggle source
The SingleConnectionPool always has a size of 1 if connected and 0 if not.
# File lib/sequel/connection_pool/single.rb, line 7 def size @conn ? 1 : 0 end