Method: PGB.execute

Defined in:
lib/pgb.rb

.execute(query) ⇒ Object

TODO Log TODO Connection pool TODO DB connection params TODO Extract TODO Wrap errors in PGB::Error TODO Support block evaluation TODO Log runtime TODO Log source of query TODO Check postgres version on first call TODO Look through everything TODO Enable all rubocop cops TODO Coloring if supported



66
67
68
69
70
71
72
# File 'lib/pgb.rb', line 66

def execute(query)
  sql = query.is_a?(Query) || query.is_a?(Command) ? query.to_sql : query.strip.tr("\n", ' ')
  # TODO Weird
  connection
  log(sql)
  connection.exec(sql).to_a
end