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



524
525
526
527
528
529
530
531
532
533
# File 'lib/active_record/connection_adapters/postgresql_adapter.rb', line 524

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