You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the TS client simply opening and closing a transaction make a subsequent SELECT fail, complaining about a table not existing. The same code works fine if the url is a file instead of :memory:
import*aslibsqlClientfrom'@libsql/client';import{log}from'console';import{randomUUID}from'crypto';void(async()=>{// This succeedsconstfileClient=libsqlClient.createClient({url: `file:/tmp/${randomUUID()}.db`,});awaitfileClient.execute('CREATE TABLE events (id TEXT)');log(awaitfileClient.execute('SELECT * FROM events;'));constfileTransaction=awaitfileClient.transaction();fileTransaction.close();log(awaitfileClient.execute('SELECT * FROM events;'));// This failsconstclient=libsqlClient.createClient({url: ':memory:'});awaitclient.execute('CREATE TABLE events (id TEXT)');log(awaitclient.execute('SELECT * FROM events;'));consttransaction=awaitclient.transaction();transaction.close();log(awaitclient.execute('SELECT * FROM events;'));})();
The second SELECT for the memory client fails:
$ bun src/test-transactions.ts
ResultSetImpl {
columns: [ "id" ],
columnTypes: [ "TEXT" ],
rows: [],
rowsAffected: 0,
lastInsertRowid: undefined,
toJSON: [Function: toJSON],
}
ResultSetImpl {
columns: [ "id" ],
columnTypes: [ "TEXT" ],
rows: [],
rowsAffected: 0,
lastInsertRowid: undefined,
toJSON: [Function: toJSON],
}
ResultSetImpl {
columns: [ "id" ],
columnTypes: [ "TEXT" ],
rows: [],
rowsAffected: 0,
lastInsertRowid: undefined,
toJSON: [Function: toJSON],
}
6 | rawCode;
7 | constructor(message, code, rawCode, cause) {
8 | if (code !== undefined) {
9 | message = `${code}: ${message}`;
10 | }
11 | super(message, { cause });
^
LibsqlError: SQLITE_ERROR: no such table: events
cause: {
"stack": "Error: no such table: events\n at convertError (/home/hff/repos/makespace-members-app/node_modules/libsql/index.js:49:9)\n at prepare (/home/hff/repos/makespace-members-app/node_modules/libsql/index.js:110:28)\n at executeStmt (/home/hff/repos/makespace-members-app/node_modules/@libsql/client/lib-esm/sqlite3.js:194:26)\n at execute (/home/hff/repos/makespace-members-app/node_modules/@libsql/client/lib-esm/sqlite3.js:60:15)\n at <anonymous> (/home/hff/repos/makespace-members-app/src/test-transactions.ts:17:14)",
"code": "SQLITE_ERROR",
"rawCode": 1
}
code: "SQLITE_ERROR"
at new LibsqlError (/home/hff/repos/makespace-members-app/node_modules/@libsql/core/lib-esm/api.js:11:9)
at mapSqliteError (/home/hff/repos/makespace-members-app/node_modules/@libsql/client/lib-esm/sqlite3.js:312:16)
at executeStmt (/home/hff/repos/makespace-members-app/node_modules/@libsql/client/lib-esm/sqlite3.js:222:15)
at execute (/home/hff/repos/makespace-members-app/node_modules/@libsql/client/lib-esm/sqlite3.js:59:19)
at /home/hff/repos/makespace-members-app/src/test-transactions.ts:22:13
The text was updated successfully, but these errors were encountered:
erkannt
added a commit
to Makespace/members-app
that referenced
this issue
May 23, 2024
Using the TS client simply opening and closing a transaction make a subsequent
SELECT
fail, complaining about a table not existing. The same code works fine if theurl
is a file instead of:memory:
The second
SELECT
for the memory client fails:The text was updated successfully, but these errors were encountered: