Module: ActiveRecord::ConnectionAdapters::Trilogy::DatabaseStatements
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | activerecord/lib/active_record/connection_adapters/trilogy/database_statements.rb |
Instance Method Summary
- #affected_rows(result) private
- #cast_result(result) private
- #execute_batch(statements, name = nil, **kwargs) private
- #last_inserted_id(result) private
- #perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notification_payload:, batch: false) private
- #exec_insert(sql, name, binds, pk = nil, sequence_name = nil, returning: nil) Internal use only
Instance Method Details
#affected_rows(result) (private)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/trilogy/database_statements.rb', line 49
def affected_rows(result) result.affected_rows end
#cast_result(result) (private)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/trilogy/database_statements.rb', line 41
def cast_result(result) if result.fields.empty? ActiveRecord::Result.empty else ActiveRecord::Result.new(result.fields, result.rows) end end
#exec_insert(sql, name, binds, pk = nil, sequence_name = nil, returning: nil)
This method is for internal use only.
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/trilogy/database_statements.rb', line 7
def exec_insert(sql, name, binds, pk = nil, sequence_name = nil, returning: nil) # :nodoc: sql, _binds = sql_for_insert(sql, pk, binds, returning) internal_execute(sql, name) end
#execute_batch(statements, name = nil, **kwargs) (private)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/trilogy/database_statements.rb', line 61
def execute_batch(statements, name = nil, **kwargs) combine_multi_statements(statements).each do |statement| raw_execute(statement, name, batch: true, **kwargs) end end
#last_inserted_id(result) (private)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/trilogy/database_statements.rb', line 53
def last_inserted_id(result) if supports_insert_returning? super else result.last_insert_id end end
#perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notification_payload:, batch: false) (private)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/trilogy/database_statements.rb', line 13
def perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notification_payload:, batch: false) reset_multi_statement = if batch && !@config[:multi_statement] raw_connection.set_server_option(::Trilogy::SET_SERVER_MULTI_STATEMENTS_ON) true end # Make sure we carry over any changes to ActiveRecord.default_timezone that have been # made since we established the connection if default_timezone == :local raw_connection.query_flags |= ::Trilogy::QUERY_FLAGS_LOCAL_TIMEZONE else raw_connection.query_flags &= ~::Trilogy::QUERY_FLAGS_LOCAL_TIMEZONE end result = raw_connection.query(sql) while raw_connection.more_results_exist? raw_connection.next_result end verified! handle_warnings(sql) notification_payload[:row_count] = result.count result ensure if reset_multi_statement && active? raw_connection.set_server_option(::Trilogy::SET_SERVER_MULTI_STATEMENTS_OFF) end end