-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsqlite3.test.mjs
47 lines (40 loc) · 1.4 KB
/
sqlite3.test.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// @ts-check
// POSTGRESQL-SPECIFIC TESTS
import sqlite3 from 'sqlite3';
// @ts-ignore
import createSql from '../dist/index.mjs';
// @ts-ignore
import { sqlite3 as sqlite3drv } from '../dist/drivers.mjs';
// @ts-ignore
import { manualTest } from './generic.test.mjs';
const sql = createSql(sqlite3drv(new sqlite3.Database(':memory:')), false);
manualTest(sql)
.then(console.info, console.error)
.finally(() => sql.end());
// console.log('----');
// (async () => {
// console.log('00000');
// await sql`CREATE TABLE IF NOT EXISTS comments (
// user_id TEXT PRIMARY KEY,
// user_role TEXT,
// content TEXT
// )`;
// console.log('AAAAA');
// const req = insert({}, 'test');
// console.log(req.render());
// console.log(await req);
// const req0 = sql`INSERT INTO ${identifier('comments')} ${values([{
// user_role: 'admin',
// user_id: 'test',
// content: 'nothing'
// }])} ON CONFLICT DO NOTHING`;
// console.log(req0.renderSQL());
// console.log(await req0);
// console.log(await sql`SELECT * FROM comments`);
// const req1 = sql`SELECT ${[11, sql`${new Uint8Array(1)} AS "."`, array([[json([{ a: 42, b: 1337 }], (k, v) => k !== 'a' ? undefined : v)], [json(["13'3\\7"])]])]} AS arr`;
// console.log(req1.render());
// console.log(req1.renderSQL());
// console.log((await req1).rows[0]);
// })()
// .finally(() => sql.end())
// .then(console.info, console.error);