Skip to content

Commit

Permalink
Working v1 implementation?
Browse files Browse the repository at this point in the history
  • Loading branch information
george-ma committed Nov 7, 2024
1 parent 518e8c6 commit 8364d54
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions activerecord/lib/active_record/future_result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,20 @@ def exec_query(*, **)

class InsertFixtures < FutureResult # :nodoc:
private
def exec_query(connection, *args, **kwargs)
# If the first arg is an array, treat it as multiple statements
if args.first.is_a?(Array)
statements = args.shift
connection.send(:execute_batch, statements, args.first || "Fixtures Load")
else
connection.exec_fixtures_insert(*args, **kwargs)
def exec_query(connection, *args, **kwargs)
if args.first.is_a?(Array)
debugger
statements = args.shift
name = args.first || "Fixtures Load"

# Combine statements and use select with async
sql = statements.join(";\n")
# sql = connection.send(:combine_multi_statements, statements)
connection.send(:select, sql, name, [], async: FutureResult::SelectAll)
else
connection.exec_fixtures_insert(*args, **kwargs)
end
end
end
end
end
end

0 comments on commit 8364d54

Please sign in to comment.