Skip to content

fix: transaction fixes #1195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
8 changes: 6 additions & 2 deletions lib/arjdbc/sqlite3/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,12 @@ def execute_batch(statements, name = nil, **kwargs)
end

def disable_referential_integrity # :nodoc:
old_foreign_keys = query_value("PRAGMA foreign_keys")
old_defer_foreign_keys = query_value("PRAGMA defer_foreign_keys")
# Use internal_execute to avoid materializing transactions when reading PRAGMA values
result = internal_execute("PRAGMA foreign_keys", "SCHEMA", allow_retry: false, materialize_transactions: false)
old_foreign_keys = result.rows.first&.first || 0

result = internal_execute("PRAGMA defer_foreign_keys", "SCHEMA", allow_retry: false, materialize_transactions: false)
old_defer_foreign_keys = result.rows.first&.first || 0

begin
raw_execute("PRAGMA defer_foreign_keys = ON", "SCHEMA", allow_retry: false, materialize_transactions: false)
Expand Down
Loading