Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/database_rewinder/multiple_statements_executor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ def execute_multiple(sql)
else
query_options = raw_connection_or_connection.query_options.dup
query_options[:connect_flags] |= Mysql2::Client::MULTI_STATEMENTS

db_config = ActiveRecord::Base.connection_db_config.configuration_hash
query_options[:host] = db_config[:host] if db_config[:host]
query_options[:username] = db_config[:username] if db_config[:username]
query_options[:password] = db_config[:password] if db_config[:password]
query_options[:database] = db_config[:database] if db_config[:database]

# opens another connection to the DB
client = Mysql2::Client.new query_options
begin
Expand Down