class Purview::RawConnections::PG

Private Instance Methods

execute_sql(sql, opts={}) click to toggle source
# File lib/purview/raw_connections/pg.rb, line 9
def execute_sql(sql, opts={})
  raw_connection.exec(sql)
end
extract_rows(result) click to toggle source
# File lib/purview/raw_connections/pg.rb, line 13
def extract_rows(result)
  result && result.to_a
end
extract_rows_affected(result) click to toggle source
# File lib/purview/raw_connections/pg.rb, line 17
def extract_rows_affected(result)
  result && result.cmd_tuples
end
new_connection() click to toggle source
# File lib/purview/raw_connections/pg.rb, line 21
def new_connection
  ::PG.connect(
    filter_nil_values(
      :dbname => database,
      :host => host,
      :password => password,
      :port => port,
      :user => username
    )
  )
end
username() click to toggle source
Calls superclass method Purview::RawConnections::Base#username
# File lib/purview/raw_connections/pg.rb, line 33
def username
  super || ENV['PGUSER'] || Etc.getlogin
end