method
internal_exec_query
v7.1.3.4 -
Show latest stable
- Class:
ActiveRecord::ConnectionAdapters::SQLite3::DatabaseStatements
internal_exec_query(sql, name = nil, binds = [], prepare: false, async: false)public
No documentation available.
# File activerecord/lib/active_record/connection_adapters/sqlite3/database_statements.rb, line 24
def internal_exec_query(sql, name = nil, binds = [], prepare: false, async: false) # :nodoc:
sql = transform_query(sql)
check_if_write_query(sql)
mark_transaction_written_if_write(sql)
type_casted_binds = type_casted_binds(binds)
log(sql, name, binds, type_casted_binds, async: async) do
with_raw_connection do |conn|
# Don't cache statements if they are not prepared
unless prepare
stmt = conn.prepare(sql)
begin
cols = stmt.columns
unless without_prepared_statement?(binds)
stmt.bind_params(type_casted_binds)
end
records = stmt.to_a
ensure
stmt.close
end
else
stmt = @statements[sql] ||= conn.prepare(sql)
cols = stmt.columns
stmt.reset!
stmt.bind_params(type_casted_binds)
records = stmt.to_a
end
verified!
build_result(columns: cols, rows: records)
end
end
end