Module: TableSaw::Connection
- Defined in:
- lib/table_saw/connection.rb
Class Method Summary collapse
Class Method Details
.adapter ⇒ Object
22 23 24 25 26 27 28 |
# 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) ⇒ Object
16 17 18 19 20 |
# File 'lib/table_saw/connection.rb', line 16 def self.exec(sql) TableSaw::Connection.with do |conn| conn.exec(sql) end end |
.with {|adapter.raw_connection| ... } ⇒ Object
10 11 12 13 14 |
# File 'lib/table_saw/connection.rb', line 10 def self.with raise ArgumentError, 'requires a block' unless block_given? yield adapter.raw_connection end |