Skip to Content Skip to Search
Methods
B
N
P

Attributes

[R] allow_retry
[R] batch
[R] name
[R] prepare
[R] sql

Class Public methods

new(sql:, name:, binds:, prepare:, batch:, allow_retry:)

# File activerecord/lib/active_record/connection_adapters/ractor_connection_handler/abstract_proxy_adapter/query_request.rb, line 12
def initialize(sql:, name:, binds:, prepare:, batch:, allow_retry:)
  @prepare = !!prepare
  @batch = !!batch
  @allow_retry = !!allow_retry
  @sql = sql
  @name = name
  @binds_payload = Proxy.dump_binds(binds)
  ActiveSupport::Ractors.make_shareable(self)
end

Instance Public methods

binds()

# File activerecord/lib/active_record/connection_adapters/ractor_connection_handler/abstract_proxy_adapter/query_request.rb, line 22
def binds
  @binds_payload ? Marshal.load(@binds_payload) : []
end

perform(connection)

# File activerecord/lib/active_record/connection_adapters/ractor_connection_handler/abstract_proxy_adapter/query_request.rb, line 26
def perform(connection)
  intent = QueryIntent.new(
    adapter: connection,
    processed_sql: sql,
    name: name,
    binds: binds,
    prepare: prepare,
    allow_retry: allow_retry,
    materialize_transactions: false,
    batch: batch,
  )
  intent.notification_payload = {}

  result, warnings, last_inserted_id = connection.execute_raw_intent(intent)

  QueryResponse.new(
    result,
    intent.notification_payload[:affected_rows] || result.affected_rows,
    intent.notification_payload[:row_count] || result.length,
    last_inserted_id,
    warnings,
  )
end