module TableSaw::Connection
Public Class Methods
adapter()
click to toggle source
# File lib/table_saw/connection.rb, line 22 def self.adapter @adapter ||= begin config = TableSaw.configuration.connection conn = ::PG::Connection.new(config) ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.new(conn, nil, config, {}) end end
exec(sql)
click to toggle source
# File lib/table_saw/connection.rb, line 16 def self.exec(sql) TableSaw::Connection.with do |conn| conn.exec(sql) end end
with() { |raw_connection| ... }
click to toggle source
# File lib/table_saw/connection.rb, line 10 def self.with raise ArgumentError, 'requires a block' unless block_given? yield adapter.raw_connection end