Class: ActiveRecord::ConnectionAdapters::QueryIntent
Do not use. This class is for internal use only.
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | activerecord/lib/active_record/connection_adapters/query_intent.rb |
Class Method Summary
Instance Attribute Summary
- #allow_retry readonly
- #arel readonly
- #async rw
- #batch readonly
- #binds rw
- #materialize_transactions readonly
- #name readonly
-
#needs_arel_compilation? ⇒ Boolean
readonly
Returns true if this
QueryIntentcontains an::ArelAST that needs compilation. - #notification_payload rw
- #prepare readonly
- #processed_sql rw
- #raw_sql rw
- #type_casted_binds rw
Instance Method Summary
-
#inspect
Returns a string representation showing key attributes.
-
#set_compiled_result(raw_sql:, binds:, prepare:, allow_retry:)
Sets the results of
::Arelcompilation Called by the adapter after running to_sql_and_binds. -
#to_h
Returns a hash representation of the
QueryIntentfor debugging/introspection.
Constructor Details
.new(arel: nil, raw_sql: nil, processed_sql: nil, name: "SQL", binds: [], prepare: false, async: false, allow_retry: false, materialize_transactions: true, batch: false) ⇒ QueryIntent
# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 10
def initialize(arel: nil, raw_sql: nil, processed_sql: nil, name: "SQL", binds: [], prepare: false, async: false, allow_retry: false, materialize_transactions: true, batch: false) if arel.nil? && raw_sql.nil? && processed_sql.nil? raise ArgumentError, "One of arel, raw_sql, or processed_sql must be provided" end @arel = arel @raw_sql = raw_sql @name = name @binds = binds @prepare = prepare @async = async @allow_retry = allow_retry @materialize_transactions = materialize_transactions @batch = batch @processed_sql = processed_sql @type_casted_binds = nil @notification_payload = nil end
Instance Attribute Details
#allow_retry (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 6
attr_reader :arel, :name, :prepare, :allow_retry, :materialize_transactions, :batch
#arel (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 6
attr_reader :arel, :name, :prepare, :allow_retry, :materialize_transactions, :batch
#async (rw)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 8
attr_accessor :raw_sql, :binds, :async, :processed_sql, :type_casted_binds, :notification_payload
#batch (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 6
attr_reader :arel, :name, :prepare, :allow_retry, :materialize_transactions, :batch
#binds (rw)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 8
attr_accessor :raw_sql, :binds, :async, :processed_sql, :type_casted_binds, :notification_payload
#materialize_transactions (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 6
attr_reader :arel, :name, :prepare, :allow_retry, :materialize_transactions, :batch
#name (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 6
attr_reader :arel, :name, :prepare, :allow_retry, :materialize_transactions, :batch
#needs_arel_compilation? ⇒ Boolean (readonly)
Returns true if this QueryIntent contains an ::Arel AST that needs compilation
# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 31
def needs_arel_compilation? @arel && !@raw_sql && !@processed_sql end
#notification_payload (rw)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 8
attr_accessor :raw_sql, :binds, :async, :processed_sql, :type_casted_binds, :notification_payload
#prepare (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 6
attr_reader :arel, :name, :prepare, :allow_retry, :materialize_transactions, :batch
#processed_sql (rw)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 8
attr_accessor :raw_sql, :binds, :async, :processed_sql, :type_casted_binds, :notification_payload
#raw_sql (rw)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 8
attr_accessor :raw_sql, :binds, :async, :processed_sql, :type_casted_binds, :notification_payload
#type_casted_binds (rw)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 8
attr_accessor :raw_sql, :binds, :async, :processed_sql, :type_casted_binds, :notification_payload
Instance Method Details
#inspect
Returns a string representation showing key attributes
# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 63
def inspect "#<#{self.class.name} name=#{name.inspect} allow_retry=#{allow_retry} materialize_transactions=#{materialize_transactions}>" end
#set_compiled_result(raw_sql:, binds:, prepare:, allow_retry:)
Sets the results of ::Arel compilation Called by the adapter after running to_sql_and_binds
# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 37
def set_compiled_result(raw_sql:, binds:, prepare:, allow_retry:) @raw_sql = raw_sql @binds = binds @prepare = prepare @allow_retry = allow_retry end
#to_h
Returns a hash representation of the QueryIntent for debugging/introspection
# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 45
def to_h { arel: arel, raw_sql: raw_sql, processed_sql: processed_sql, name: name, binds: binds, prepare: prepare, async: async, allow_retry: allow_retry, materialize_transactions: materialize_transactions, batch: batch, type_casted_binds: type_casted_binds, notification_payload: notification_payload } end