New test for sqlite sessions

This commit is contained in:
Tomas Juhasz 2025-01-14 16:05:26 +01:00
commit ecbe2863fa
4 changed files with 137 additions and 0 deletions

View file

@ -0,0 +1,16 @@
const { DatabaseSync } = require('node:sqlite');
const database = new DatabaseSync(':memory:');
database.exec(`
CREATE TABLE data(
key INTEGER PRIMARY KEY,
value TEXT
) STRICT
`);
const insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)');
insert.run(1, 'hello');
insert.run(2, 'world');
const query = database.prepare('SELECT * FROM data ORDER BY key');
console.log(query.all());