v0.10.0 The "Well crap, I guess I need a Conn class anyway" release
Pre-release
Pre-release
I wasn't supposed to be doing this, I was supposed to be writing the HTTP VFS module... but I needed to test various arguments to sqlite3_open_v2 and that lead to wanting to change the connection mid-sql and etc. etc.
So now you can open a new connection (closing any previous one) using:
import { Conn, open, exec } from 'sql.mjs';
const test = new Conn();
await exec(test.sql`${open`file://localhost/test.db?vfs=opfs`}`);By default, new Conn() will open an in-memory database when you first call .sql on it.