instance method
exec_query
Ruby on Rails 6.1.7.10
Since v5.2.8.1 Last seen in v6.1.7.10Signature
exec_query(sql, name = "SQL", binds = [], prepare: false)
No documentation comment.
Parameters
-
sqlreq -
nameopt = "SQL" -
bindsopt = [] -
preparekey = false
Source
# File activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb, line 55
def exec_query(sql, name = "SQL", binds = [], prepare: false)
if without_prepared_statement?(binds)
execute_and_free(sql, name) do |result|
if result
build_result(columns: result.fields, rows: result.to_a)
else
build_result(columns: [], rows: [])
end
end
else
exec_stmt_and_free(sql, name, binds, cache_stmt: prepare) do |_, result|
if result
build_result(columns: result.fields, rows: result.to_a)
else
build_result(columns: [], rows: [])
end
end
end
end
Defined in activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb line 55
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::MySQL::DatabaseStatements