fix exec to run over multiple statements in the string

This commit is contained in:
Nikita Sivukhin
2025-09-25 12:03:52 +04:00
parent ddfa77997d
commit a938bdcf09
9 changed files with 169 additions and 57 deletions

View File

@@ -31,6 +31,14 @@ test('in-memory-db-async', async () => {
expect(rows).toEqual([{ x: 1 }, { x: 3 }]);
})
test('exec multiple statements', async () => {
const db = await connect(":memory:");
await db.exec("CREATE TABLE t(x); INSERT INTO t VALUES (1); INSERT INTO t VALUES (2)");
const stmt = db.prepare("SELECT * FROM t");
const rows = await stmt.all();
expect(rows).toEqual([{ x: 1 }, { x: 2 }]);
})
test('readonly-db', async () => {
const path = `test-${(Math.random() * 10000) | 0}.db`;
try {