Class: SQLRunner::Adapters::ActiveRecord::ConnectionPool
- Inherits:
-
Object
- Object
- SQLRunner::Adapters::ActiveRecord::ConnectionPool
- Defined in:
- lib/sql_runner/adapters/active_record.rb
Instance Method Summary collapse
Instance Method Details
#shutdown ⇒ Object
48 49 |
# File 'lib/sql_runner/adapters/active_record.rb', line 48 def shutdown end |
#with ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/sql_runner/adapters/active_record.rb', line 31 def with ::ActiveRecord::Base.connection_pool.with_connection do |connection| connection = connection.instance_variable_get(:@connection) adapter = case connection.class.name when "PG::Connection" PostgreSQL.new(connection) when "Mysql2::Client" MySQL.new(connection) else raise UnsupportedDatabase end yield(adapter) end end |