libsql-client-ts
libsql-client-ts copied to clipboard
Fix the local database implementation of Client.batch()
We currently implement batch() by issuing every statement separately. Let's switch to libSQL batch interface instead (we need to expose it in libsql first).
This might be related.. I'm initialising the DB on server start like this:
const initSql = readFileSync(dir + '/init_sqlite.sql', 'utf8')
const res = await client.execute(initSql)
The init file contains multiple satements like CREATE TABLE IF NOT EXISTS blabla..
This works locally, so when createClient gets url parameter with file:..., but when using Turso and giving url with libsql://turso... and authToken, it gives an error LibsqlError: SQL_MANY_STATEMENTS: SQL string contains more than one statement
Expected behaviour is consistency i.e. either both ways fail or succeed.