method
perform_query
v8.0.0 -
Show latest stable
- Class:
ActiveRecord::ConnectionAdapters::SQLite3::DatabaseStatements
perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notification_payload:, batch: false)private
No documentation available.
# File activerecord/lib/active_record/connection_adapters/sqlite3/database_statements.rb, line 78
def perform_query(raw_connection, sql, binds, type_casted_binds, prepare,, notification_payload,, batch: false)
if batch
raw_connection.execute_batch2(sql)
elsif prepare
stmt = @statements[sql] ||= raw_connection.prepare(sql)
stmt.reset!
stmt.bind_params(type_casted_binds)
result = if stmt.column_count.zero? # No return
stmt.step
ActiveRecord::Result.empty
else
ActiveRecord::Result.new(stmt.columns, stmt.to_a)
end
else
# Don't cache statements if they are not prepared.
stmt = raw_connection.prepare(sql)
begin
unless binds.nil? || binds.empty?
stmt.bind_params(type_casted_binds)
end
result = if stmt.column_count.zero? # No return
stmt.step
ActiveRecord::Result.empty
else
ActiveRecord::Result.new(stmt.columns, stmt.to_a)
end
ensure
stmt.close
end
end
@last_affected_rows = raw_connection.changes
verified!
notification_payload[:row_count] = result&.length || 0
result
end