43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/sql_runner/adapters/active_record.rb', line 43
def with
::ActiveRecord::Base.connection_pool.with_connection do |connection|
connection = connection.raw_connection
adapter = case connection.class.name
when "PG::Connection"
PostgreSQL.new(connection)
when "Mysql2::Client"
MySQL.new(connection)
when "SQLite3::Database"
SQLite.new(connection)
else
raise UnsupportedDatabase,
"#{connection.class.name} is not yet supported " \
"by the SQLRunner's ActiveRecord adapter"
end
yield(adapter)
end
end
|