Method: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#query

Defined in:
lib/active_record/connection_adapters/postgresql_adapter.rb

#query(sql, name = nil) ⇒ Object

Queries the database and returns the results in an Array-like object



482
483
484
485
486
487
488
489
490
491
# File 'lib/active_record/connection_adapters/postgresql_adapter.rb', line 482

def query(sql, name = nil) #:nodoc:
  log(sql, name) do
    if @async
      res = @connection.async_exec(sql)
    else
      res = @connection.exec(sql)
    end
    return result_as_array(res)
  end
end