fix(ext/node): sqlite handle empty blob being NULL (#28674)

Fixes https://github.com/denoland/deno/issues/28672
This commit is contained in:
Divy Srivastava 2025-04-01 06:50:26 -07:00 committed by GitHub
parent 0f40ee7ff4
commit 5bc4266101
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 12 deletions

View file

@ -319,3 +319,17 @@ RETURNING id
const id1 = insertPeople.run({ name: "Flash", birthdate: "1956-07-16" });
assertEquals(id1, { lastInsertRowid: 1, changes: 1 });
});
Deno.test("[node/sqlite] StatementSync empty blob", () => {
const db = new DatabaseSync(":memory:");
db.exec("CREATE TABLE foo(a BLOB NOT NULL)");
db.prepare("INSERT into foo (a) values (?)")
.all(new Uint8Array([]));
const result = db.prepare("SELECT * from foo").get();
assertEquals(result, { a: new Uint8Array([]), __proto__: null });
db.close();
});