Skip to content

Commit

Permalink
Extract discard_remaining_results for mysql2 adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
kamipo committed Jan 29, 2018
1 parent b2c5ec2 commit 798da62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Expand Up @@ -527,10 +527,8 @@ def default_index_type?(index) # :nodoc:
end

def insert_fixtures_set(fixture_set, tables_to_delete = [])
iterate_over_results = -> { while raw_connection.next_result; end; }

with_multi_statements do
super(fixture_set, tables_to_delete, &iterate_over_results)
super { discard_remaining_results }
end
end

Expand Down
Expand Up @@ -11,7 +11,7 @@ def select_all(*) # :nodoc:
else
super
end
@connection.next_result while @connection.more_results?
discard_remaining_results
result
end

Expand Down Expand Up @@ -58,6 +58,10 @@ def last_inserted_id(result)
@connection.last_id
end

def discard_remaining_results
@connection.next_result while @connection.more_results?
end

def exec_stmt_and_free(sql, name, binds, cache_stmt: false)
# make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been
# made since we established the connection
Expand Down

0 comments on commit 798da62

Please sign in to comment.