Class: ActiveRecord::ConnectionAdapters::RactorConnectionHandler::AbstractProxyAdapter::QueryResponse
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | activerecord/lib/active_record/connection_adapters/ractor_connection_handler/abstract_proxy_adapter/query_response.rb |
Overview
Shareable response for the main-side query operation; the worker
materializes it into a Result via #to_result.
Class Method Summary
Instance Attribute Summary
- #affected_rows readonly
- #row_count readonly
Instance Method Summary
Constructor Details
.new(result, affected_rows, row_count, last_inserted_id, warnings) ⇒ QueryResponse
# File 'activerecord/lib/active_record/connection_adapters/ractor_connection_handler/abstract_proxy_adapter/query_response.rb', line 14
def initialize(result, affected_rows, row_count, last_inserted_id, warnings) @columns = result.columns @rows = result.rows @column_types_payload = Proxy.dump_column_types(result) @affected_rows = affected_rows @row_count = row_count @last_inserted_id = last_inserted_id @warnings_payload = unless warnings.nil? || warnings.empty? begin Marshal.dump(warnings).freeze rescue TypeError nil end end ActiveSupport::Ractors.make_shareable(self, copy: false) end
Instance Attribute Details
#affected_rows (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/ractor_connection_handler/abstract_proxy_adapter/query_response.rb', line 12
attr_reader :affected_rows, :row_count
#row_count (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/ractor_connection_handler/abstract_proxy_adapter/query_response.rb', line 12
attr_reader :affected_rows, :row_count
Instance Method Details
#to_result
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/ractor_connection_handler/abstract_proxy_adapter/query_response.rb', line 32
def to_result Result.new( @columns, @rows, @column_types_payload && Marshal.load(@column_types_payload), affected_rows: @affected_rows, warnings: @warnings_payload && Marshal.load(@warnings_payload), last_inserted_id: @last_inserted_id, ) end