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

Public Instance methods

Yield the connection if one has been made.

[Source]

   # File lib/sequel/connection_pool/single.rb, line 6
6:   def all_connections
7:     yield @conn if @conn
8:   end

Disconnect the connection from the database.

[Source]

    # File lib/sequel/connection_pool/single.rb, line 11
11:   def disconnect(opts=nil)
12:     return unless @conn
13:     db.disconnect_connection(@conn)
14:     @conn = nil
15:   end

Yield the connection to the block.

[Source]

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

The SingleConnectionPool always has a maximum size of 1.

[Source]

    # File lib/sequel/connection_pool/single.rb, line 28
28:   def max_size
29:     1
30:   end

[Source]

    # File lib/sequel/connection_pool/single.rb, line 32
32:   def pool_type
33:     :single
34:   end

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

[Source]

    # File lib/sequel/connection_pool/single.rb, line 38
38:   def size
39:     @conn ? 1 : 0
40:   end

[Validate]