llonebot-dist 6.6.4
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.
- dist/default_config.json +68 -0
- dist/llonebot.js +48348 -0
- dist/llonebot.js.map +1 -0
- dist/node_modules/@borewit/text-codec/LICENSE.txt +9 -0
- dist/node_modules/@borewit/text-codec/README.md +76 -0
- dist/node_modules/@borewit/text-codec/lib/index.d.ts +8 -0
- dist/node_modules/@borewit/text-codec/lib/index.js +161 -0
- dist/node_modules/@borewit/text-codec/package.json +68 -0
- dist/node_modules/@minatojs/sql.js/LICENSE +44 -0
- dist/node_modules/@minatojs/sql.js/README.md +357 -0
- dist/node_modules/@minatojs/sql.js/dist/sql-wasm.d.ts +316 -0
- dist/node_modules/@minatojs/sql.js/dist/sql-wasm.js +225 -0
- dist/node_modules/@minatojs/sql.js/dist/sql-wasm.wasm +0 -0
- dist/node_modules/@minatojs/sql.js/package.json +58 -0
- dist/node_modules/@tokenizer/inflate/LICENSE +15 -0
- dist/node_modules/@tokenizer/inflate/README.md +114 -0
- dist/node_modules/@tokenizer/inflate/lib/GzipHandler.d.ts +6 -0
- dist/node_modules/@tokenizer/inflate/lib/GzipHandler.js +19 -0
- dist/node_modules/@tokenizer/inflate/lib/ZipHandler.d.ts +26 -0
- dist/node_modules/@tokenizer/inflate/lib/ZipHandler.js +233 -0
- dist/node_modules/@tokenizer/inflate/lib/ZipToken.d.ts +94 -0
- dist/node_modules/@tokenizer/inflate/lib/ZipToken.js +117 -0
- dist/node_modules/@tokenizer/inflate/lib/index.d.ts +3 -0
- dist/node_modules/@tokenizer/inflate/lib/index.js +2 -0
- dist/node_modules/@tokenizer/inflate/package.json +76 -0
- dist/node_modules/@tokenizer/token/README.md +19 -0
- dist/node_modules/@tokenizer/token/index.d.ts +30 -0
- dist/node_modules/@tokenizer/token/package.json +33 -0
- dist/node_modules/debug/LICENSE +20 -0
- dist/node_modules/debug/README.md +481 -0
- dist/node_modules/debug/package.json +64 -0
- dist/node_modules/debug/src/browser.js +272 -0
- dist/node_modules/debug/src/common.js +292 -0
- dist/node_modules/debug/src/index.js +10 -0
- dist/node_modules/debug/src/node.js +263 -0
- dist/node_modules/file-type/core.d.ts +253 -0
- dist/node_modules/file-type/core.js +1899 -0
- dist/node_modules/file-type/index.d.ts +98 -0
- dist/node_modules/file-type/index.js +86 -0
- dist/node_modules/file-type/license +9 -0
- dist/node_modules/file-type/package.json +288 -0
- dist/node_modules/file-type/readme.md +674 -0
- dist/node_modules/file-type/supported.js +356 -0
- dist/node_modules/file-type/util.js +60 -0
- dist/node_modules/ieee754/LICENSE +11 -0
- dist/node_modules/ieee754/README.md +51 -0
- dist/node_modules/ieee754/index.d.ts +10 -0
- dist/node_modules/ieee754/index.js +85 -0
- dist/node_modules/ieee754/package.json +52 -0
- dist/node_modules/ms/index.js +162 -0
- dist/node_modules/ms/license.md +21 -0
- dist/node_modules/ms/package.json +38 -0
- dist/node_modules/ms/readme.md +59 -0
- dist/node_modules/silk-wasm/LICENSE +21 -0
- dist/node_modules/silk-wasm/README.md +85 -0
- dist/node_modules/silk-wasm/lib/index.cjs +16 -0
- dist/node_modules/silk-wasm/lib/index.d.ts +70 -0
- dist/node_modules/silk-wasm/lib/index.mjs +16 -0
- dist/node_modules/silk-wasm/lib/silk.wasm +0 -0
- dist/node_modules/silk-wasm/lib/utils.d.ts +4 -0
- dist/node_modules/silk-wasm/package.json +39 -0
- dist/node_modules/strtok3/LICENSE.txt +21 -0
- dist/node_modules/strtok3/README.md +399 -0
- dist/node_modules/strtok3/lib/AbstractTokenizer.d.ts +76 -0
- dist/node_modules/strtok3/lib/AbstractTokenizer.js +108 -0
- dist/node_modules/strtok3/lib/BlobTokenizer.d.ts +29 -0
- dist/node_modules/strtok3/lib/BlobTokenizer.js +53 -0
- dist/node_modules/strtok3/lib/BufferTokenizer.d.ts +29 -0
- dist/node_modules/strtok3/lib/BufferTokenizer.js +52 -0
- dist/node_modules/strtok3/lib/FileTokenizer.d.ts +37 -0
- dist/node_modules/strtok3/lib/FileTokenizer.js +61 -0
- dist/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts +31 -0
- dist/node_modules/strtok3/lib/ReadStreamTokenizer.js +102 -0
- dist/node_modules/strtok3/lib/core.d.ts +40 -0
- dist/node_modules/strtok3/lib/core.js +62 -0
- dist/node_modules/strtok3/lib/index.d.ts +16 -0
- dist/node_modules/strtok3/lib/index.js +22 -0
- dist/node_modules/strtok3/lib/stream/AbstractStreamReader.d.ts +54 -0
- dist/node_modules/strtok3/lib/stream/AbstractStreamReader.js +71 -0
- dist/node_modules/strtok3/lib/stream/Deferred.d.ts +6 -0
- dist/node_modules/strtok3/lib/stream/Deferred.js +10 -0
- dist/node_modules/strtok3/lib/stream/Errors.d.ts +10 -0
- dist/node_modules/strtok3/lib/stream/Errors.js +16 -0
- dist/node_modules/strtok3/lib/stream/StreamReader.d.ts +29 -0
- dist/node_modules/strtok3/lib/stream/StreamReader.js +83 -0
- dist/node_modules/strtok3/lib/stream/WebStreamByobReader.d.ts +14 -0
- dist/node_modules/strtok3/lib/stream/WebStreamByobReader.js +27 -0
- dist/node_modules/strtok3/lib/stream/WebStreamDefaultReader.d.ts +19 -0
- dist/node_modules/strtok3/lib/stream/WebStreamDefaultReader.js +62 -0
- dist/node_modules/strtok3/lib/stream/WebStreamReader.d.ts +14 -0
- dist/node_modules/strtok3/lib/stream/WebStreamReader.js +13 -0
- dist/node_modules/strtok3/lib/stream/WebStreamReaderFactory.d.ts +5 -0
- dist/node_modules/strtok3/lib/stream/WebStreamReaderFactory.js +19 -0
- dist/node_modules/strtok3/lib/stream/index.d.ts +6 -0
- dist/node_modules/strtok3/lib/stream/index.js +5 -0
- dist/node_modules/strtok3/lib/types.d.ts +139 -0
- dist/node_modules/strtok3/lib/types.js +1 -0
- dist/node_modules/strtok3/package.json +94 -0
- dist/node_modules/token-types/LICENSE.txt +9 -0
- dist/node_modules/token-types/README.md +120 -0
- dist/node_modules/token-types/lib/index.d.ts +135 -0
- dist/node_modules/token-types/lib/index.js +401 -0
- dist/node_modules/token-types/package.json +81 -0
- dist/node_modules/uint8array-extras/index.d.ts +312 -0
- dist/node_modules/uint8array-extras/index.js +321 -0
- dist/node_modules/uint8array-extras/license +9 -0
- dist/node_modules/uint8array-extras/package.json +54 -0
- dist/node_modules/uint8array-extras/readme.md +301 -0
- dist/node_modules/ws/LICENSE +20 -0
- dist/node_modules/ws/README.md +548 -0
- dist/node_modules/ws/browser.js +8 -0
- dist/node_modules/ws/index.js +13 -0
- dist/node_modules/ws/lib/buffer-util.js +131 -0
- dist/node_modules/ws/lib/constants.js +18 -0
- dist/node_modules/ws/lib/event-target.js +292 -0
- dist/node_modules/ws/lib/extension.js +203 -0
- dist/node_modules/ws/lib/limiter.js +55 -0
- dist/node_modules/ws/lib/permessage-deflate.js +528 -0
- dist/node_modules/ws/lib/receiver.js +706 -0
- dist/node_modules/ws/lib/sender.js +602 -0
- dist/node_modules/ws/lib/stream.js +161 -0
- dist/node_modules/ws/lib/subprotocol.js +62 -0
- dist/node_modules/ws/lib/validation.js +152 -0
- dist/node_modules/ws/lib/websocket-server.js +550 -0
- dist/node_modules/ws/lib/websocket.js +1388 -0
- dist/node_modules/ws/package.json +69 -0
- dist/node_modules/ws/wrapper.mjs +8 -0
- dist/package.json +1 -0
- dist/webui/assets/index-B9vGhdCO.js +256 -0
- dist/webui/assets/index-DaqFU7JR.css +1 -0
- dist/webui/index.html +13 -0
- dist/webui/logo.jpg +0 -0
- dist//344/275/277/347/224/250/350/257/264/346/230/216.txt +11 -0
- dist//346/233/264/346/226/260/346/227/245/345/277/227.txt +399 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
<img src="https://user-images.githubusercontent.com/552629/76405509-87025300-6388-11ea-86c9-af882abb00bd.png" width="40" height="40" />
|
|
2
|
+
|
|
3
|
+
# SQLite compiled to JavaScript
|
|
4
|
+
|
|
5
|
+
[](https://github.com/sql-js/sql.js/actions)
|
|
6
|
+
[](https://www.npmjs.com/package/sql.js)
|
|
7
|
+
[](https://cdnjs.com/libraries/sql.js)
|
|
8
|
+
|
|
9
|
+
*sql.js* is a javascript SQL database. It allows you to create a relational database and query it entirely in the browser. You can try it in [this online demo](https://sql.js.org/examples/GUI/). It uses a [virtual database file stored in memory](https://emscripten.org/docs/porting/files/file_systems_overview.html), and thus **doesn't persist the changes** made to the database. However, it allows you to **import** any existing sqlite file, and to **export** the created database as a [JavaScript typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays).
|
|
10
|
+
|
|
11
|
+
*sql.js* uses [emscripten](https://emscripten.org/docs/introducing_emscripten/about_emscripten.html) to compile [SQLite](http://sqlite.org/about.html) to webassembly (or to javascript code for compatibility with older browsers). It includes [contributed math and string extension functions](https://www.sqlite.org/contrib?orderby=date).
|
|
12
|
+
|
|
13
|
+
sql.js can be used like any traditional JavaScript library. If you are building a native application in JavaScript (using Electron for instance), or are working in node.js, you will likely prefer to use [a native binding of SQLite to JavaScript](https://www.npmjs.com/package/sqlite3). A native binding will not only be faster because it will run native code, but it will also be able to work on database files directly instead of having to load the entire database in memory, avoiding out of memory errors and further improving performances.
|
|
14
|
+
|
|
15
|
+
SQLite is public domain, sql.js is MIT licensed.
|
|
16
|
+
|
|
17
|
+
## API documentation
|
|
18
|
+
A [full API documentation](https://sql.js.org/documentation/) for all the available classes and methods is available.
|
|
19
|
+
It is generated from comments inside the source code, and is thus always up to date.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
By default, *sql.js* uses [wasm](https://developer.mozilla.org/en-US/docs/WebAssembly), and thus needs to load a `.wasm` file in addition to the javascript library. You can find this file in `./node_modules/sql.js/dist/sql-wasm.wasm` after installing sql.js from npm, and instruct your bundler to add it to your static assets or load it from [a CDN](https://cdnjs.com/libraries/sql.js). Then use the [`locateFile`](https://emscripten.org/docs/api_reference/module.html#Module.locateFile) property of the configuration object passed to `initSqlJs` to indicate where the file is. If you use an asset builder such as webpack, you can automate this. See [this demo of how to integrate sql.js with webpack (and react)](https://github.com/sql-js/react-sqljs-demo).
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
const initSqlJs = require('sql.js');
|
|
27
|
+
// or if you are in a browser:
|
|
28
|
+
// const initSqlJs = window.initSqlJs;
|
|
29
|
+
|
|
30
|
+
const SQL = await initSqlJs({
|
|
31
|
+
// Required to load the wasm binary asynchronously. Of course, you can host it wherever you want
|
|
32
|
+
// You can omit locateFile completely when running in node
|
|
33
|
+
locateFile: file => `https://sql.js.org/dist/${file}`
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Create a database
|
|
37
|
+
const db = new SQL.Database();
|
|
38
|
+
// NOTE: You can also use new SQL.Database(data) where
|
|
39
|
+
// data is an Uint8Array representing an SQLite database file
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// Execute a single SQL string that contains multiple statements
|
|
43
|
+
let sqlstr = "CREATE TABLE hello (a int, b char); \
|
|
44
|
+
INSERT INTO hello VALUES (0, 'hello'); \
|
|
45
|
+
INSERT INTO hello VALUES (1, 'world');";
|
|
46
|
+
db.run(sqlstr); // Run the query without returning anything
|
|
47
|
+
|
|
48
|
+
// Prepare an sql statement
|
|
49
|
+
const stmt = db.prepare("SELECT * FROM hello WHERE a=:aval AND b=:bval");
|
|
50
|
+
|
|
51
|
+
// Bind values to the parameters and fetch the results of the query
|
|
52
|
+
const result = stmt.getAsObject({':aval' : 1, ':bval' : 'world'});
|
|
53
|
+
console.log(result); // Will print {a:1, b:'world'}
|
|
54
|
+
|
|
55
|
+
// Bind other values
|
|
56
|
+
stmt.bind([0, 'hello']);
|
|
57
|
+
while (stmt.step()) console.log(stmt.get()); // Will print [0, 'hello']
|
|
58
|
+
// free the memory used by the statement
|
|
59
|
+
stmt.free();
|
|
60
|
+
// You can not use your statement anymore once it has been freed.
|
|
61
|
+
// But not freeing your statements causes memory leaks. You don't want that.
|
|
62
|
+
|
|
63
|
+
const res = db.exec("SELECT * FROM hello");
|
|
64
|
+
/*
|
|
65
|
+
[
|
|
66
|
+
{columns:['a','b'], values:[[0,'hello'],[1,'world']]}
|
|
67
|
+
]
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
// You can also use JavaScript functions inside your SQL code
|
|
71
|
+
// Create the js function you need
|
|
72
|
+
function add(a, b) {return a+b;}
|
|
73
|
+
// Specifies the SQL function's name, the number of it's arguments, and the js function to use
|
|
74
|
+
db.create_function("add_js", add);
|
|
75
|
+
// Run a query in which the function is used
|
|
76
|
+
db.run("INSERT INTO hello VALUES (add_js(7, 3), add_js('Hello ', 'world'));"); // Inserts 10 and 'Hello world'
|
|
77
|
+
|
|
78
|
+
// You can create custom aggregation functions, by passing a name
|
|
79
|
+
// and a set of functions to `db.create_aggregate`:
|
|
80
|
+
//
|
|
81
|
+
// - an `init` function. This function receives no argument and returns
|
|
82
|
+
// the initial value for the state of the aggregate function.
|
|
83
|
+
// - a `step` function. This function takes two arguments
|
|
84
|
+
// - the current state of the aggregation
|
|
85
|
+
// - a new value to aggregate to the state
|
|
86
|
+
// It should return a new value for the state.
|
|
87
|
+
// - a `finalize` function. This function receives a state object, and
|
|
88
|
+
// returns the final value of the aggregate. It can be omitted, in which case
|
|
89
|
+
// the final value of the state will be returned directly by the aggregate function.
|
|
90
|
+
//
|
|
91
|
+
// Here is an example aggregation function, `json_agg`, which will collect all
|
|
92
|
+
// input values and return them as a JSON array:
|
|
93
|
+
db.create_aggregate(
|
|
94
|
+
"json_agg",
|
|
95
|
+
{
|
|
96
|
+
init: () => [],
|
|
97
|
+
step: (state, val) => [...state, val],
|
|
98
|
+
finalize: (state) => JSON.stringify(state),
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
db.exec("SELECT json_agg(column1) FROM (VALUES ('hello'), ('world'))");
|
|
103
|
+
// -> The result of the query is the string '["hello","world"]'
|
|
104
|
+
|
|
105
|
+
// Export the database to an Uint8Array containing the SQLite database file
|
|
106
|
+
const binaryArray = db.export();
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Demo
|
|
110
|
+
There are a few examples [available here](https://sql-js.github.io/sql.js/index.html). The most full-featured is the [Sqlite Interpreter](https://sql-js.github.io/sql.js/examples/GUI/index.html).
|
|
111
|
+
|
|
112
|
+
## Examples
|
|
113
|
+
The test files provide up to date example of the use of the api.
|
|
114
|
+
### Inside the browser
|
|
115
|
+
#### Example **HTML** file:
|
|
116
|
+
```html
|
|
117
|
+
<meta charset="utf8" />
|
|
118
|
+
<html>
|
|
119
|
+
<script src='/dist/sql-wasm.js'></script>
|
|
120
|
+
<script>
|
|
121
|
+
config = {
|
|
122
|
+
locateFile: filename => `/dist/${filename}`
|
|
123
|
+
}
|
|
124
|
+
// The `initSqlJs` function is globally provided by all of the main dist files if loaded in the browser.
|
|
125
|
+
// We must specify this locateFile function if we are loading a wasm file from anywhere other than the current html page's folder.
|
|
126
|
+
initSqlJs(config).then(function(SQL){
|
|
127
|
+
//Create the database
|
|
128
|
+
const db = new SQL.Database();
|
|
129
|
+
// Run a query without reading the results
|
|
130
|
+
db.run("CREATE TABLE test (col1, col2);");
|
|
131
|
+
// Insert two rows: (1,111) and (2,222)
|
|
132
|
+
db.run("INSERT INTO test VALUES (?,?), (?,?)", [1,111,2,222]);
|
|
133
|
+
|
|
134
|
+
// Prepare a statement
|
|
135
|
+
const stmt = db.prepare("SELECT * FROM test WHERE col1 BETWEEN $start AND $end");
|
|
136
|
+
stmt.getAsObject({$start:1, $end:1}); // {col1:1, col2:111}
|
|
137
|
+
|
|
138
|
+
// Bind new values
|
|
139
|
+
stmt.bind({$start:1, $end:2});
|
|
140
|
+
while(stmt.step()) { //
|
|
141
|
+
const row = stmt.getAsObject();
|
|
142
|
+
console.log('Here is a row: ' + JSON.stringify(row));
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
</script>
|
|
146
|
+
<body>
|
|
147
|
+
Output is in Javascript console
|
|
148
|
+
</body>
|
|
149
|
+
</html>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### Creating a database from a file chosen by the user
|
|
153
|
+
`SQL.Database` constructor takes an array of integer representing a database file as an optional parameter.
|
|
154
|
+
The following code uses an HTML input as the source for loading a database:
|
|
155
|
+
```javascript
|
|
156
|
+
dbFileElm.onchange = () => {
|
|
157
|
+
const f = dbFileElm.files[0];
|
|
158
|
+
const r = new FileReader();
|
|
159
|
+
r.onload = function() {
|
|
160
|
+
const Uints = new Uint8Array(r.result);
|
|
161
|
+
db = new SQL.Database(Uints);
|
|
162
|
+
}
|
|
163
|
+
r.readAsArrayBuffer(f);
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
See : https://sql-js.github.io/sql.js/examples/GUI/gui.js
|
|
167
|
+
|
|
168
|
+
#### Loading a database from a server
|
|
169
|
+
|
|
170
|
+
##### using fetch
|
|
171
|
+
|
|
172
|
+
```javascript
|
|
173
|
+
const sqlPromise = initSqlJs({
|
|
174
|
+
locateFile: file => `https://path/to/your/dist/folder/dist/${file}`
|
|
175
|
+
});
|
|
176
|
+
const dataPromise = fetch("/path/to/database.sqlite").then(res => res.arrayBuffer());
|
|
177
|
+
const [SQL, buf] = await Promise.all([sqlPromise, dataPromise])
|
|
178
|
+
const db = new SQL.Database(new Uint8Array(buf));
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
##### using XMLHttpRequest
|
|
182
|
+
|
|
183
|
+
```javascript
|
|
184
|
+
const xhr = new XMLHttpRequest();
|
|
185
|
+
// For example: https://github.com/lerocha/chinook-database/raw/master/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite
|
|
186
|
+
xhr.open('GET', '/path/to/database.sqlite', true);
|
|
187
|
+
xhr.responseType = 'arraybuffer';
|
|
188
|
+
|
|
189
|
+
xhr.onload = e => {
|
|
190
|
+
const uInt8Array = new Uint8Array(xhr.response);
|
|
191
|
+
const db = new SQL.Database(uInt8Array);
|
|
192
|
+
const contents = db.exec("SELECT * FROM my_table");
|
|
193
|
+
// contents is now [{columns:['col1','col2',...], values:[[first row], [second row], ...]}]
|
|
194
|
+
};
|
|
195
|
+
xhr.send();
|
|
196
|
+
```
|
|
197
|
+
See: https://github.com/sql-js/sql.js/wiki/Load-a-database-from-the-server
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
### Use from node.js
|
|
201
|
+
|
|
202
|
+
`sql.js` is [hosted on npm](https://www.npmjs.org/package/sql.js). To install it, you can simply run `npm install sql.js`.
|
|
203
|
+
Alternatively, you can simply download `sql-wasm.js` and `sql-wasm.wasm`, from the download link below.
|
|
204
|
+
|
|
205
|
+
#### read a database from the disk:
|
|
206
|
+
```javascript
|
|
207
|
+
const fs = require('fs');
|
|
208
|
+
const initSqlJs = require('sql-wasm.js');
|
|
209
|
+
const filebuffer = fs.readFileSync('test.sqlite');
|
|
210
|
+
|
|
211
|
+
initSqlJs().then(function(SQL){
|
|
212
|
+
// Load the db
|
|
213
|
+
const db = new SQL.Database(filebuffer);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
#### write a database to the disk
|
|
219
|
+
You need to convert the result of `db.export` to a buffer
|
|
220
|
+
```javascript
|
|
221
|
+
const fs = require("fs");
|
|
222
|
+
// [...] (create the database)
|
|
223
|
+
const data = db.export();
|
|
224
|
+
const buffer = Buffer.from(data);
|
|
225
|
+
fs.writeFileSync("filename.sqlite", buffer);
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
See : https://github.com/sql-js/sql.js/blob/master/test/test_node_file.js
|
|
229
|
+
|
|
230
|
+
### Use as web worker
|
|
231
|
+
If you don't want to run CPU-intensive SQL queries in your main application thread,
|
|
232
|
+
you can use the *more limited* WebWorker API.
|
|
233
|
+
|
|
234
|
+
You will need to download `worker.sql-wasm.js` and `worker.sql-wasm.wasm` from the [release page](https://github.com/sql-js/sql.js/releases).
|
|
235
|
+
|
|
236
|
+
Example:
|
|
237
|
+
```html
|
|
238
|
+
<script>
|
|
239
|
+
const worker = new Worker("/dist/worker.sql-wasm.js");
|
|
240
|
+
worker.onmessage = () => {
|
|
241
|
+
console.log("Database opened");
|
|
242
|
+
worker.onmessage = event => {
|
|
243
|
+
console.log(event.data); // The result of the query
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
worker.postMessage({
|
|
247
|
+
id: 2,
|
|
248
|
+
action: "exec",
|
|
249
|
+
sql: "SELECT age,name FROM test WHERE id=$id",
|
|
250
|
+
params: { "$id": 1 }
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
worker.onerror = e => console.log("Worker error: ", e);
|
|
255
|
+
worker.postMessage({
|
|
256
|
+
id:1,
|
|
257
|
+
action:"open",
|
|
258
|
+
buffer:buf, /*Optional. An ArrayBuffer representing an SQLite Database file*/
|
|
259
|
+
});
|
|
260
|
+
</script>
|
|
261
|
+
```
|
|
262
|
+
### Enabling BigInt support
|
|
263
|
+
If you need ```BigInt``` support, it is partially supported since most browsers now supports it including Safari.Binding ```BigInt``` is still not supported, only getting ```BigInt``` from the database is supported for now.
|
|
264
|
+
|
|
265
|
+
```html
|
|
266
|
+
<script>
|
|
267
|
+
const stmt = db.prepare("SELECT * FROM test");
|
|
268
|
+
const config = {useBigInt: true};
|
|
269
|
+
/*Pass optional config param to the get function*/
|
|
270
|
+
while (stmt.step()) console.log(stmt.get(null, config));
|
|
271
|
+
|
|
272
|
+
/*OR*/
|
|
273
|
+
const results = db.exec("SELECT * FROM test", config);
|
|
274
|
+
console.log(results[0].values)
|
|
275
|
+
</script>
|
|
276
|
+
```
|
|
277
|
+
On WebWorker, you can just add ```config``` param before posting a message. With this, you wont have to pass config param on ```get``` function.
|
|
278
|
+
|
|
279
|
+
```html
|
|
280
|
+
<script>
|
|
281
|
+
worker.postMessage({
|
|
282
|
+
id:1,
|
|
283
|
+
action:"exec",
|
|
284
|
+
sql: "SELECT * FROM test",
|
|
285
|
+
config: {useBigInt: true}, /*Optional param*/
|
|
286
|
+
});
|
|
287
|
+
</script>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
See [examples/GUI/gui.js](examples/GUI/gui.js) for a full working example.
|
|
291
|
+
|
|
292
|
+
## Flavors/versions Targets/Downloads
|
|
293
|
+
|
|
294
|
+
This library includes both WebAssembly and asm.js versions of Sqlite. (WebAssembly is the newer, preferred way to compile to JavaScript, and has superceded asm.js. It produces smaller, faster code.) Asm.js versions are included for compatibility.
|
|
295
|
+
|
|
296
|
+
## Upgrading from 0.x to 1.x
|
|
297
|
+
|
|
298
|
+
Version 1.0 of sql.js must be loaded asynchronously, whereas asm.js was able to be loaded synchronously.
|
|
299
|
+
|
|
300
|
+
So in the past, you would:
|
|
301
|
+
```html
|
|
302
|
+
<script src='js/sql.js'></script>
|
|
303
|
+
<script>
|
|
304
|
+
const db = new SQL.Database();
|
|
305
|
+
//...
|
|
306
|
+
</script>
|
|
307
|
+
```
|
|
308
|
+
or:
|
|
309
|
+
```javascript
|
|
310
|
+
const SQL = require('sql.js');
|
|
311
|
+
const db = new SQL.Database();
|
|
312
|
+
//...
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Version 1.x:
|
|
316
|
+
```html
|
|
317
|
+
<script src='dist/sql-wasm.js'></script>
|
|
318
|
+
<script>
|
|
319
|
+
initSqlJs({ locateFile: filename => `/dist/${filename}` }).then(function(SQL){
|
|
320
|
+
const db = new SQL.Database();
|
|
321
|
+
//...
|
|
322
|
+
});
|
|
323
|
+
</script>
|
|
324
|
+
```
|
|
325
|
+
or:
|
|
326
|
+
```javascript
|
|
327
|
+
const initSqlJs = require('sql-wasm.js');
|
|
328
|
+
initSqlJs().then(function(SQL){
|
|
329
|
+
const db = new SQL.Database();
|
|
330
|
+
//...
|
|
331
|
+
});
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
`NOTHING` is now a reserved word in SQLite, whereas previously it was not. This could cause errors like `Error: near "nothing": syntax error`
|
|
335
|
+
|
|
336
|
+
### Downloading/Using: ###
|
|
337
|
+
Although asm.js files were distributed as a single Javascript file, WebAssembly libraries are most efficiently distributed as a pair of files, the `.js` loader and the `.wasm` file, like `sql-wasm.js` and `sql-wasm.wasm`. The `.js` file is responsible for loading the `.wasm` file. You can find these files on our [release page](https://github.com/sql-js/sql.js/releases)
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
## Versions of sql.js included in the distributed artifacts
|
|
343
|
+
You can always find the latest published artifacts on https://github.com/sql-js/sql.js/releases/latest.
|
|
344
|
+
|
|
345
|
+
For each [release](https://github.com/sql-js/sql.js/releases/), you will find a file called `sqljs.zip` in the *release assets*. It will contain:
|
|
346
|
+
- `sql-wasm.js` : The Web Assembly version of Sql.js. Minified and suitable for production. Use this. If you use this, you will need to include/ship `sql-wasm.wasm` as well.
|
|
347
|
+
- `sql-wasm-debug.js` : The Web Assembly, Debug version of Sql.js. Larger, with assertions turned on. Useful for local development. You will need to include/ship `sql-wasm-debug.wasm` if you use this.
|
|
348
|
+
- `sql-asm.js` : The older asm.js version of Sql.js. Slower and larger. Provided for compatibility reasons.
|
|
349
|
+
- `sql-asm-memory-growth.js` : Asm.js doesn't allow for memory to grow by default, because it is slower and de-optimizes. If you are using sql-asm.js and you see this error (`Cannot enlarge memory arrays`), use this file.
|
|
350
|
+
- `sql-asm-debug.js` : The _Debug_ asm.js version of Sql.js. Use this for local development.
|
|
351
|
+
- `worker.*` - Web Worker versions of the above libraries. More limited API. See [examples/GUI/gui.js](examples/GUI/gui.js) for a good example of this.
|
|
352
|
+
|
|
353
|
+
## Compiling/Contributing
|
|
354
|
+
|
|
355
|
+
General consumers of this library don't need to read any further. (The compiled files are available via the [release page](https://github.com/sql-js/sql.js/releases).)
|
|
356
|
+
|
|
357
|
+
If you want to compile your own version of SQLite for WebAssembly, or want to contribute to this project, see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
// Type definitions for sql.js 1.4
|
|
2
|
+
// Project: https://github.com/sql-js/sql.js
|
|
3
|
+
// Definitions by: Florian Imdahl <https://github.com/ffflorian>
|
|
4
|
+
// Yehyoung Kang <https://github.com/pastelmind>
|
|
5
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
6
|
+
// TypeScript Version: 2.3
|
|
7
|
+
|
|
8
|
+
/// <reference types="node" />
|
|
9
|
+
/// <reference types="emscripten" />
|
|
10
|
+
|
|
11
|
+
type SqlValue = number | string | Uint8Array | null;
|
|
12
|
+
type ParamsObject = Record<string, SqlValue>;
|
|
13
|
+
type ParamsCallback = (obj: ParamsObject) => void;
|
|
14
|
+
type SqlJsConfig = Partial<EmscriptenModule>;
|
|
15
|
+
type BindParams = SqlValue[] | ParamsObject | null;
|
|
16
|
+
|
|
17
|
+
interface QueryExecResult {
|
|
18
|
+
columns: string[];
|
|
19
|
+
values: SqlValue[][];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface StatementIteratorResult {
|
|
23
|
+
/** `true` if there are no more available statements */
|
|
24
|
+
done: boolean;
|
|
25
|
+
/** the next available Statement (as returned by `Database.prepare`) */
|
|
26
|
+
value: Statement;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface SqlJsStatic {
|
|
30
|
+
Database: typeof Database;
|
|
31
|
+
Statement: typeof Statement;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface InitSqlJsStatic {
|
|
35
|
+
(config?: SqlJsConfig): Promise<SqlJsStatic>;
|
|
36
|
+
readonly default: this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare class Database {
|
|
40
|
+
/**
|
|
41
|
+
* Represents an SQLite database
|
|
42
|
+
* @see [https://sql.js.org/documentation/Database.html#Database](https://sql.js.org/documentation/Database.html#Database)
|
|
43
|
+
*
|
|
44
|
+
* @param data An array of bytes representing an SQLite database file
|
|
45
|
+
*/
|
|
46
|
+
constructor(filepath?: string, data?: ArrayLike<number> | Buffer | null);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Close the database, and all associated prepared statements. The
|
|
50
|
+
* memory associated to the database and all associated statements will
|
|
51
|
+
* be freed.
|
|
52
|
+
*
|
|
53
|
+
* **Warning**: A statement belonging to a database that has been closed
|
|
54
|
+
* cannot be used anymore.
|
|
55
|
+
*
|
|
56
|
+
* Databases must be closed when you're finished with them, or the
|
|
57
|
+
* memory consumption will grow forever
|
|
58
|
+
* @see [https://sql.js.org/documentation/Database.html#["close"]](https://sql.js.org/documentation/Database.html#%5B%22close%22%5D)
|
|
59
|
+
*/
|
|
60
|
+
close(): void;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Register a custom function with SQLite
|
|
64
|
+
* @see [https://sql.js.org/documentation/Database.html#["create_function"]](https://sql.js.org/documentation/Database.html#%5B%22create_function%22%5D)
|
|
65
|
+
*
|
|
66
|
+
* @param name the name of the function as referenced in SQL statements.
|
|
67
|
+
* @param func the actual function to be executed.
|
|
68
|
+
*/
|
|
69
|
+
create_function(name: string, func: (...args: any[]) => any): Database;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Execute an sql statement, and call a callback for each row of result.
|
|
73
|
+
*
|
|
74
|
+
* Currently this method is synchronous, it will not return until the
|
|
75
|
+
* callback has been called on every row of the result. But this might
|
|
76
|
+
* change.
|
|
77
|
+
* @see [https://sql.js.org/documentation/Database.html#["each"]](https://sql.js.org/documentation/Database.html#%5B%22each%22%5D)
|
|
78
|
+
*
|
|
79
|
+
* @param sql A string of SQL text. Can contain placeholders that will
|
|
80
|
+
* be bound to the parameters given as the second argument
|
|
81
|
+
* @param params Parameters to bind to the query
|
|
82
|
+
* @param callback Function to call on each row of result
|
|
83
|
+
* @param done A function that will be called when all rows have been
|
|
84
|
+
* retrieved
|
|
85
|
+
*/
|
|
86
|
+
each(sql: string, params: BindParams, callback: ParamsCallback, done: () => void): Database;
|
|
87
|
+
each(sql: string, callback: ParamsCallback, done: () => void): Database;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Execute an SQL query, and returns the result.
|
|
91
|
+
*
|
|
92
|
+
* This is a wrapper against `Database.prepare`, `Statement.bind`, `Statement.step`, `Statement.get`, and `Statement.free`.
|
|
93
|
+
*
|
|
94
|
+
* The result is an array of result elements. There are as many result elements as the number of statements in your sql string (statements are separated by a semicolon)
|
|
95
|
+
* @see [https://sql.js.org/documentation/Database.html#["exec"]](https://sql.js.org/documentation/Database.html#%5B%22exec%22%5D)
|
|
96
|
+
*
|
|
97
|
+
* @param sql a string containing some SQL text to execute
|
|
98
|
+
* @param params When the SQL statement contains placeholders, you can
|
|
99
|
+
* pass them in here. They will be bound to the statement before it is
|
|
100
|
+
* executed. If you use the params argument as an array, you **cannot**
|
|
101
|
+
* provide an sql string that contains several statements (separated by
|
|
102
|
+
* `;`). This limitation does not apply to params as an object.
|
|
103
|
+
*/
|
|
104
|
+
exec(sql: string, params?: BindParams): QueryExecResult[];
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Exports the contents of the database to a binary array
|
|
108
|
+
* @see [https://sql.js.org/documentation/Database.html#["export"]](https://sql.js.org/documentation/Database.html#%5B%22export%22%5D)
|
|
109
|
+
*/
|
|
110
|
+
export(): Uint8Array;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Returns the number of changed rows (modified, inserted or deleted) by
|
|
114
|
+
* the latest completed `INSERT`, `UPDATE` or `DELETE` statement on the
|
|
115
|
+
* database. Executing any other type of SQL statement does not modify
|
|
116
|
+
* the value returned by this function.
|
|
117
|
+
* @see [https://sql.js.org/documentation/Database.html#["getRowsModified"]](https://sql.js.org/documentation/Database.html#%5B%22getRowsModified%22%5D)
|
|
118
|
+
*/
|
|
119
|
+
getRowsModified(): number;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Analyze a result code, return null if no error occured, and throw an
|
|
123
|
+
* error with a descriptive message otherwise
|
|
124
|
+
* @see [https://sql.js.org/documentation/Database.html#["handleError"]](https://sql.js.org/documentation/Database.html#%5B%22handleError%22%5D)
|
|
125
|
+
*/
|
|
126
|
+
handleError(): null | never;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Iterate over multiple SQL statements in a SQL string. This function
|
|
130
|
+
* returns an iterator over Statement objects. You can use a `for..of`
|
|
131
|
+
* loop to execute the returned statements one by one.
|
|
132
|
+
* @see [https://sql.js.org/documentation/Database.html#["iterateStatements"]](https://sql.js.org/documentation/Database.html#%5B%22iterateStatements%22%5D)
|
|
133
|
+
*
|
|
134
|
+
* @param sql a string of SQL that can contain multiple statements
|
|
135
|
+
*/
|
|
136
|
+
iterateStatements(sql: string): StatementIterator;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Prepare an SQL statement
|
|
140
|
+
* @see [https://sql.js.org/documentation/Database.html#["prepare"]](https://sql.js.org/documentation/Database.html#%5B%22prepare%22%5D)
|
|
141
|
+
*
|
|
142
|
+
* @param sql a string of SQL, that can contain placeholders (`?`, `:VVV`, `:AAA`, `@AAA`)
|
|
143
|
+
* @param params values to bind to placeholders
|
|
144
|
+
*/
|
|
145
|
+
prepare(sql: string, params?: BindParams): Statement;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Execute an SQL query, ignoring the rows it returns.
|
|
149
|
+
* @see [https://sql.js.org/documentation/Database.html#["run"]](https://sql.js.org/documentation/Database.html#%5B%22run%22%5D)
|
|
150
|
+
*
|
|
151
|
+
* @param sql a string containing some SQL text to execute
|
|
152
|
+
* @param params When the SQL statement contains placeholders, you can
|
|
153
|
+
* pass them in here. They will be bound to the statement before it is
|
|
154
|
+
* executed. If you use the params argument as an array, you **cannot**
|
|
155
|
+
* provide an sql string that contains several statements (separated by
|
|
156
|
+
* `;`). This limitation does not apply to params as an object.
|
|
157
|
+
*/
|
|
158
|
+
run(sql: string, params?: BindParams): Database;
|
|
159
|
+
|
|
160
|
+
flush(): void;
|
|
161
|
+
size(): number;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
declare class Statement {
|
|
165
|
+
/**
|
|
166
|
+
* Bind values to the parameters, after having reseted the statement. If
|
|
167
|
+
* values is null, do nothing and return true.
|
|
168
|
+
*
|
|
169
|
+
* SQL statements can have parameters, named '?', '?NNN', ':VVV',
|
|
170
|
+
* '@VVV', '$VVV', where NNN is a number and VVV a string. This function
|
|
171
|
+
* binds these parameters to the given values.
|
|
172
|
+
*
|
|
173
|
+
* Warning: ':', '@', and '$' are included in the parameters names
|
|
174
|
+
*
|
|
175
|
+
* ### Value types
|
|
176
|
+
*
|
|
177
|
+
* |Javascript type|SQLite type|
|
|
178
|
+
* |-|-|
|
|
179
|
+
* |number|REAL, INTEGER|
|
|
180
|
+
* |boolean|INTEGER|
|
|
181
|
+
* |string|TEXT|
|
|
182
|
+
* |Array, Uint8Array|BLOB|
|
|
183
|
+
* |null|NULL|
|
|
184
|
+
* @see [https://sql.js.org/documentation/Statement.html#["bind"]](https://sql.js.org/documentation/Statement.html#%5B%22bind%22%5D)
|
|
185
|
+
*
|
|
186
|
+
* @param values The values to bind
|
|
187
|
+
*/
|
|
188
|
+
bind(values?: BindParams): boolean;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Free the memory used by the statement
|
|
192
|
+
* @see [https://sql.js.org/documentation/Statement.html#["free"]](https://sql.js.org/documentation/Statement.html#%5B%22free%22%5D)
|
|
193
|
+
*/
|
|
194
|
+
free(): boolean;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Free the memory allocated during parameter binding
|
|
198
|
+
* @see [https://sql.js.org/documentation/Statement.html#["freemem"]](https://sql.js.org/documentation/Statement.html#%5B%22freemem%22%5D)
|
|
199
|
+
*/
|
|
200
|
+
freemem(): void;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Get one row of results of a statement. If the first parameter is not
|
|
204
|
+
* provided, step must have been called before.
|
|
205
|
+
* @see [https://sql.js.org/documentation/Statement.html#["get"]](https://sql.js.org/documentation/Statement.html#%5B%22get%22%5D)
|
|
206
|
+
*
|
|
207
|
+
* @param params If set, the values will be bound to the statement
|
|
208
|
+
* before it is executed
|
|
209
|
+
*/
|
|
210
|
+
get(params?: BindParams): SqlValue[];
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Get one row of result as a javascript object, associating column
|
|
214
|
+
* names with their value in the current row
|
|
215
|
+
* @see [https://sql.js.org/documentation/Statement.html#["getAsObject"]](https://sql.js.org/documentation/Statement.html#%5B%22getAsObject%22%5D)
|
|
216
|
+
*
|
|
217
|
+
* @param params If set, the values will be bound to the statement, and
|
|
218
|
+
* it will be executed
|
|
219
|
+
*/
|
|
220
|
+
getAsObject(params?: BindParams): ParamsObject;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Get the list of column names of a row of result of a statement.
|
|
224
|
+
* @see [https://sql.js.org/documentation/Statement.html#["getColumnNames"]](https://sql.js.org/documentation/Statement.html#%5B%22getColumnNames%22%5D)
|
|
225
|
+
*/
|
|
226
|
+
getColumnNames(): string[];
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Get the SQLite's normalized version of the SQL string used in
|
|
230
|
+
* preparing this statement. The meaning of "normalized" is not
|
|
231
|
+
* well-defined: see
|
|
232
|
+
* [the SQLite documentation](https://sqlite.org/c3ref/expanded_sql.html).
|
|
233
|
+
* @see [https://sql.js.org/documentation/Statement.html#["getNormalizedSQL"]](https://sql.js.org/documentation/Statement.html#%5B%22getNormalizedSQL%22%5D)
|
|
234
|
+
*/
|
|
235
|
+
getNormalizedSQL(): string;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Get the SQL string used in preparing this statement.
|
|
239
|
+
* @see [https://sql.js.org/documentation/Statement.html#["getSQL"]](https://sql.js.org/documentation/Statement.html#%5B%22getSQL%22%5D)
|
|
240
|
+
*/
|
|
241
|
+
getSQL(): string;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Reset a statement, so that it's parameters can be bound to new
|
|
245
|
+
* values. It also clears all previous bindings, freeing the memory used
|
|
246
|
+
* by bound parameters.
|
|
247
|
+
* @see [https://sql.js.org/documentation/Statement.html#["reset"]](https://sql.js.org/documentation/Statement.html#%5B%22reset%22%5D)
|
|
248
|
+
*/
|
|
249
|
+
reset(): void;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Shorthand for bind + step + reset Bind the values, execute the
|
|
253
|
+
* statement, ignoring the rows it returns, and resets it
|
|
254
|
+
* @param values Value to bind to the statement
|
|
255
|
+
*/
|
|
256
|
+
run(values?: BindParams): void;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Execute the statement, fetching the the next line of result, that can
|
|
260
|
+
* be retrieved with `Statement.get`.
|
|
261
|
+
* @see [https://sql.js.org/documentation/Statement.html#["step"]](https://sql.js.org/documentation/Statement.html#%5B%22step%22%5D)
|
|
262
|
+
*/
|
|
263
|
+
step(): boolean;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* An iterator over multiple SQL statements in a string, preparing and
|
|
268
|
+
* returning a Statement object for the next SQL statement on each
|
|
269
|
+
* iteration.
|
|
270
|
+
*
|
|
271
|
+
* You can't instantiate this class directly, you have to use a Database
|
|
272
|
+
* object in order to create a statement iterator
|
|
273
|
+
* @see [https://sql.js.org/documentation/StatementIterator.html#StatementIterator](https://sql.js.org/documentation/StatementIterator.html#StatementIterator)
|
|
274
|
+
*/
|
|
275
|
+
declare class StatementIterator implements Iterator<Statement>, Iterable<Statement> {
|
|
276
|
+
[Symbol.iterator](): Iterator<Statement>;
|
|
277
|
+
/**
|
|
278
|
+
* Get any un-executed portions remaining of the original SQL string
|
|
279
|
+
* @see [https://sql.js.org/documentation/StatementIterator.html#["getRemainingSQL"]](https://sql.js.org/documentation/StatementIterator.html#%5B%22getRemainingSQL%22%5D)
|
|
280
|
+
*/
|
|
281
|
+
getRemainingSql(): string;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Prepare the next available SQL statement
|
|
285
|
+
* @see [https://sql.js.org/documentation/StatementIterator.html#["next"]](https://sql.js.org/documentation/StatementIterator.html#%5B%22next%22%5D)
|
|
286
|
+
*/
|
|
287
|
+
next(): StatementIteratorResult;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
declare namespace initSqlJs {
|
|
291
|
+
export {
|
|
292
|
+
// types
|
|
293
|
+
SqlValue,
|
|
294
|
+
ParamsObject,
|
|
295
|
+
ParamsCallback,
|
|
296
|
+
SqlJsConfig,
|
|
297
|
+
BindParams,
|
|
298
|
+
|
|
299
|
+
// interfaces
|
|
300
|
+
QueryExecResult,
|
|
301
|
+
StatementIteratorResult,
|
|
302
|
+
SqlJsStatic,
|
|
303
|
+
InitSqlJsStatic,
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// classes
|
|
307
|
+
type _Database = Database;
|
|
308
|
+
type _Statement = Statement;
|
|
309
|
+
type _StatementIterator = StatementIterator;
|
|
310
|
+
export { _Database as Database, _Statement as Statement, _StatementIterator as StatementIterator };
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
declare var initSqlJs: InitSqlJsStatic;
|
|
314
|
+
|
|
315
|
+
export = initSqlJs;
|
|
316
|
+
export as namespace initSqlJs;
|