@tursodatabase/database-wasm 0.2.2 → 0.3.0-pre.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/main.es.js +2535 -2535
- package/dist/promise.test.js +90 -0
- package/dist/turso.wasm32-wasi.wasm +0 -0
- package/dist/wasm-inline.js +1 -1
- package/package.json +3 -3
package/dist/promise.test.js
CHANGED
|
@@ -1,5 +1,95 @@
|
|
|
1
1
|
import { expect, test } from 'vitest';
|
|
2
2
|
import { connect, Database } from './promise-default.js';
|
|
3
|
+
test('explain', async () => {
|
|
4
|
+
const db = await connect(":memory:");
|
|
5
|
+
const stmt = db.prepare("EXPLAIN SELECT 1");
|
|
6
|
+
expect(stmt.columns()).toEqual([
|
|
7
|
+
{
|
|
8
|
+
"name": "addr",
|
|
9
|
+
"type": "INTEGER",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "opcode",
|
|
13
|
+
"type": "TEXT",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "p1",
|
|
17
|
+
"type": "INTEGER",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "p2",
|
|
21
|
+
"type": "INTEGER",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "p3",
|
|
25
|
+
"type": "INTEGER",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "p4",
|
|
29
|
+
"type": "INTEGER",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "p5",
|
|
33
|
+
"type": "INTEGER",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "comment",
|
|
37
|
+
"type": "TEXT",
|
|
38
|
+
},
|
|
39
|
+
].map(x => ({ ...x, column: null, database: null, table: null })));
|
|
40
|
+
expect(await stmt.all()).toEqual([
|
|
41
|
+
{
|
|
42
|
+
"addr": 0,
|
|
43
|
+
"comment": "Start at 3",
|
|
44
|
+
"opcode": "Init",
|
|
45
|
+
"p1": 0,
|
|
46
|
+
"p2": 3,
|
|
47
|
+
"p3": 0,
|
|
48
|
+
"p4": "",
|
|
49
|
+
"p5": 0,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"addr": 1,
|
|
53
|
+
"comment": "output=r[1]",
|
|
54
|
+
"opcode": "ResultRow",
|
|
55
|
+
"p1": 1,
|
|
56
|
+
"p2": 1,
|
|
57
|
+
"p3": 0,
|
|
58
|
+
"p4": "",
|
|
59
|
+
"p5": 0,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"addr": 2,
|
|
63
|
+
"comment": "",
|
|
64
|
+
"opcode": "Halt",
|
|
65
|
+
"p1": 0,
|
|
66
|
+
"p2": 0,
|
|
67
|
+
"p3": 0,
|
|
68
|
+
"p4": "",
|
|
69
|
+
"p5": 0,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"addr": 3,
|
|
73
|
+
"comment": "r[1]=1",
|
|
74
|
+
"opcode": "Integer",
|
|
75
|
+
"p1": 1,
|
|
76
|
+
"p2": 1,
|
|
77
|
+
"p3": 0,
|
|
78
|
+
"p4": "",
|
|
79
|
+
"p5": 0,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"addr": 4,
|
|
83
|
+
"comment": "",
|
|
84
|
+
"opcode": "Goto",
|
|
85
|
+
"p1": 0,
|
|
86
|
+
"p2": 1,
|
|
87
|
+
"p3": 0,
|
|
88
|
+
"p4": "",
|
|
89
|
+
"p5": 0,
|
|
90
|
+
},
|
|
91
|
+
]);
|
|
92
|
+
});
|
|
3
93
|
test('in-memory db', async () => {
|
|
4
94
|
const db = await connect(":memory:");
|
|
5
95
|
await db.exec("CREATE TABLE t(x)");
|
|
Binary file
|