instance method
raw_execute
Ruby on Rails 8.1.2
Since v7.1.6 PrivateSignature
raw_execute(sql, name = nil, binds = [], prepare: false, async: false, allow_retry: false, materialize_transactions: true, batch: false)
Lowest level way to execute a query. Doesn’t check for illegal writes, doesn’t annotate queries, yields a native result object.
Parameters
-
sqlreq -
nameopt = nil -
bindsopt = [] -
preparekey = false -
asynckey = false -
allow_retrykey = false -
materialize_transactionskey = true -
batchkey = false
Source
# File activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb, line 567
def raw_execute(sql, name = nil, binds = [], prepare: false, async: false, allow_retry: false, materialize_transactions: true, batch: false)
type_casted_binds = type_casted_binds(binds)
log(sql, name, binds, type_casted_binds, async: async, allow_retry: allow_retry) do |notification_payload|
with_raw_connection(allow_retry: allow_retry, materialize_transactions: materialize_transactions) do |conn|
result = perform_query(conn, sql, binds, type_casted_binds, prepare: prepare, notification_payload: notification_payload, batch: batch)
handle_warnings(result, sql)
result
end
end
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb line 567
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::DatabaseStatements