Files
node/doc/api
Trevor Burnham cb9bb66780 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: https://github.com/nodejs/node/pull/65157#discussion_r3742903347
Refs: https://sqlite.org/wasm/doc/trunk/api-oo1.md

Signed-off-by: Trevor Burnham <trevorburnham@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65157
Fixes: https://github.com/nodejs/node/issues/65149
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-08-11 03:14:51 +00:00
..
2026-08-06 13:17:12 +00:00
2026-08-05 17:33:08 +00:00
2026-08-09 19:06:22 -04:00
2026-08-01 06:15:08 +00:00
2026-07-18 10:18:51 +00:00
2026-08-03 11:44:23 +00:00
2026-08-07 05:19:08 +00:00
2026-08-04 14:01:33 +00:00
2026-08-05 18:21:40 +02:00
2026-05-23 18:43:31 +00:00
2025-12-16 20:31:28 +00:00
2026-07-13 12:34:05 +02:00
2026-08-03 11:44:23 +00:00
2026-08-03 11:44:23 +00:00
2026-07-18 12:59:37 -07:00
2026-08-07 11:29:48 +02:00
2025-06-09 23:45:29 +02:00
2026-08-05 13:57:32 +00:00
2026-08-05 18:21:40 +02:00