Method: ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements#internal_exec_query

Defined in:
activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb

#internal_exec_query(sql, name = "SQL", binds = [], prepare: false, async: false, allow_retry: false, materialize_transactions: true) ⇒ Object

:nodoc:



65
66
67
68
69
70
71
72
73
74
75
76
# File 'activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb', line 65

def internal_exec_query(sql, name = "SQL", binds = [], prepare: false, async: false, allow_retry: false, materialize_transactions: true) # :nodoc:
  execute_and_clear(sql, name, binds, prepare: prepare, async: async, allow_retry: allow_retry, materialize_transactions: materialize_transactions) do |result|
    types = {}
    fields = result.fields
    fields.each_with_index do |fname, i|
      ftype = result.ftype i
      fmod  = result.fmod i
      types[fname] = types[i] = get_oid_type(ftype, fmod, fname)
    end
    build_result(columns: fields, rows: result.values, column_types: types.freeze)
  end
end