mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-23 03:04:19 +01:00
fix exec to run over multiple statements in the string
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user