{{ message }}
Commit 5e387ce
sqlite: reject statement-less SQL in prepare()
Apply the same check to DatabaseSync::Prepare() so that statement-less
SQL is rejected at preparation instead of on first use. This matches
SQLite's own oo1 JavaScript API, which throws when the SQL contains no
statements rather than exposing the C API's null statement pointer.
Previously db.prepare('-- comment') returned a StatementSync whose
statement_ was null. Every method on it threw "statement has been
finalized", which was misleading because nothing had been finalized, and
the object was still inserted into statements_. Since IsFinalized() is
true for a null statement, its destructor skipped UntrackStatement() and
left a dangling pointer in the set that a later close() would finalize.
Refs: #65157 (comment)
Refs: https://sqlite.org/wasm/doc/trunk/api-oo1.md
Signed-off-by: Trevor Burnham <trevorburnham@gmail.com>
PR-URL: #65157
Fixes: #65149
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>1 parent 83169e5 commit 5e387ce
3 files changed
Lines changed: 42 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1581 | 1581 | | |
1582 | 1582 | | |
1583 | 1583 | | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
1584 | 1594 | | |
1585 | 1595 | | |
1586 | 1596 | | |
| |||
3659 | 3669 | | |
3660 | 3670 | | |
3661 | 3671 | | |
3662 | | - | |
3663 | | - | |
3664 | | - | |
| 3672 | + | |
| 3673 | + | |
3665 | 3674 | | |
3666 | 3675 | | |
3667 | 3676 | | |
| |||

0 commit comments