@@ -20,6 +20,7 @@ An experimental SQLite library for Node using Neon
2020* Target latest node and electron versions
2121* Promise based API
2222* Blob support
23+ * ESNext ` BigInt ` support
2324* SQLite extensions support
2425* Typescript support
2526* Query caching support
@@ -35,7 +36,7 @@ import Sqlite from '@sqlite/sqlite';
3536const connector = new Sqlite ();
3637
3738// Creating a regular async connection
38- const conn = await connection .create ({
39+ const conn = await connection .open ({
3940 database: ' /path/to/database' , // ':memory:'
4041 verbose: true // process.env.NODE_ENV !== 'production'
4142});
@@ -48,7 +49,26 @@ await Promise.all([
4849
4950// Statement currying
5051const updateTables = await db .statement (' UPDATE tbl SET name = ? WHERE email = ?' );
51- await updateTables (' john' , ' john@gmail.com' );
52+ const result = await updateTables (' john' , ' john@gmail.com' );
53+ console .log (result);
54+
55+ // Batching queries
56+ const updateTables = await db .batch (
57+ `
58+ ATTACH DATABASE ':memory:' AS my_attached;
59+ BEGIN;
60+ CREATE TABLE my_attached.foo(x INTEGER);
61+ INSERT INTO my_attached.foo VALUES(42);
62+ END
63+ ` ;
64+ );
65+ const updateTables = await db .batch ([
66+ ' ATTACH DATABASE ' : memory: ' AS my_attached;' ,
67+ ' BEGIN;' ,
68+ ' CREATE TABLE my_attached.foo(x INTEGER);' ,
69+ ' INSERT INTO my_attached.foo VALUES(42);' ,
70+ ' END'
71+ ]);
5272```
5373
5474## Local Development
0 commit comments