fix(ext/node): SQLite reset guards to prevent database locks (#28298)

Fixes https://github.com/denoland/deno/issues/28295
This commit is contained in:
Divy Srivastava 2025-02-25 19:27:55 +05:30 committed by GitHub
parent b9cffda7c9
commit e66ef32a8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 4 deletions

View file

@ -272,3 +272,17 @@ Deno.test("[node/sqlite] error message", () => {
"NOT NULL constraint failed: foo.b",
);
});
// https://github.com/denoland/deno/issues/28295
Deno.test("[node/sqlite] StatementSync reset guards don't lock db", () => {
const db = new DatabaseSync(":memory:");
db.exec("CREATE TABLE foo(a integer, b text)");
db.exec("CREATE TABLE bar(a integer, b text)");
const stmt = db.prepare("SELECT name FROM sqlite_master WHERE type='table' ");
assertEquals(stmt.get(), { name: "foo", __proto__: null });
db.exec("DROP TABLE IF EXISTS foo");
});