method

perform_query

Importance_0
v8.0.0 - Show latest stable - 0 notes - Class: DatabaseStatements
  • 1.0.0
  • 1.1.6
  • 1.2.6
  • 2.0.3
  • 2.1.0
  • 2.2.1
  • 2.3.8
  • 3.0.0
  • 3.0.9
  • 3.1.0
  • 3.2.1
  • 3.2.8
  • 3.2.13
  • 4.0.2
  • 4.1.8
  • 4.2.1
  • 4.2.7
  • 4.2.9
  • 5.0.0.1
  • 5.1.7
  • 5.2.3
  • 6.0.0
  • 6.1.3.1
  • 6.1.7.7
  • 7.0.0
  • 7.1.3.2
  • 7.1.3.4
  • 7.2.3
  • 8.0.0 (0)
  • 8.1.1 (0)
  • What's this?
perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notification_payload:, batch: false) private

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 135
          def perform_query(raw_connection, sql, binds, type_casted_binds, prepare,, notification_payload,, batch: false)
            update_typemap_for_default_timezone
            result = if prepare
              begin
                stmt_key = prepare_statement(sql, binds, raw_connection)
                notification_payload[:statement_name] = stmt_key
                raw_connection.exec_prepared(stmt_key, type_casted_binds)
              rescue PG::FeatureNotSupported => error
                if is_cached_plan_failure?(error)
                  # Nothing we can do if we are in a transaction because all commands
                  # will raise InFailedSQLTransaction
                  if in_transaction?
                    raise PreparedStatementCacheExpired.new(error.message, connection_pool: @pool)
                  else
                    @lock.synchronize do
                      # outside of transactions we can simply flush this query and retry
                      @statements.delete sql_key(sql)
                    end
                    retry
                  end
                end

                raise
              end
            elsif binds.nil? || binds.empty?
              raw_connection.async_exec(sql)
            else
              raw_connection.exec_params(sql, type_casted_binds)
            end

            verified!
            handle_warnings(result)
            notification_payload[:row_count] = result.count
            result
          end
Register or log in to add new notes.