Module: TableSaw::Connection

Defined in:
lib/table_saw/connection.rb

Class Method Summary collapse

Class Method Details

.exec(sql) ⇒ Object



17
18
19
20
21
# File 'lib/table_saw/connection.rb', line 17

def self.exec(sql)
  TableSaw::Connection.with do |conn|
    conn.exec(sql)
  end
end

.rawObject



13
14
15
# File 'lib/table_saw/connection.rb', line 13

def self.raw
  @raw ||= PG::Connection.new(TableSaw.configuration.connection)
end

.with {|raw| ... } ⇒ Object

Yields:

Raises:

  • (ArgumentError)


7
8
9
10
11
# File 'lib/table_saw/connection.rb', line 7

def self.with
  raise ArgumentError, 'requires a block' unless block_given?

  yield raw
end