Class: Sequel::ConnectionPool
- Inherits:
-
Object
- Object
- Sequel::ConnectionPool
- Defined in:
- lib/sequelizer/monkey_patches/database_in_after_connect.rb
Instance Method Summary collapse
-
#make_new(server) ⇒ Object
Return a new connection by calling the connection proc with the given server name, and checking for connection errors.
Instance Method Details
#make_new(server) ⇒ Object
Return a new connection by calling the connection proc with the given server name, and checking for connection errors.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sequelizer/monkey_patches/database_in_after_connect.rb', line 5 def make_new(server) begin conn = @db.connect(server) if ac = @after_connect case ac.arity when 3 ac.call(conn, server, @db) when 2 ac.call(conn, server) else ac.call(conn) end end rescue Exception=>exception raise Sequel.convert_exception_class(exception, Sequel::DatabaseConnectionError) end raise(Sequel::DatabaseConnectionError, "Connection parameters not valid") unless conn conn end |