import {DB} from './mod.ts';
const db = new DB(':memory"');
db.query ( `CREATE TABLE example ( id INTEGER PRIMARY KEY, title TEXT, description TEXT )` );
try {
db.transaction ( () => {
db.query ( `INSERT INTO example VALUES( 1, 'title1', 'description1' )` );
db.query ( `INSERT INTO example VALUES( 2, 'title2', 'description2' )` );
db.query ( `INSERT INTO example VALUES( 1, 'title1', 'description1' )` );
});
} catch ( error ) {
console.log('caught error');
console.log(error);
}
Output:
~/Downloads/deno-sqlite-master 2 ❯ deno run -A test.ts
error: Uncaught SqliteError: table example already exists
throw new SqliteError(this.#wasm);
^
at DB.prepareQuery (file:///Users/fabio/Downloads/deno-sqlite-master%202/src/db.ts:366:13)
at DB.query (file:///Users/fabio/Downloads/deno-sqlite-master%202/src/db.ts:258:24)
at file:///Users/fabio/Downloads/deno-sqlite-master%202/test.ts:5:4
~/Downloads/deno-sqlite-master 2 ❯
Wait now I can't reproduce the error anymore with deno-sqlite, very weird 🤔 I can reproduce it reliably with my fork for whatever reason. I'll reopen if I can reproduce it reliably again with deno-sqlite.
Repro:
Output: