tursodatabase / libsql-client-ts

TypeScript/JavaScript client API for libSQL
https://docs.turso.tech/sdk/ts/quickstart
MIT License
226 stars 32 forks source link

support query parameters recognized by sqlite3 in uri for :memory: connection #220

Closed sivukhin closed 3 months ago

sivukhin commented 3 months ago

Context

This PR can address issue https://github.com/tursodatabase/libsql/issues/1411

Transactions within in-memory database are "useless" because client always reset DB connection and recreate it after transaction from scratch which leads to blank state of the in-memory DB after each transaction.

This can be fixed with native SQLite support of connection parameters propagated through query param string: see https://sqlite.org/uri.html#recognized_query_parameters

So, problem can be resolved for such scenarios if file::memory:?cache=shared will be provided as connection URI.

Changes

Testing