method

exec_query

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: DatabaseStatements

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v7.0.0) is shown here.

These similar methods exist in v7.1.3.2:

exec_query(sql, name = "SQL", binds = [], prepare: false, async: false) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb, line 53
        def exec_query(sql, name = "SQL", binds = [], prepare: false, async: false) # :nodoc:
          execute_and_clear(sql, name, binds, prepare: prepare, async: async) do |result|
            types = {}
            fields = result.fields
            fields.each_with_index do |fname, i|
              ftype = result.ftype i
              fmod  = result.fmod i
              case type = get_oid_type(ftype, fmod, fname)
              when Type::Integer, Type::Float, OID::Decimal, Type::String, Type::DateTime, Type::Boolean
                # skip if a column has already been type casted by pg decoders
              else types[fname] = type
              end
            end
            build_result(columns: fields, rows: result.values, column_types: types)
          end
        end
Register or log in to add new notes.