Class Sequel::SingleConnectionPool
In: lib/sequel/connection_pool/single.rb
Parent: Sequel::ConnectionPool

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.

Methods

disconnect   hold   size  

Public Instance methods

Disconnect the connection from the database.

[Source]

    # File lib/sequel/connection_pool/single.rb, line 12
12:   def disconnect(opts=nil, &block)
13:     return unless @conn
14:     block ||= @disconnection_proc
15:     block.call(@conn) if block
16:     @conn = nil
17:   end

Yield the connection to the block.

[Source]

    # File lib/sequel/connection_pool/single.rb, line 20
20:   def hold(server=nil)
21:     begin
22:       yield(@conn ||= make_new(DEFAULT_SERVER))
23:     rescue Sequel::DatabaseDisconnectError
24:       disconnect
25:       raise
26:     end
27:   end

The SingleConnectionPool always has a size of 1 if connected and 0 if not.

[Source]

   # File lib/sequel/connection_pool/single.rb, line 7
7:   def size
8:     @conn ? 1 : 0
9:   end

[Validate]