Repository navigation
Conversation
…r copies the rest prepare() now makes one sqlite3_prepare_v3 call per invocation: prepare_next already calls it again when no statement came back, and the one-call shape lets the regression test see every tail handed to SQLite. Refs transact-rs#4415
Author
|
The MySQL 8 failures look unrelated to this change: every connection in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Does your PR solve an issue?
fixes #4415
The query buffer now ends in a NUL terminator that every tail keeps, so
sqlite3_prepare_v3parses in place instead of copying the rest of the query for each statement. Executing N statements goes from quadratic to linear: 80,000 statements in oneraw_sqlcall take 201 ms instead of 4.78 s.prepare()now makes onesqlite3_prepare_v3call per invocation.prepare_nextalready calls it again when no statement comes back, and the one-call shape lets the regression test see every tail handed to SQLite.VirtualStatement::newnow rejects it withError::InvalidArgument, andprepare()returns an error instead of looping when SQLite consumes nothing.Tests:
every_tail_handed_to_sqlite_ends_in_nul(unit): the regression test. It fails before the fix.prepare_errors_when_sqlite_consumes_nothing(unit) andit_rejects_a_query_containing_a_nul_byte: both hang before the fix.it_executes_statements_followed_by_whitespace_or_a_commentandit_executes_a_query_that_is_only_a_comment: they pass before and after, and cover the new loop-exit check.Run locally on the pinned 1.94.1 toolchain:
cargo fmt --check,./x.py --clippy(20/20, no warnings), andcargo test -p sqlx-sqlite --all-features. The full./x.pymatrix passes except for 29 MariaDB targets that fail the same way onmain: theclient_sslURL inx.pyis missing the leading.inssl-key=%2Ftests…, and the 10.6 and 10.11 images don't enable TLS whilex.pyasks forssl-mode=required. I ran the Postgres/MySQL/MariaDB targets in a Linux container, because macOSnative-tlscan't do a TLS handshake with the Ed25519 test certificates.Is this a breaking change?
No. Any query that returned before returns the same results now. The only behaviour change is for queries containing a NUL byte, which used to hang forever and now return an error.
Worked on with the help of Claude Opus 5.5.