sqlmath 2026.3.1 → 2026.4.30
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/.npmignore +4 -2
- package/CHANGELOG.md +20 -1
- package/README.md +557 -35
- package/_sqlmath.napi6_darwin_arm64.node +0 -0
- package/_sqlmath.napi6_darwin_x64.node +0 -0
- package/_sqlmath.napi6_linux_x64.node +0 -0
- package/_sqlmath.napi6_win32_x64.node +0 -0
- package/_sqlmath.shell_darwin_arm64 +0 -0
- package/_sqlmath.shell_darwin_x64 +0 -0
- package/_sqlmath.shell_linux_x64 +0 -0
- package/_sqlmath.shell_win32_x64.exe +0 -0
- package/jslint.mjs +1 -1
- package/lib_lightgbm_darwin_arm64.dylib +0 -0
- package/lib_lightgbm_darwin_x64.dylib +0 -0
- package/{_sqlmath.cpython-312-x86_64-linux-gnu.so → lib_lightgbm_linux_x64.so} +0 -0
- package/lib_lightgbm_win32_x64.dll +0 -0
- package/package.json +2 -2
- package/sqlmath.mjs +24 -16
- package/sqlmath_browser.mjs +6 -6
- package/sqlmath_wasm.js +83 -0
- package/sqlmath_wasm.wasm +0 -0
- package/_sqlmath.cp310-win_amd64.pyd +0 -0
- package/_sqlmath.cp311-win_amd64.pyd +0 -0
- package/_sqlmath.cp312-win_amd64.pyd +0 -0
- package/_sqlmath.cp313-win_amd64.pyd +0 -0
- package/_sqlmath.cp314-win_amd64.pyd +0 -0
- package/_sqlmath.cpython-310-darwin.so +0 -0
- package/_sqlmath.cpython-311-darwin.so +0 -0
- package/_sqlmath.cpython-312-darwin.so +0 -0
- package/_sqlmath.cpython-313-darwin.so +0 -0
- package/_sqlmath.cpython-314-darwin.so +0 -0
- package/_sqlmath.cpython-314t-darwin.so +0 -0
- package/_sqlmath.shell_win32_x64.exp +0 -0
- package/_sqlmath.shell_win32_x64.lib +0 -0
- package/sqlmath_custom.mjs +0 -4
package/.npmignore
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
# Todo
|
|
4
|
-
- sqlmath -
|
|
4
|
+
- sqlmath - Streamline and optimize sql-function WIN_SINEFIT2().
|
|
5
5
|
- sqlite - Add similar error-handling from builtin-sql-function PERCENTILE() into custom-sql-function QUANTILE().
|
|
6
6
|
- none
|
|
7
7
|
|
|
8
|
+
# v2026.4.30
|
|
9
|
+
- sqlmath-python - Add context manager and Pythonic API (execute, close) to SqlmathDb matching sqlite3 conventions.
|
|
10
|
+
- sqlmath-python - Add __repr__ and __bool__ methods to SqlmathDb for better debugging experience.
|
|
11
|
+
- sqlmath - Remove under-used custom-files sqlmath_custom.c, sqlmath_custom.mjs.
|
|
12
|
+
- github-ci - Pin various github-runner-os to stable/lts version.
|
|
13
|
+
- sqlmath-demo - Change historical charts from 5-years to 3-years.
|
|
14
|
+
- sqlmath-npm - bugfix - Fix missing lib_lightgbm pre-built libraries in npm-package.
|
|
15
|
+
- sqlmath-doc - Rewrite README with examples, API reference, use cases.
|
|
16
|
+
|
|
17
|
+
# v2026.3.31
|
|
18
|
+
- python-ci - bugfix - Fix shell-function shCiBaseCustom() always skipping python setup.py build_ext.
|
|
19
|
+
- ci - Speed-up windows-ci by replacing windows-latest with windows-2022.
|
|
20
|
+
- sqlmath-ci - Speed-up ci with env-var npm_config_mode_test_nopython, allowing shell-function shCiTestNodejs() to be run in background, parallel to python -m cibuildwheel.
|
|
21
|
+
- sqlmath-ci - Rename pre-built-binaries lib_lightgbm.xxx, libomp.xxx to lib_lightgbm_platform_arch.xxx, libomp_platform_arch.xxx, to prevent name-collision under darwin_arm64 and darwin_x64 builds.
|
|
22
|
+
- sqlmath-ci - Update file setup.py to open text-files with utf-8 encoding.
|
|
23
|
+
- sqlmath-ci - Update file .github/workflows/ci.yml with extra matrix.os macos-15-intel.
|
|
24
|
+
- jslint-ci - Update shell-function shGitPullrequestCleanup() to allow squash-and-merge pull-request.
|
|
25
|
+
- sqlmath-ci - Update file .github/workflows/ci.yml with hook to run on pull-request.
|
|
26
|
+
|
|
8
27
|
# v2026.3.1
|
|
9
28
|
- sqlmath-python - bugfix - Fix 762-character-limit SQL-string-bug in python-function db_exec().
|
|
10
29
|
- jslint-ci - Update shell-function shLintPython().
|
package/README.md
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
# sqlmath
|
|
1
|
+
# sqlmath
|
|
2
2
|
|
|
3
|
+
**SQLite with data-science superpowers.** Run statistics, machine learning, and analytics directly in SQL queries — from Python, JavaScript, or the browser.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/sqlmath/)
|
|
6
|
+
[](https://www.npmjs.com/package/sqlmath)<!--no-validate-->
|
|
7
|
+
[](https://sqlmath.github.io/sqlmath/index.html)
|
|
8
|
+
[](https://sqlmath.github.io/sqlmath/apidoc.html)
|
|
3
9
|
|
|
4
10
|
# Status
|
|
5
|
-
|
|
11
|
+
|
|
12
|
+
| Branch | [master<br>(v2026.4.30)](https://github.com/sqlmath/sqlmath/tree/master) | [beta<br>(Web Demo)](https://github.com/sqlmath/sqlmath/tree/beta) | [alpha<br>(Development)](https://github.com/sqlmath/sqlmath/tree/alpha) |
|
|
6
13
|
|--:|:--:|:--:|:--:|
|
|
7
14
|
| CI | [](https://github.com/sqlmath/sqlmath/actions?query=branch%3Amaster) | [](https://github.com/sqlmath/sqlmath/actions?query=branch%3Abeta) | [](https://github.com/sqlmath/sqlmath/actions?query=branch%3Aalpha) |
|
|
8
15
|
| Coverage | [](https://sqlmath.github.io/sqlmath/branch-master/.artifact/coverage/index.html) | [](https://sqlmath.github.io/sqlmath/branch-beta/.artifact/coverage/index.html) | [](https://sqlmath.github.io/sqlmath/branch-alpha/.artifact/coverage/index.html) |
|
|
@@ -15,22 +22,57 @@
|
|
|
15
22
|
|
|
16
23
|
1. [Web Demo](#web-demo)
|
|
17
24
|
|
|
18
|
-
2. [
|
|
19
|
-
|
|
25
|
+
2. [Why sqlmath?](#why-sqlmath)
|
|
26
|
+
|
|
27
|
+
3. [Quickstart](#quickstart)
|
|
28
|
+
- [Python](#python)
|
|
29
|
+
- [JavaScript (Node.js)](#javascript-nodejs)
|
|
30
|
+
- [Browser (WebAssembly)](#browser-webassembly)
|
|
31
|
+
|
|
32
|
+
4. [Built-in SQL Functions](#built-in-sql-functions)
|
|
33
|
+
- [Math](#math)
|
|
34
|
+
- [Statistics (Aggregate)](#statistics-aggregate)
|
|
35
|
+
- [Statistics (Scalar)](#statistics-scalar)
|
|
36
|
+
- [Arrays](#arrays)
|
|
37
|
+
- [Date/Time](#datetime)
|
|
38
|
+
- [Time Series / Signal Processing](#time-series--signal-processing)
|
|
39
|
+
- [Compression](#compression)
|
|
40
|
+
- [Type Casting](#type-casting)
|
|
41
|
+
- [Cryptography](#cryptography)
|
|
42
|
+
|
|
43
|
+
5. [Machine Learning with LightGBM](#machine-learning-with-lightgbm)
|
|
44
|
+
- [Training from a Table](#training-from-a-table)
|
|
45
|
+
- [Prediction](#prediction)
|
|
46
|
+
- [Real-World Example: Credit Card Fraud Detection](#real-world-example-credit-card-fraud-detection)
|
|
47
|
+
- [LightGBM Functions](#lightgbm-functions)
|
|
48
|
+
|
|
49
|
+
6. [Use Cases](#use-cases)
|
|
50
|
+
- [Financial Data Analysis](#financial-data-analysis)
|
|
51
|
+
- [Embedded ML Pipelines](#embedded-ml-pipelines)
|
|
52
|
+
- [Data Compression & Hashing](#data-compression--hashing)
|
|
20
53
|
|
|
21
|
-
|
|
22
|
-
- [To serve your own sqlmath website:](#to-serve-your-own-sqlmath-website)
|
|
54
|
+
7. [Why sqlmath vs Alternatives?](#why-sqlmath-vs-alternatives)
|
|
23
55
|
|
|
24
|
-
|
|
25
|
-
- [
|
|
56
|
+
8. [Python API Reference](#python-api-reference)
|
|
57
|
+
- [db_exec()](#db_exec)
|
|
26
58
|
|
|
27
|
-
|
|
59
|
+
9. [Node.js API Reference](#nodejs-api-reference)
|
|
28
60
|
|
|
29
|
-
|
|
61
|
+
10. [Platform Notes](#platform-notes)
|
|
30
62
|
|
|
31
|
-
|
|
63
|
+
11. [Building from Source](#building-from-source)
|
|
64
|
+
- [Prerequisites](#prerequisites)
|
|
65
|
+
- [Build](#build)
|
|
66
|
+
- [Run Tests](#run-tests)
|
|
67
|
+
- [Serve Demo Locally](#serve-demo-locally)
|
|
32
68
|
|
|
33
|
-
|
|
69
|
+
12. [Package Listing](#package-listing)
|
|
70
|
+
|
|
71
|
+
13. [Changelog](#changelog)
|
|
72
|
+
|
|
73
|
+
14. [License](#license)
|
|
74
|
+
|
|
75
|
+
15. [Devops Instruction](#devops-instruction)
|
|
34
76
|
- [python pypi publish](#python-pypi-publish)
|
|
35
77
|
- [sqlite upgrade](#sqlite-upgrade)
|
|
36
78
|
|
|
@@ -43,53 +85,533 @@
|
|
|
43
85
|
|
|
44
86
|
|
|
45
87
|
<br><br>
|
|
46
|
-
#
|
|
88
|
+
# Why sqlmath?
|
|
89
|
+
|
|
90
|
+
SQLite is everywhere — it's the most deployed database in the world. But it lacks the statistical and ML functions needed for data-science. sqlmath fixes that.
|
|
91
|
+
|
|
92
|
+
**What you get:**
|
|
93
|
+
- **20+ built-in functions** for math, statistics, arrays, dates, and compression
|
|
94
|
+
- **LightGBM integration** — train and predict ML models directly in SQL
|
|
95
|
+
- **Zero dependencies** — single binary, no external libraries needed
|
|
96
|
+
- **Multi-platform** — Python, Node.js, browser (WebAssembly)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
<br><br>
|
|
100
|
+
# Quickstart
|
|
47
101
|
|
|
48
102
|
|
|
49
103
|
<br><br>
|
|
50
|
-
###
|
|
104
|
+
### Python
|
|
105
|
+
|
|
51
106
|
```shell
|
|
52
|
-
|
|
107
|
+
pip install sqlmath
|
|
108
|
+
```
|
|
53
109
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
110
|
+
```python
|
|
111
|
+
from sqlmath import db_open, db_exec, db_close
|
|
112
|
+
|
|
113
|
+
# Open an in-memory database
|
|
114
|
+
db = db_open(":memory:")
|
|
115
|
+
|
|
116
|
+
# Create sample data
|
|
117
|
+
db_exec(db=db, sql="""
|
|
118
|
+
CREATE TABLE prices (symbol TEXT, price REAL);
|
|
119
|
+
INSERT INTO prices VALUES ('AAPL', 150.0), ('GOOGL', 140.0), ('MSFT', 380.0);
|
|
120
|
+
""")
|
|
121
|
+
|
|
122
|
+
# Use built-in statistical functions
|
|
123
|
+
result = db_exec(db=db, sql="""
|
|
124
|
+
SELECT
|
|
125
|
+
AVG(price) AS mean_price,
|
|
126
|
+
MEDIAN2(price) AS median_price,
|
|
127
|
+
STDEV(price) AS stdev_price
|
|
128
|
+
FROM prices
|
|
129
|
+
""")
|
|
130
|
+
print(result)
|
|
131
|
+
# [[{'mean_price': 223.33, 'median_price': 150.0, 'stdev_price': 135.77}]]
|
|
132
|
+
|
|
133
|
+
db_close(db)
|
|
134
|
+
```
|
|
57
135
|
|
|
58
|
-
# build nodejs binary ./_binary_sqlmath_napi8_xxx_x64.node
|
|
59
|
-
npm run test2
|
|
60
136
|
|
|
61
|
-
|
|
62
|
-
|
|
137
|
+
<br><br>
|
|
138
|
+
### JavaScript (Node.js)
|
|
139
|
+
|
|
140
|
+
```shell
|
|
141
|
+
npm install sqlmath
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```javascript
|
|
145
|
+
import { dbOpenAsync, dbExecAsync, dbCloseAsync } from "sqlmath";
|
|
146
|
+
|
|
147
|
+
const db = await dbOpenAsync({ filename: ":memory:" });
|
|
148
|
+
|
|
149
|
+
await dbExecAsync({
|
|
150
|
+
db,
|
|
151
|
+
sql: `
|
|
152
|
+
CREATE TABLE prices (symbol TEXT, price REAL);
|
|
153
|
+
INSERT INTO prices VALUES ('AAPL', 150.0), ('GOOGL', 140.0), ('MSFT', 380.0);
|
|
154
|
+
`
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
const result = await dbExecAsync({
|
|
158
|
+
db,
|
|
159
|
+
sql: "SELECT AVG(price) AS mean_price FROM prices"
|
|
160
|
+
});
|
|
161
|
+
console.log(result);
|
|
162
|
+
|
|
163
|
+
await dbCloseAsync(db);
|
|
63
164
|
```
|
|
64
165
|
|
|
65
166
|
|
|
66
167
|
<br><br>
|
|
67
|
-
|
|
168
|
+
### Browser (WebAssembly)
|
|
169
|
+
|
|
170
|
+
Try it live: **[sqlmath.github.io/sqlmath](https://sqlmath.github.io/sqlmath/index.html)**
|
|
68
171
|
|
|
69
172
|
|
|
70
173
|
<br><br>
|
|
71
|
-
|
|
72
|
-
```shell
|
|
73
|
-
#!/bin/sh
|
|
174
|
+
# Built-in SQL Functions
|
|
74
175
|
|
|
75
|
-
# cd <sqlmath repo>
|
|
76
176
|
|
|
77
|
-
|
|
78
|
-
|
|
177
|
+
<br><br>
|
|
178
|
+
### Math
|
|
179
|
+
|
|
180
|
+
| Function | Description |
|
|
181
|
+
|----------|-------------|
|
|
182
|
+
| `cot(x)` | Cotangent |
|
|
183
|
+
| `coth(x)` | Hyperbolic cotangent |
|
|
184
|
+
| `fmod(x, y)` | Floating-point modulo |
|
|
185
|
+
| `squared(x)` | Square of x |
|
|
186
|
+
| `squaredwithsign(x)` | Square preserving sign (negative input → negative output) |
|
|
187
|
+
| `sqrtwithsign(x)` | Square root preserving sign |
|
|
188
|
+
| `normalizewithsqrt(x)` | Normalize using square root |
|
|
189
|
+
| `normalizewithsquared(x)` | Normalize using square |
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
<br><br>
|
|
193
|
+
### Statistics (Aggregate)
|
|
194
|
+
|
|
195
|
+
| Function | Description |
|
|
196
|
+
|----------|-------------|
|
|
197
|
+
| `MEDIAN2(x)` | Median value (aggregate) |
|
|
198
|
+
| `PERCENTILE(x, p)` | Percentile at p (aggregate) |
|
|
199
|
+
| `QUANTILE(x, q)` | Quantile at q (aggregate) |
|
|
200
|
+
| `STDEV(x)` | Standard deviation (sample, window-capable) |
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
<br><br>
|
|
204
|
+
### Statistics (Scalar)
|
|
205
|
+
|
|
206
|
+
| Function | Description |
|
|
207
|
+
|----------|-------------|
|
|
208
|
+
| `marginoferror95(p, n)` | 95% margin of error: sqrt(p*(1-p)/n) |
|
|
209
|
+
| `random1()` | Random float in [0, 1) |
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
<br><br>
|
|
213
|
+
### Arrays
|
|
214
|
+
|
|
215
|
+
| Function | Description |
|
|
216
|
+
|----------|-------------|
|
|
217
|
+
| `doublearray_array(...)` | Create double array from values |
|
|
218
|
+
| `doublearray_extract(arr, i)` | Extract element at index |
|
|
219
|
+
| `doublearray_jsonfrom(json)` | Create array from JSON |
|
|
220
|
+
| `doublearray_jsonto(arr)` | Convert array to JSON |
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
<br><br>
|
|
224
|
+
### Date/Time
|
|
225
|
+
|
|
226
|
+
sqlmath extends SQLite's date functions with integer-format conversions (YYYYMMDDHHMMSS).
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
<br><br>
|
|
230
|
+
### Time Series / Signal Processing
|
|
231
|
+
|
|
232
|
+
| Function | Description |
|
|
233
|
+
|----------|-------------|
|
|
234
|
+
| `WIN_SINEFIT2(...)` | Fit sine wave to data (aggregate window function) |
|
|
235
|
+
| `SINEFIT_REFITLAST(...)` | Refit sine wave with new data point |
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
<br><br>
|
|
239
|
+
### Compression
|
|
240
|
+
|
|
241
|
+
| Function | Description |
|
|
242
|
+
|----------|-------------|
|
|
243
|
+
| `GZIP_COMPRESS(blob)` | Compress BLOB with gzip |
|
|
244
|
+
| `GZIP_UNCOMPRESS(blob)` | Decompress gzip BLOB |
|
|
245
|
+
|
|
246
|
+
> **Note:** Input must be BLOB. Use `CAST(text AS BLOB)` for text data.
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
<br><br>
|
|
250
|
+
### Type Casting
|
|
251
|
+
|
|
252
|
+
| Function | Description |
|
|
253
|
+
|----------|-------------|
|
|
254
|
+
| `castrealornull(x)` | Cast to REAL or NULL |
|
|
255
|
+
| `castrealorzero(x)` | Cast to REAL or 0.0 |
|
|
256
|
+
| `casttextorempty(x)` | Cast to TEXT or '' |
|
|
257
|
+
| `roundorzero(x, n)` | Round or return 0 |
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
<br><br>
|
|
261
|
+
### Cryptography
|
|
262
|
+
|
|
263
|
+
| Function | Description |
|
|
264
|
+
|----------|-------------|
|
|
265
|
+
| `sha256(data)` | SHA-256 hash (returns BLOB) |
|
|
266
|
+
|
|
267
|
+
```sql
|
|
268
|
+
SELECT HEX(sha256('hello')) AS hash;
|
|
269
|
+
-- 2CF24DBA5FB0A30E26E83B2AC5B9E29E1B161E5C1FA7425E73043362938B9824
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
<br><br>
|
|
274
|
+
# Machine Learning with LightGBM
|
|
275
|
+
|
|
276
|
+
sqlmath embeds [LightGBM](https://lightgbm.readthedocs.io/) for gradient boosting directly in SQL queries. Train models on your data without leaving SQL — no data shuffle to Python needed.
|
|
277
|
+
|
|
278
|
+
> **Python users:** You must call `lgbm_dlopen()` before using any `lgbm_*` functions. See [Platform Notes](#platform-notes) for details.
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
<br><br>
|
|
282
|
+
### Training from a Table
|
|
283
|
+
|
|
284
|
+
`LGBM_TRAINFROMTABLE` is an **aggregate function** — it consumes rows like `SUM()` or `AVG()`, but outputs a trained model BLOB.
|
|
285
|
+
|
|
286
|
+
```sql
|
|
287
|
+
-- Create a table to store the model
|
|
288
|
+
CREATE TABLE model_store (model BLOB);
|
|
289
|
+
|
|
290
|
+
-- Train directly from your data table
|
|
291
|
+
INSERT INTO model_store(model)
|
|
292
|
+
SELECT
|
|
293
|
+
LGBM_TRAINFROMTABLE(
|
|
294
|
+
-- Training parameters
|
|
295
|
+
(
|
|
296
|
+
'objective=binary'
|
|
297
|
+
|| ' learning_rate=0.1'
|
|
298
|
+
|| ' metric=auc'
|
|
299
|
+
|| ' num_leaves=31'
|
|
300
|
+
|| ' verbosity=0'
|
|
301
|
+
),
|
|
302
|
+
50, -- num_iterations
|
|
303
|
+
10, -- eval_step (early stopping check interval)
|
|
304
|
+
'max_bin=15', -- data parameters
|
|
305
|
+
NULL, -- reference dataset (NULL for training set)
|
|
306
|
+
-- Columns: first column MUST be the label
|
|
307
|
+
label, feature1, feature2, feature3, feature4
|
|
308
|
+
)
|
|
309
|
+
FROM training_data;
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
<br><br>
|
|
314
|
+
### Prediction
|
|
315
|
+
|
|
316
|
+
```sql
|
|
317
|
+
-- Predict on new data using the stored model
|
|
318
|
+
SELECT
|
|
319
|
+
id,
|
|
320
|
+
LGBM_PREDICTFORTABLE(
|
|
321
|
+
(SELECT model FROM model_store),
|
|
322
|
+
0, -- predict_type (0 = normal probability)
|
|
323
|
+
0, -- start_iteration
|
|
324
|
+
50, -- num_iterations
|
|
325
|
+
'', -- prediction parameters
|
|
326
|
+
feature1, feature2, feature3, feature4
|
|
327
|
+
) AS prediction
|
|
328
|
+
FROM test_data;
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
<br><br>
|
|
333
|
+
### Real-World Example: Credit Card Fraud Detection
|
|
334
|
+
|
|
335
|
+
From the [Kaggle notebook](https://www.kaggle.com/code/kaizhu256/sql-is-all-you-need) — training on 284,807 transactions with 0.17% fraud rate:
|
|
336
|
+
|
|
337
|
+
```python
|
|
338
|
+
from sqlmath import db_open, db_exec, db_table_import
|
|
339
|
+
|
|
340
|
+
db = db_open("fraud.sqlite")
|
|
341
|
+
|
|
342
|
+
# Import Kaggle credit card dataset
|
|
343
|
+
db_table_import(db=db, filename="creditcard.csv", table_name="transactions", mode="csv")
|
|
344
|
+
|
|
345
|
+
# Split 80/20 train/test
|
|
346
|
+
db_exec(db=db, sql="""
|
|
347
|
+
CREATE TABLE train AS SELECT * FROM transactions WHERE RANDOM() % 5 != 0;
|
|
348
|
+
CREATE TABLE test AS SELECT * FROM transactions WHERE RANDOM() % 5 = 0;
|
|
349
|
+
""")
|
|
350
|
+
|
|
351
|
+
# Train with automatic class imbalance handling
|
|
352
|
+
db_exec(db=db, sql="""
|
|
353
|
+
CREATE TABLE model_store (model BLOB);
|
|
354
|
+
|
|
355
|
+
INSERT INTO model_store(model)
|
|
356
|
+
SELECT
|
|
357
|
+
LGBM_TRAINFROMTABLE(
|
|
358
|
+
(
|
|
359
|
+
'objective=binary'
|
|
360
|
+
|| ' learning_rate=0.05'
|
|
361
|
+
|| ' metric=auc'
|
|
362
|
+
|| ' is_unbalance=true' -- Auto-weight minority class
|
|
363
|
+
|| ' num_leaves=31'
|
|
364
|
+
|| ' verbosity=0'
|
|
365
|
+
),
|
|
366
|
+
100, -- num_iterations
|
|
367
|
+
10, -- eval_step
|
|
368
|
+
'max_bin=255', -- data_params
|
|
369
|
+
NULL, -- reference
|
|
370
|
+
-- First column = label, rest = features (V1-V28 + Amount)
|
|
371
|
+
Class, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10,
|
|
372
|
+
V11, V12, V13, V14, V15, V16, V17, V18, V19, V20,
|
|
373
|
+
V21, V22, V23, V24, V25, V26, V27, V28, Amount
|
|
374
|
+
)
|
|
375
|
+
FROM train;
|
|
376
|
+
""")
|
|
79
377
|
```
|
|
80
378
|
|
|
81
379
|
|
|
82
380
|
<br><br>
|
|
83
|
-
|
|
381
|
+
### LightGBM Functions
|
|
382
|
+
|
|
383
|
+
| Function | Type | Description |
|
|
384
|
+
|----------|------|-------------|
|
|
385
|
+
| `lgbm_dlopen(path)` | scalar | Load LightGBM library (required in Python) |
|
|
386
|
+
| `LGBM_TRAINFROMTABLE(params, n_iter, eval, data_params, ref, label, ...)` | aggregate | Train model from table columns |
|
|
387
|
+
| `LGBM_TRAINFROMFILE(params, n_iter, eval, train_file, data_params, test_file)` | scalar | Train from LibSVM file |
|
|
388
|
+
| `LGBM_PREDICTFORTABLE(model, type, start, n, params, ...)` | window | Predict per row |
|
|
389
|
+
| `LGBM_PREDICTFORFILE(model, type, start, n, params, file, header, out)` | scalar | Predict and save to file |
|
|
390
|
+
| `lgbm_extract(result, key)` | scalar | Extract value from result |
|
|
391
|
+
|
|
392
|
+
**Complete Example:**
|
|
393
|
+
|
|
394
|
+
[](https://www.kaggle.com/code/kaizhu256/sql-is-all-you-need)
|
|
395
|
+
|
|
396
|
+
Full notebook with fraud detection, intraday trading signals, and model persistence.
|
|
397
|
+
|
|
398
|
+
**Kaggle Environment:**
|
|
399
|
+
- Linux x64, Python 3.12, Node.js 24
|
|
400
|
+
- Datasets: [Credit Card Fraud](https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud) (284K transactions), SPY intraday OHLCV
|
|
401
|
+
- sqlmath installs via `pip install sqlmath==2026.4.30`
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
<br><br>
|
|
405
|
+
# Use Cases
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
<br><br>
|
|
409
|
+
### Financial Data Analysis
|
|
410
|
+
|
|
411
|
+
```python
|
|
412
|
+
from sqlmath import db_open, db_exec, db_close, db_table_import
|
|
413
|
+
|
|
414
|
+
db = db_open(":memory:")
|
|
415
|
+
|
|
416
|
+
# Import OHLCV data
|
|
417
|
+
db_table_import(db=db, table_name="prices", filename="prices.csv", mode="csv")
|
|
418
|
+
|
|
419
|
+
# Calculate rolling statistics in SQL
|
|
420
|
+
result = db_exec(db=db, sql="""
|
|
421
|
+
SELECT
|
|
422
|
+
date,
|
|
423
|
+
close,
|
|
424
|
+
AVG(close) OVER (ORDER BY date ROWS 20 PRECEDING) AS sma_20,
|
|
425
|
+
STDEV(close) OVER (ORDER BY date ROWS 20 PRECEDING) AS volatility,
|
|
426
|
+
PERCENTILE(volume, 50) OVER (ORDER BY date ROWS 5 PRECEDING) AS median_volume
|
|
427
|
+
FROM prices
|
|
428
|
+
ORDER BY date DESC
|
|
429
|
+
LIMIT 10
|
|
430
|
+
""")
|
|
431
|
+
|
|
432
|
+
db_close(db)
|
|
433
|
+
```
|
|
84
434
|
|
|
85
435
|
|
|
86
436
|
<br><br>
|
|
87
|
-
###
|
|
437
|
+
### Embedded ML Pipelines
|
|
438
|
+
|
|
439
|
+
Train and deploy models without data movement:
|
|
440
|
+
|
|
441
|
+
```python
|
|
442
|
+
# 1. Load data into SQLite
|
|
443
|
+
db_table_import(db=db, table_name="features", filename="training_data.csv", mode="csv")
|
|
444
|
+
|
|
445
|
+
# 2. Train model in-database
|
|
446
|
+
db_exec(db=db, sql="""
|
|
447
|
+
CREATE TABLE models AS
|
|
448
|
+
SELECT LGBM_TRAINFROMTABLE(...) AS model FROM features
|
|
449
|
+
""")
|
|
450
|
+
|
|
451
|
+
# 3. Score new data in-database
|
|
452
|
+
db_exec(db=db, sql="""
|
|
453
|
+
SELECT id, LGBM_PREDICTFORTABLE(model, ...) AS score
|
|
454
|
+
FROM new_data, models
|
|
455
|
+
""")
|
|
456
|
+
|
|
457
|
+
# 4. Export results
|
|
458
|
+
db_file_save(db=db, filename="scored_data.sqlite")
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
<br><br>
|
|
463
|
+
### Data Compression & Hashing
|
|
464
|
+
|
|
465
|
+
```sql
|
|
466
|
+
-- Compress large text fields
|
|
467
|
+
UPDATE documents SET
|
|
468
|
+
content_compressed = GZIP_COMPRESS(CAST(content AS BLOB));
|
|
469
|
+
|
|
470
|
+
-- Generate content hashes for deduplication
|
|
471
|
+
SELECT HEX(sha256(content)) AS content_hash, COUNT(*)
|
|
472
|
+
FROM documents
|
|
473
|
+
GROUP BY content_hash
|
|
474
|
+
HAVING COUNT(*) > 1;
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
<br><br>
|
|
479
|
+
# Why sqlmath vs Alternatives?
|
|
480
|
+
|
|
481
|
+
| Feature | sqlmath | pandas | DuckDB | sqlite3 |
|
|
482
|
+
|---------|---------|--------|--------|---------|
|
|
483
|
+
| In-database ML | ✅ LightGBM | ❌ | ❌ | ❌ |
|
|
484
|
+
| Zero data shuffle | ✅ | ❌ | ✅ | ✅ |
|
|
485
|
+
| Statistical functions | ✅ 20+ | ✅ | ✅ | ❌ |
|
|
486
|
+
| Browser support | ✅ WASM | ❌ | ❌ | ❌ |
|
|
487
|
+
| Single file deployment | ✅ | ❌ | ✅ | ✅ |
|
|
488
|
+
| Memory efficiency | ✅ Streaming | ❌ In-memory | ✅ | ✅ |
|
|
489
|
+
|
|
490
|
+
**Choose sqlmath when:**
|
|
491
|
+
- You need ML training/inference inside the database
|
|
492
|
+
- Your data is already in SQLite
|
|
493
|
+
- You want browser-based analytics (WebAssembly)
|
|
494
|
+
- You need statistical functions beyond basic SQL
|
|
495
|
+
|
|
496
|
+
**Choose pandas when:**
|
|
497
|
+
- You need complex data transformations
|
|
498
|
+
- Interactive exploration with rich visualization
|
|
499
|
+
- Your workflow is Python-centric
|
|
500
|
+
|
|
501
|
+
**Choose DuckDB when:**
|
|
502
|
+
- You need fast analytical queries on large datasets
|
|
503
|
+
- You want pandas DataFrame interop
|
|
504
|
+
- OLAP workloads are primary
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
<br><br>
|
|
508
|
+
# Python API Reference
|
|
509
|
+
|
|
510
|
+
```python
|
|
511
|
+
from sqlmath import (
|
|
512
|
+
db_open, # Open database
|
|
513
|
+
db_close, # Close database
|
|
514
|
+
db_exec, # Execute SQL, return results
|
|
515
|
+
db_exec_and_return_lastblob, # Execute SQL, return last blob
|
|
516
|
+
db_file_load, # Load database from file
|
|
517
|
+
db_file_save, # Save database to file
|
|
518
|
+
db_table_import, # Import data into table
|
|
519
|
+
db_noop, # No-op for testing
|
|
520
|
+
)
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
<br><br>
|
|
525
|
+
### db_exec()
|
|
526
|
+
|
|
527
|
+
```python
|
|
528
|
+
result = db_exec(
|
|
529
|
+
db=db, # Database connection
|
|
530
|
+
sql="SELECT ...", # SQL statement(s)
|
|
531
|
+
bind_list=[...], # Bind parameters (list or dict)
|
|
532
|
+
response_type=None, # None (default) returns list-of-dicts
|
|
533
|
+
# "list" | "lastblob" | "arraybuffer"
|
|
534
|
+
)
|
|
535
|
+
# Default: [[{'col1': val1, 'col2': val2}, ...]]
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
<br><br>
|
|
540
|
+
# Node.js API Reference
|
|
88
541
|
- https://sqlmath.github.io/sqlmath/apidoc.html
|
|
89
542
|
|
|
90
543
|
[](https://sqlmath.github.io/sqlmath/apidoc.html)
|
|
91
544
|
|
|
92
545
|
|
|
546
|
+
<br><br>
|
|
547
|
+
# Platform Notes
|
|
548
|
+
|
|
549
|
+
The JavaScript (Node.js) binding is more mature than Python. Key differences:
|
|
550
|
+
|
|
551
|
+
| Feature | Node.js | Python |
|
|
552
|
+
|---------|---------|--------|
|
|
553
|
+
| Async vs sync api | **async only:** `result = await dbExecAsync({...})` | **sync only:** `result = db_exec(...)` |
|
|
554
|
+
| Connection pooling | ✅ `db = await dbOpenAsync({threadCount: 4, ...})` | ❌ `db = db_open(...)` |
|
|
555
|
+
| Type hints | N/A | ❌ Not yet |
|
|
556
|
+
| Context manager | N/A | ❌ `with db_open()` not supported |
|
|
557
|
+
|
|
558
|
+
> **Note:** The Python wrapper is a work in progress. Contributions welcome!
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
<br><br>
|
|
562
|
+
# Building from Source
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
<br><br>
|
|
566
|
+
### Prerequisites
|
|
567
|
+
|
|
568
|
+
- Node.js 24+
|
|
569
|
+
- Python 3.12+
|
|
570
|
+
- C compiler (gcc, clang, or MSVC)
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
<br><br>
|
|
574
|
+
### Build
|
|
575
|
+
|
|
576
|
+
```shell
|
|
577
|
+
#!/bin/sh
|
|
578
|
+
|
|
579
|
+
# git clone sqlmath repo
|
|
580
|
+
git clone https://github.com/sqlmath/sqlmath --branch=beta --single-branch
|
|
581
|
+
cd sqlmath
|
|
582
|
+
|
|
583
|
+
# Build native binary
|
|
584
|
+
npm run test2
|
|
585
|
+
|
|
586
|
+
# Build WebAssembly (optional)
|
|
587
|
+
sh jslint_ci.sh shCiBuildWasm
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
<br><br>
|
|
592
|
+
### Run Tests
|
|
593
|
+
|
|
594
|
+
```shell
|
|
595
|
+
# Full test suite (includes full clean-build)
|
|
596
|
+
npm run test2
|
|
597
|
+
|
|
598
|
+
# Full test suite (includes partial re-build of modified files)
|
|
599
|
+
npm run test
|
|
600
|
+
|
|
601
|
+
# Quick test (skip build)
|
|
602
|
+
npm run test --fast
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
<br><br>
|
|
607
|
+
### Serve Demo Locally
|
|
608
|
+
|
|
609
|
+
```shell
|
|
610
|
+
PORT=8080 sh jslint_ci.sh shHttpFileServer
|
|
611
|
+
# Open http://localhost:8080/index.html
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
|
|
93
615
|
<br><br>
|
|
94
616
|
# Package Listing
|
|
95
617
|

|
|
@@ -121,11 +643,11 @@ PORT=8080 sh jslint_ci.sh shHttpFileServer
|
|
|
121
643
|
```shell
|
|
122
644
|
python -m build
|
|
123
645
|
#
|
|
124
|
-
twine upload --repository testpypi dist/sqlmath-2026.
|
|
125
|
-
py -m pip install --index-url https://test.pypi.org/simple/ sqlmath==2026.
|
|
646
|
+
twine upload --repository testpypi dist/sqlmath-2026.4.30*
|
|
647
|
+
py -m pip install --index-url https://test.pypi.org/simple/ sqlmath==2026.4.30
|
|
126
648
|
#
|
|
127
|
-
twine upload dist/sqlmath-2026.
|
|
128
|
-
pip install sqlmath==2026.
|
|
649
|
+
twine upload dist/sqlmath-2026.4.30*
|
|
650
|
+
pip install sqlmath==2026.4.30
|
|
129
651
|
```
|
|
130
652
|
|
|
131
653
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/_sqlmath.shell_linux_x64
CHANGED
|
Binary file
|
|
Binary file
|
package/jslint.mjs
CHANGED
|
@@ -163,7 +163,7 @@ let jslint_charset_ascii = (
|
|
|
163
163
|
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
|
164
164
|
+ "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
|
|
165
165
|
);
|
|
166
|
-
let jslint_edition = "v2026.
|
|
166
|
+
let jslint_edition = "v2026.4.30";
|
|
167
167
|
let jslint_export; // The jslint object to be exported.
|
|
168
168
|
let jslint_fudge = 1; // Fudge starting line and starting
|
|
169
169
|
// ... column to 1.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
},
|
|
6
6
|
"counter": 0,
|
|
7
7
|
"description": "sqlite for data-science",
|
|
8
|
-
"fileCount":
|
|
8
|
+
"fileCount": 44,
|
|
9
9
|
"homepage": "https://github.com/sqlmath/sqlmath",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"data-science",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
},
|
|
33
33
|
"shCiArtifactUpload": 1,
|
|
34
34
|
"shCiPublishNpm": 1,
|
|
35
|
-
"version": "2026.
|
|
35
|
+
"version": "2026.4.30"
|
|
36
36
|
}
|
package/sqlmath.mjs
CHANGED
|
@@ -128,7 +128,7 @@ let {
|
|
|
128
128
|
let sqlMessageDict = {}; // dict of web-worker-callbacks
|
|
129
129
|
let sqlMessageId = 0;
|
|
130
130
|
let sqlWorker;
|
|
131
|
-
let version = "v2026.
|
|
131
|
+
let version = "v2026.4.30";
|
|
132
132
|
|
|
133
133
|
async function assertErrorThrownAsync(asyncFunc, regexp) {
|
|
134
134
|
|
|
@@ -327,7 +327,6 @@ async function ciBuildExt({
|
|
|
327
327
|
(`
|
|
328
328
|
(set -e
|
|
329
329
|
# rebuild binding
|
|
330
|
-
rm -rf build/Release/obj/SRC_SQLMATH_CUSTOM/
|
|
331
330
|
node "${binNodegyp}" build --release
|
|
332
331
|
# node "${binNodegyp}" build --release --loglevel=verbose
|
|
333
332
|
mv build/Release/binding.node "${cModulePath}"
|
|
@@ -339,7 +338,7 @@ async function ciBuildExt({
|
|
|
339
338
|
rm -f ${SQLMATH_EXE}
|
|
340
339
|
python setup.py exe_link \
|
|
341
340
|
./build/Release/SRC_SQLITE_BASE.lib \
|
|
342
|
-
./build/Release/
|
|
341
|
+
./build/Release/SRC_SQLMATH_BASE.lib \
|
|
343
342
|
./build/Release/obj/shell/sqlmath_external_sqlite.obj \
|
|
344
343
|
./zlib.v1.3.1.vcpkg.x64-windows-static.lib \
|
|
345
344
|
\
|
|
@@ -424,17 +423,15 @@ SQLMATH_CFLAG_WNO_LIST=" \\
|
|
|
424
423
|
},
|
|
425
424
|
{
|
|
426
425
|
"defines": [
|
|
427
|
-
"SRC_SQLMATH_BASE_C2"
|
|
428
|
-
"SRC_SQLMATH_CUSTOM_C2"
|
|
426
|
+
"SRC_SQLMATH_BASE_C2"
|
|
429
427
|
],
|
|
430
428
|
"dependencies": [
|
|
431
429
|
"SRC_SQLITE_BASE"
|
|
432
430
|
],
|
|
433
431
|
"sources": [
|
|
434
|
-
"sqlmath_base.c"
|
|
435
|
-
"sqlmath_custom.c"
|
|
432
|
+
"sqlmath_base.c"
|
|
436
433
|
],
|
|
437
|
-
"target_name": "
|
|
434
|
+
"target_name": "SRC_SQLMATH_BASE",
|
|
438
435
|
"type": "static_library"
|
|
439
436
|
},
|
|
440
437
|
{
|
|
@@ -442,7 +439,7 @@ SQLMATH_CFLAG_WNO_LIST=" \\
|
|
|
442
439
|
"SRC_SQLMATH_NODEJS_C2"
|
|
443
440
|
],
|
|
444
441
|
"dependencies": [
|
|
445
|
-
"
|
|
442
|
+
"SRC_SQLMATH_BASE"
|
|
446
443
|
],
|
|
447
444
|
"sources": [
|
|
448
445
|
"sqlmath_base.c"
|
|
@@ -465,7 +462,7 @@ SQLMATH_CFLAG_WNO_LIST=" \\
|
|
|
465
462
|
"SRC_SQLITE_SHELL_C2"
|
|
466
463
|
],
|
|
467
464
|
"dependencies": [
|
|
468
|
-
"
|
|
465
|
+
"SRC_SQLMATH_BASE"
|
|
469
466
|
],
|
|
470
467
|
"sources": [
|
|
471
468
|
"sqlmath_external_sqlite.c"
|
|
@@ -1059,11 +1056,7 @@ PRAGMA busy_timeout = ${timeoutBusy};
|
|
|
1059
1056
|
}),
|
|
1060
1057
|
// LGBM_DLOPEN
|
|
1061
1058
|
(async function () {
|
|
1062
|
-
let libLgbm
|
|
1063
|
-
libLgbm = process.platform;
|
|
1064
|
-
libLgbm = libLgbm.replace("darwin", "lib_lightgbm.dylib");
|
|
1065
|
-
libLgbm = libLgbm.replace("win32", "lib_lightgbm.dll");
|
|
1066
|
-
libLgbm = libLgbm.replace(process.platform, "lib_lightgbm.so");
|
|
1059
|
+
let libLgbm = `lib_lightgbm_${libPlatformArchExt()}`;
|
|
1067
1060
|
libLgbm = `${import.meta.dirname}/sqlmath/${libLgbm}`;
|
|
1068
1061
|
await moduleFs.promises.access(
|
|
1069
1062
|
libLgbm
|
|
@@ -1679,6 +1672,16 @@ function jsonRowListFromCsv({
|
|
|
1679
1672
|
return rowList;
|
|
1680
1673
|
}
|
|
1681
1674
|
|
|
1675
|
+
function libPlatformArchExt() {
|
|
1676
|
+
let libArch = process.arch;
|
|
1677
|
+
let libExt = process.platform;
|
|
1678
|
+
let libPlatform = process.platform;
|
|
1679
|
+
libExt = libExt.replace("darwin", "dylib");
|
|
1680
|
+
libExt = libExt.replace("win32", "dll");
|
|
1681
|
+
libExt = libExt.replace(libPlatform, "so");
|
|
1682
|
+
return `${libPlatform}_${libArch}.${libExt}`;
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1682
1685
|
function listOrEmptyList(list) {
|
|
1683
1686
|
|
|
1684
1687
|
// This function will return <list> or empty-list if falsy.
|
|
@@ -1906,7 +1909,11 @@ function waitAsync(timeout) {
|
|
|
1906
1909
|
// This function will wait <timeout> ms.
|
|
1907
1910
|
|
|
1908
1911
|
return new Promise(function (resolve) {
|
|
1909
|
-
|
|
1912
|
+
let ms = Number(timeout);
|
|
1913
|
+
if (!Number.isFinite(ms)) {
|
|
1914
|
+
ms = 0;
|
|
1915
|
+
}
|
|
1916
|
+
setTimeout(resolve, ms * !npm_config_mode_test);
|
|
1910
1917
|
});
|
|
1911
1918
|
}
|
|
1912
1919
|
|
|
@@ -1978,6 +1985,7 @@ export {
|
|
|
1978
1985
|
fsWriteFileUnlessTest,
|
|
1979
1986
|
jsbatonGetInt64,
|
|
1980
1987
|
jsbatonGetString,
|
|
1988
|
+
libPlatformArchExt,
|
|
1981
1989
|
listOrEmptyList,
|
|
1982
1990
|
noop,
|
|
1983
1991
|
objectDeepCopyWithKeysSorted,
|
package/sqlmath_browser.mjs
CHANGED
|
@@ -404,8 +404,8 @@ ALTER TABLE tradebot_tech_intra_month DROP COLUMN xdate2;
|
|
|
404
404
|
"1 month",
|
|
405
405
|
"ytd",
|
|
406
406
|
"1 year",
|
|
407
|
-
"
|
|
408
|
-
"
|
|
407
|
+
"3 year",
|
|
408
|
+
"3 year reverse timeline"
|
|
409
409
|
].map(function (dateInterval) {
|
|
410
410
|
let optionDict;
|
|
411
411
|
let tableChart;
|
|
@@ -520,8 +520,8 @@ UPDATE __tmp1
|
|
|
520
520
|
MAX(aa,
|
|
521
521
|
${
|
|
522
522
|
(
|
|
523
|
-
dateInterval === "
|
|
524
|
-
? "DATE(bb, '-
|
|
523
|
+
dateInterval === "3 year reverse timeline"
|
|
524
|
+
? "DATE(bb, '-3 YEAR')"
|
|
525
525
|
: dateInterval === "ytd"
|
|
526
526
|
? "DATE(STRFTIME('%Y', bb) || '-01-01', '-1 DAY')"
|
|
527
527
|
: "DATE(bb, '-" + dateInterval + "')"
|
|
@@ -583,7 +583,7 @@ UPDATE ${tableChart}
|
|
|
583
583
|
SET
|
|
584
584
|
${
|
|
585
585
|
(
|
|
586
|
-
dateInterval === "
|
|
586
|
+
dateInterval === "3 year reverse timeline"
|
|
587
587
|
? "yy = ROUND(100 * (1.0 / (yy * inv) - 1), 4)"
|
|
588
588
|
: "yy = ROUND(100 * (yy * inv - 1), 4)"
|
|
589
589
|
)
|
|
@@ -599,7 +599,7 @@ UPDATE ${tableChart}
|
|
|
599
599
|
PARTITION BY series_index ORDER BY xx
|
|
600
600
|
${
|
|
601
601
|
(
|
|
602
|
-
dateInterval === "
|
|
602
|
+
dateInterval === "3 year reverse timeline"
|
|
603
603
|
? "DESC"
|
|
604
604
|
: "ASC"
|
|
605
605
|
)
|
package/sqlmath_wasm.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*jslint-disable*/
|
|
2
|
+
// Copyright (c) 2021 Kai Zhu
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
// 2026-05-02T20:50:59+0000
|
|
5
|
+
(function () {
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
var g;g||(g=typeof Module !== 'undefined' ? Module : {});var aa=Object.assign;(function(){function a(){}function b(...c){a("\n\ndebugInline");a(...c);a("\n");return c[0]}b();a=console.error;return b})();function ba(a){return a&&a.constructor===ArrayBuffer}
|
|
9
|
+
(async function(){let a=h("dbFileLoadOrSave","number",["number","string","number"]),b=h("jsbatonGetErrmsg","string",["number"]),c=h("jsbatonGetString","string",["number","number"]),d=h("sqlite3_errmsg","string",["number"]),e;globalThis.onmessage=async function({data:f}){await e;f.batonPtr=0;try{a:{let G=f.FILENAME_DBTMP;var k=f.JSBATON_OFFSET_ALL;let Rb=f.JSBATON_OFFSET_BUFV,P=f.argList,Q=new Uint8Array(f.baton.buffer),C=0,A=P[4],Sb=0,ea="",W=f.funcname,Va=P[2];switch(W){case "_dbClose":case "_dbExec":case "_dbFileLoad":case "_dbNoop":case "_dbOpen":C=
|
|
10
|
+
ca(Q.byteLength);f.batonPtr=C;l.set(Q,C);switch(W){case "_dbClose":console.error(`_dbClose("${c(C,1)}")`);break;case "_dbFileLoad":Va||da(G,new Uint8Array(A));break;case "_dbOpen":console.error(`_dbOpen("${c(C,0)}")`)}fa(C);ea=b(C);Q.set(l.subarray(C,C+k));switch(!ea&&W){case "_dbExec":A=new BigInt64Array(Q.buffer,Rb);P[0]=l.slice(Number(A[0]),Number(A[0]+A[1])).buffer;ha(Number(A[0]));break;case "_dbFileLoad":if(Va){k=G;var m=m||0;var p=p||"binary";if("utf8"!==p&&"binary"!==p)throw Error('Invalid encoding type "'+
|
|
11
|
+
p+'"');var q,t=n(k,m),v=r(k).size,H=new Uint8Array(v);ia(t,H,0,v,0);"utf8"===p?q=u(H,0):"binary"===p&&(q=H);ja(t);P[0]=q.buffer;ka(G)}break;case "_dbOpen":A&&(da(G,new Uint8Array(A)),A=Number(la(C,0)),(Sb=a(A,G,0))&&(ea=d(A)),ka(G))}postMessage({argList:P,baton:new DataView(Q.buffer),errmsg:ea,funcname:W,id:f.id},[Q.buffer,...P.filter(ba)]);var Tb=void 0;break a}throw Error(`invalid funcname "${W}"`);}await Tb}catch(G){postMessage({errmsg:G.stack,id:f.id})}finally{ha(f.batonPtr)}};e=new Promise(function(f){g.postRun=
|
|
12
|
+
f});await e;ma()})();var na=aa({},g),oa="./this.program",pa="object"===typeof window,w="function"===typeof importScripts,qa="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node,x="",ra,sa,ta,fs,ua,va;
|
|
13
|
+
if(qa)x=w?require("path").dirname(x)+"/":__dirname+"/",va=()=>{ua||(fs=require("fs"),ua=require("path"))},ra=function(a,b){va();a=ua.normalize(a);return fs.readFileSync(a,b?null:"utf8")},ta=a=>{a=ra(a,!0);a.buffer||(a=new Uint8Array(a));return a},sa=(a,b,c)=>{va();a=ua.normalize(a);fs.readFile(a,function(d,e){d?c(d):b(e.buffer)})},1<process.argv.length&&(oa=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),"undefined"!==typeof module&&(module.exports=g),g.inspect=function(){return"[Emscripten Module object]"};
|
|
14
|
+
else if(pa||w)w?x=self.location.href:"undefined"!==typeof document&&document.currentScript&&(x=document.currentScript.src),x=0!==x.indexOf("blob:")?x.substr(0,x.replace(/[?#].*/,"").lastIndexOf("/")+1):"",ra=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},w&&(ta=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),sa=(a,b,c)=>{var d=new XMLHttpRequest;d.open("GET",a,!0);d.responseType="arraybuffer";
|
|
15
|
+
d.onload=()=>{200==d.status||0==d.status&&d.response?b(d.response):c()};d.onerror=c;d.send(null)};var wa=g.print||console.log.bind(console),y=g.printErr||console.warn.bind(console);aa(g,na);na=null;g.thisProgram&&(oa=g.thisProgram);var z;g.wasmBinary&&(z=g.wasmBinary);var noExitRuntime=g.noExitRuntime||!0;"object"!==typeof WebAssembly&&B("no native wasm support detected");var xa,ya=!1;
|
|
16
|
+
function za(a,b,c,d){var e={string:function(q){var t=0;if(null!==q&&void 0!==q&&0!==q){var v=(q.length<<2)+1;t=Aa(v);D(q,l,t,v)}return t},array:function(q){var t=Aa(q.length);E.set(q,t);return t}};a=g["_"+a];var f=[],k=0;if(d)for(var m=0;m<d.length;m++){var p=e[c[m]];p?(0===k&&(k=Ba()),f[m]=p(d[m])):f[m]=d[m]}c=a.apply(null,f);return c=function(q){0!==k&&Ca(k);return"string"===b?F(q):"boolean"===b?!!q:q}(c)}
|
|
17
|
+
function h(a,b,c,d){c=c||[];var e=c.every(function(f){return"number"===f});return"string"!==b&&e&&!d?g["_"+a]:function(){return za(a,b,c,arguments)}}var Da="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
|
18
|
+
function u(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16<c-b&&a.subarray&&Da)return Da.decode(a.subarray(b,c));for(d="";b<c;){var e=a[b++];if(e&128){var f=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|f);else{var k=a[b++]&63;e=224==(e&240)?(e&15)<<12|f<<6|k:(e&7)<<18|f<<12|k<<6|a[b++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d}function F(a){return a?u(l,a,void 0):""}
|
|
19
|
+
function D(a,b,c,d){if(!(0<d))return 0;var e=c;d=c+d-1;for(var f=0;f<a.length;++f){var k=a.charCodeAt(f);if(55296<=k&&57343>=k){var m=a.charCodeAt(++f);k=65536+((k&1023)<<10)|m&1023}if(127>=k){if(c>=d)break;b[c++]=k}else{if(2047>=k){if(c+1>=d)break;b[c++]=192|k>>6}else{if(65535>=k){if(c+2>=d)break;b[c++]=224|k>>12}else{if(c+3>=d)break;b[c++]=240|k>>18;b[c++]=128|k>>12&63}b[c++]=128|k>>6&63}b[c++]=128|k&63}}b[c]=0;return c-e}
|
|
20
|
+
function Ea(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}function Fa(a){var b=Ea(a)+1,c=Ga(b);c&&D(a,E,c,b);return c}var Ha,E,l,Ia,I,Ja;
|
|
21
|
+
function Ka(){var a=xa.buffer;Ha=a;g.HEAP8=E=new Int8Array(a);g.HEAP16=Ia=new Int16Array(a);g.HEAP32=I=new Int32Array(a);g.HEAPU8=l=new Uint8Array(a);g.HEAPU16=new Uint16Array(a);g.HEAPU32=new Uint32Array(a);g.HEAPF32=new Float32Array(a);g.HEAPF64=new Float64Array(a);g.HEAP64=Ja=new BigInt64Array(a);g.HEAPU64=new BigUint64Array(a)}var La,Ma=[],Na=[],Oa=[];function Pa(){var a=g.preRun.shift();Ma.unshift(a)}var J=0,Qa=null,Ra=null;g.preloadedImages={};g.preloadedAudios={};
|
|
22
|
+
function B(a){if(g.onAbort)g.onAbort(a);a="Aborted("+a+")";y(a);ya=!0;throw new WebAssembly.RuntimeError(a+". Build with -s ASSERTIONS=1 for more info.");}function Sa(){return K.startsWith("data:application/octet-stream;base64,")}var K;K="sqlmath_wasm.wasm";if(!Sa()){var Ta=K;K=g.locateFile?g.locateFile(Ta,x):x+Ta}function Ua(){var a=K;try{if(a==K&&z)return new Uint8Array(z);if(ta)return ta(a);throw"both async and sync fetching of the wasm failed";}catch(b){B(b)}}
|
|
23
|
+
function Wa(){if(!z&&(pa||w)){if("function"===typeof fetch&&!K.startsWith("file://"))return fetch(K,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+K+"'";return a.arrayBuffer()}).catch(function(){return Ua()});if(sa)return new Promise(function(a,b){sa(K,function(c){a(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return Ua()})}
|
|
24
|
+
function Xa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(g);else{var c=b.Sa;"number"===typeof c?void 0===b.wa?La.get(c)():La.get(c)(b.wa):c(void 0===b.wa?null:b.wa)}}}function Ya(a){return a.replace(/\b_Z[\w\d_]+/g,function(b){return b===b?b:b+" ["+b+"]"})}function Za(a,b){for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}
|
|
25
|
+
function L(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=Za(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a}function $a(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function ab(a){if("/"===a)return"/";a=L(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)}
|
|
26
|
+
function bb(){if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);return function(){crypto.getRandomValues(a);return a[0]}}if(qa)try{var b=require("crypto");return function(){return b.randomBytes(1)[0]}}catch(c){}return function(){B("randomDevice")}}
|
|
27
|
+
function cb(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=Za(a.split("/").filter(function(d){return!!d}),!b).join("/");return(b?"/":"")+a||"."}var db=[];function eb(a,b){db[a]={input:[],output:[],ra:b};fb(a,gb)}
|
|
28
|
+
var gb={open:function(a){var b=db[a.node.rdev];if(!b)throw new M(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.ra.flush(a.tty)},flush:function(a){a.tty.ra.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.ra.Ea)throw new M(60);for(var e=0,f=0;f<d;f++){try{var k=a.tty.ra.Ea(a.tty)}catch(m){throw new M(29);}if(void 0===k&&0===e)throw new M(6);if(null===k||void 0===k)break;e++;b[c+f]=k}e&&(a.node.timestamp=Date.now());return e},write:function(a,b,c,d){if(!a.tty||!a.tty.ra.ya)throw new M(60);
|
|
29
|
+
try{for(var e=0;e<d;e++)a.tty.ra.ya(a.tty,b[c+e])}catch(f){throw new M(29);}d&&(a.node.timestamp=Date.now());return e}},hb={Ea:function(a){if(!a.input.length){var b=null;if(qa){var c=Buffer.alloc(256),d=0;try{d=fs.readSync(process.stdin.fd,c,0,256,null)}catch(e){if(e.toString().includes("EOF"))d=0;else throw e;}0<d?b=c.slice(0,d).toString("utf-8"):b=null}else"undefined"!=typeof window&&"function"==typeof window.prompt?(b=window.prompt("Input: "),null!==b&&(b+="\n")):"function"==typeof readline&&(b=
|
|
30
|
+
readline(),null!==b&&(b+="\n"));if(!b)return null;c=Array(Ea(b)+1);b=D(b,c,0,c.length);c.length=b;a.input=c}return a.input.shift()},ya:function(a,b){null===b||10===b?(wa(u(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(wa(u(a.output,0)),a.output=[])}},ib={ya:function(a,b){null===b||10===b?(y(u(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(y(u(a.output,0)),a.output=[])}};
|
|
31
|
+
function jb(a){a=65536*Math.ceil(a/65536);var b=kb(65536,a);if(!b)return 0;l.fill(0,b,b+a);return b}
|
|
32
|
+
var N={la:null,ma:function(){return N.createNode(null,"/",16895,0)},createNode:function(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new M(63);N.la||(N.la={dir:{node:{ka:N.ea.ka,ja:N.ea.ja,lookup:N.ea.lookup,sa:N.ea.sa,rename:N.ea.rename,unlink:N.ea.unlink,rmdir:N.ea.rmdir,readdir:N.ea.readdir,symlink:N.ea.symlink},stream:{oa:N.fa.oa}},file:{node:{ka:N.ea.ka,ja:N.ea.ja},stream:{oa:N.fa.oa,read:N.fa.read,write:N.fa.write,Aa:N.fa.Aa,ta:N.fa.ta,ua:N.fa.ua}},link:{node:{ka:N.ea.ka,ja:N.ea.ja,
|
|
33
|
+
readlink:N.ea.readlink},stream:{}},Ba:{node:{ka:N.ea.ka,ja:N.ea.ja},stream:lb}});c=mb(a,b,c,d);16384===(c.mode&61440)?(c.ea=N.la.dir.node,c.fa=N.la.dir.stream,c.ga={}):32768===(c.mode&61440)?(c.ea=N.la.file.node,c.fa=N.la.file.stream,c.ia=0,c.ga=null):40960===(c.mode&61440)?(c.ea=N.la.link.node,c.fa=N.la.link.stream):8192===(c.mode&61440)&&(c.ea=N.la.Ba.node,c.fa=N.la.Ba.stream);c.timestamp=Date.now();a&&(a.ga[b]=c,a.timestamp=c.timestamp);return c},Ta:function(a){return a.ga?a.ga.subarray?a.ga.subarray(0,
|
|
34
|
+
a.ia):new Uint8Array(a.ga):new Uint8Array(0)},Ca:function(a,b){var c=a.ga?a.ga.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.ga,a.ga=new Uint8Array(b),0<a.ia&&a.ga.set(c.subarray(0,a.ia),0))},Pa:function(a,b){if(a.ia!=b)if(0==b)a.ga=null,a.ia=0;else{var c=a.ga;a.ga=new Uint8Array(b);c&&a.ga.set(c.subarray(0,Math.min(b,a.ia)));a.ia=b}},ea:{ka:function(a){var b={};b.dev=8192===(a.mode&61440)?a.id:1;b.ino=a.id;b.mode=a.mode;b.nlink=1;b.uid=0;b.gid=0;b.rdev=a.rdev;
|
|
35
|
+
16384===(a.mode&61440)?b.size=4096:32768===(a.mode&61440)?b.size=a.ia:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.atime=new Date(a.timestamp);b.mtime=new Date(a.timestamp);b.ctime=new Date(a.timestamp);b.Ga=4096;b.blocks=Math.ceil(b.size/b.Ga);return b},ja:function(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&(a.timestamp=b.timestamp);void 0!==b.size&&N.Pa(a,b.size)},lookup:function(){throw nb[44];},sa:function(a,b,c,d){return N.createNode(a,b,c,d)},rename:function(a,b,c){if(16384===
|
|
36
|
+
(a.mode&61440)){try{var d=O(b,c)}catch(f){}if(d)for(var e in d.ga)throw new M(55);}delete a.parent.ga[a.name];a.parent.timestamp=Date.now();a.name=c;b.ga[c]=a;b.timestamp=a.parent.timestamp;a.parent=b},unlink:function(a,b){delete a.ga[b];a.timestamp=Date.now()},rmdir:function(a,b){var c=O(a,b),d;for(d in c.ga)throw new M(55);delete a.ga[b];a.timestamp=Date.now()},readdir:function(a){var b=[".",".."],c;for(c in a.ga)a.ga.hasOwnProperty(c)&&b.push(c);return b},symlink:function(a,b,c){a=N.createNode(a,
|
|
37
|
+
b,41471,0);a.link=c;return a},readlink:function(a){if(40960!==(a.mode&61440))throw new M(28);return a.link}},fa:{read:function(a,b,c,d,e){var f=a.node.ga;if(e>=a.node.ia)return 0;a=Math.min(a.node.ia-e,d);if(8<a&&f.subarray)b.set(f.subarray(e,e+a),c);else for(d=0;d<a;d++)b[c+d]=f[e+d];return a},write:function(a,b,c,d,e,f){b.buffer===E.buffer&&(f=!1);if(!d)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.ga||a.ga.subarray)){if(f)return a.ga=b.subarray(c,c+d),a.ia=d;if(0===a.ia&&0===e)return a.ga=
|
|
38
|
+
b.slice(c,c+d),a.ia=d;if(e+d<=a.ia)return a.ga.set(b.subarray(c,c+d),e),d}N.Ca(a,e+d);if(a.ga.subarray&&b.subarray)a.ga.set(b.subarray(c,c+d),e);else for(f=0;f<d;f++)a.ga[e+f]=b[c+f];a.ia=Math.max(a.ia,e+d);return d},oa:function(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.ia);if(0>b)throw new M(28);return b},Aa:function(a,b,c){N.Ca(a.node,b+c);a.node.ia=Math.max(a.node.ia,b+c)},ta:function(a,b,c,d,e,f){if(0!==b)throw new M(28);if(32768!==(a.node.mode&61440))throw new M(43);
|
|
39
|
+
a=a.node.ga;if(f&2||a.buffer!==Ha){if(0<d||d+c<a.length)a.subarray?a=a.subarray(d,d+c):a=Array.prototype.slice.call(a,d,d+c);d=!0;c=jb(c);if(!c)throw new M(48);E.set(a,c)}else d=!1,c=a.byteOffset;return{Oa:c,va:d}},ua:function(a,b,c,d,e){if(32768!==(a.node.mode&61440))throw new M(43);if(e&2)return 0;N.fa.write(a,b,0,d,c,!1);return 0}}},ob=null,pb={},R=[],qb=1,S=null,rb=!0,M=null,nb={},T=(a,b={})=>{a=cb("/",a);if(!a)return{path:"",node:null};var c={Da:!0,za:0},d;for(d in c)void 0===b[d]&&(b[d]=c[d]);
|
|
40
|
+
if(8<b.za)throw new M(32);a=Za(a.split("/").filter(k=>!!k),!1);var e=ob;c="/";for(d=0;d<a.length;d++){var f=d===a.length-1;if(f&&b.parent)break;e=O(e,a[d]);c=L(c+"/"+a[d]);e.pa&&(!f||f&&b.Da)&&(e=e.pa.root);if(!f||b.na)for(f=0;40960===(e.mode&61440);)if(e=sb(c),c=cb($a(c),e),e=T(c,{za:b.za}).node,40<f++)throw new M(32);}return{path:c,node:e}},tb=a=>{for(var b;;){if(a===a.parent)return a=a.ma.Fa,b?"/"!==a[a.length-1]?a+"/"+b:a+b:a;b=b?a.name+"/"+b:a.name;a=a.parent}},ub=(a,b)=>{for(var c=0,d=0;d<b.length;d++)c=
|
|
41
|
+
(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%S.length},vb=a=>{var b=ub(a.parent.id,a.name);if(S[b]===a)S[b]=a.qa;else for(b=S[b];b;){if(b.qa===a){b.qa=a.qa;break}b=b.qa}},O=(a,b)=>{var c;if(c=(c=U(a,"x"))?c:a.ea.lookup?0:2)throw new M(c,a);for(c=S[ub(a.id,b)];c;c=c.qa){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.ea.lookup(a,b)},mb=(a,b,c,d)=>{a=new wb(a,b,c,d);b=ub(a.parent.id,a.name);a.qa=S[b];return S[b]=a},xb={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},yb=a=>{var b=["r","w","rw"][a&
|
|
42
|
+
3];a&512&&(b+="w");return b},U=(a,b)=>{if(rb)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0},zb=(a,b)=>{try{return O(a,b),20}catch(c){}return U(a,"wx")},Ab=(a,b,c)=>{try{var d=O(a,b)}catch(e){return e.ha}if(a=U(a,"wx"))return a;if(c){if(16384!==(d.mode&61440))return 54;if(d===d.parent||"/"===tb(d))return 10}else if(16384===(d.mode&61440))return 31;return 0},Bb=(a=0,b=4096)=>{for(;a<=b;a++)if(!R[a])return a;
|
|
43
|
+
throw new M(33);},Db=(a,b)=>{Cb||(Cb=function(){},Cb.prototype={});var c=new Cb,d;for(d in a)c[d]=a[d];a=c;b=Bb(b,void 0);a.fd=b;return R[b]=a},lb={open:a=>{a.fa=pb[a.node.rdev].fa;a.fa.open&&a.fa.open(a)},oa:()=>{throw new M(70);}},fb=(a,b)=>{pb[a]={fa:b}},Eb=(a,b)=>{var c="/"===b,d=!b;if(c&&ob)throw new M(10);if(!c&&!d){var e=T(b,{Da:!1});b=e.path;e=e.node;if(e.pa)throw new M(10);if(16384!==(e.mode&61440))throw new M(54);}b={type:a,Ua:{},Fa:b,Ma:[]};a=a.ma(b);a.ma=b;b.root=a;c?ob=a:e&&(e.pa=b,e.ma&&
|
|
44
|
+
e.ma.Ma.push(b))},Fb=(a,b,c)=>{var d=T(a,{parent:!0}).node;a=ab(a);if(!a||"."===a||".."===a)throw new M(28);var e=zb(d,a);if(e)throw new M(e);if(!d.ea.sa)throw new M(63);return d.ea.sa(d,a,b,c)},V=(a,b)=>Fb(a,(void 0!==b?b:511)&1023|16384,0),Gb=(a,b,c)=>{"undefined"===typeof c&&(c=b,b=438);Fb(a,b|8192,c)},Hb=(a,b)=>{if(!cb(a))throw new M(44);var c=T(b,{parent:!0}).node;if(!c)throw new M(44);b=ab(b);var d=zb(c,b);if(d)throw new M(d);if(!c.ea.symlink)throw new M(63);c.ea.symlink(c,b,a)},ka=a=>{var b=
|
|
45
|
+
T(a,{parent:!0}).node;if(!b)throw new M(44);a=ab(a);var c=O(b,a),d=Ab(b,a,!1);if(d)throw new M(d);if(!b.ea.unlink)throw new M(63);if(c.pa)throw new M(10);b.ea.unlink(b,a);vb(c)},sb=a=>{a=T(a).node;if(!a)throw new M(44);if(!a.ea.readlink)throw new M(28);return cb(tb(a.parent),a.ea.readlink(a))},r=(a,b)=>{a=T(a,{na:!b}).node;if(!a)throw new M(44);if(!a.ea.ka)throw new M(63);return a.ea.ka(a)},Ib=a=>r(a,!0),Jb=(a,b)=>{a="string"===typeof a?T(a,{na:!0}).node:a;if(!a.ea.ja)throw new M(63);a.ea.ja(a,{mode:b&
|
|
46
|
+
4095|a.mode&-4096,timestamp:Date.now()})},Kb=a=>{a="string"===typeof a?T(a,{na:!0}).node:a;if(!a.ea.ja)throw new M(63);a.ea.ja(a,{timestamp:Date.now()})},Lb=(a,b)=>{if(0>b)throw new M(28);a="string"===typeof a?T(a,{na:!0}).node:a;if(!a.ea.ja)throw new M(63);if(16384===(a.mode&61440))throw new M(31);if(32768!==(a.mode&61440))throw new M(28);var c=U(a,"w");if(c)throw new M(c);a.ea.ja(a,{size:b,timestamp:Date.now()})},n=(a,b,c,d)=>{if(""===a)throw new M(44);if("string"===typeof b){var e=xb[b];if("undefined"===
|
|
47
|
+
typeof e)throw Error("Unknown file open mode: "+b);b=e}c=b&64?("undefined"===typeof c?438:c)&4095|32768:0;if("object"===typeof a)var f=a;else{a=L(a);try{f=T(a,{na:!(b&131072)}).node}catch(k){}}e=!1;if(b&64)if(f){if(b&128)throw new M(20);}else f=Fb(a,c,0),e=!0;if(!f)throw new M(44);8192===(f.mode&61440)&&(b&=-513);if(b&65536&&16384!==(f.mode&61440))throw new M(54);if(!e&&(c=f?40960===(f.mode&61440)?32:16384===(f.mode&61440)&&("r"!==yb(b)||b&512)?31:U(f,yb(b)):44))throw new M(c);b&512&&Lb(f,0);b&=-131713;
|
|
48
|
+
d=Db({node:f,path:tb(f),flags:b,seekable:!0,position:0,fa:f.fa,Ra:[],error:!1},d);d.fa.open&&d.fa.open(d);!g.logReadFiles||b&1||(Mb||(Mb={}),a in Mb||(Mb[a]=1));return d},ja=a=>{if(null===a.fd)throw new M(8);a.xa&&(a.xa=null);try{a.fa.close&&a.fa.close(a)}catch(b){throw b;}finally{R[a.fd]=null}a.fd=null},Nb=(a,b,c)=>{if(null===a.fd)throw new M(8);if(!a.seekable||!a.fa.oa)throw new M(70);if(0!=c&&1!=c&&2!=c)throw new M(28);a.position=a.fa.oa(a,b,c);a.Ra=[]},ia=(a,b,c,d,e)=>{if(0>d||0>e)throw new M(28);
|
|
49
|
+
if(null===a.fd)throw new M(8);if(1===(a.flags&2097155))throw new M(8);if(16384===(a.node.mode&61440))throw new M(31);if(!a.fa.read)throw new M(28);var f="undefined"!==typeof e;if(!f)e=a.position;else if(!a.seekable)throw new M(70);b=a.fa.read(a,b,c,d,e);f||(a.position+=b);return b},Ob=(a,b,c,d,e)=>{var f=void 0;if(0>d||0>f)throw new M(28);if(null===a.fd)throw new M(8);if(0===(a.flags&2097155))throw new M(8);if(16384===(a.node.mode&61440))throw new M(31);if(!a.fa.write)throw new M(28);a.seekable&&
|
|
50
|
+
a.flags&1024&&Nb(a,0,2);var k="undefined"!==typeof f;if(!k)f=a.position;else if(!a.seekable)throw new M(70);b=a.fa.write(a,b,c,d,f,e);k||(a.position+=b);return b},da=(a,b)=>{var c={};c.flags=c.flags||577;a=n(a,c.flags,c.mode);if("string"===typeof b){var d=new Uint8Array(Ea(b)+1);b=D(b,d,0,d.length);Ob(a,d,0,b,c.Ia)}else if(ArrayBuffer.isView(b))Ob(a,b,0,b.byteLength,c.Ia);else throw Error("Unsupported data type");ja(a)},Pb=()=>{M||(M=function(a,b){this.node=b;this.Qa=function(c){this.ha=c};this.Qa(a);
|
|
51
|
+
this.message="FS error"},M.prototype=Error(),M.prototype.constructor=M,[44].forEach(a=>{nb[a]=new M(a);nb[a].stack="<generic error, no stack>"}))},Qb,Ub=(a,b)=>{var c=0;a&&(c|=365);b&&(c|=146);return c},Wb=(a,b,c)=>{a=L("/dev/"+a);var d=Ub(!!b,!!c);Vb||(Vb=64);var e=Vb++<<8|0;fb(e,{open:f=>{f.seekable=!1},close:()=>{c&&c.buffer&&c.buffer.length&&c(10)},read:(f,k,m,p)=>{for(var q=0,t=0;t<p;t++){try{var v=b()}catch(H){throw new M(29);}if(void 0===v&&0===q)throw new M(6);if(null===v||void 0===v)break;
|
|
52
|
+
q++;k[m+t]=v}q&&(f.node.timestamp=Date.now());return q},write:(f,k,m,p)=>{for(var q=0;q<p;q++)try{c(k[m+q])}catch(t){throw new M(29);}p&&(f.node.timestamp=Date.now());return q}});Gb(a,d,e)},Vb,X={},Cb,Mb,Xb={};
|
|
53
|
+
function Yb(a,b,c){try{var d=a(b)}catch(e){if(e&&e.node&&L(b)!==L(tb(e.node)))return-54;throw e;}I[c>>2]=d.dev;I[c+4>>2]=0;I[c+8>>2]=d.ino;I[c+12>>2]=d.mode;I[c+16>>2]=d.nlink;I[c+20>>2]=d.uid;I[c+24>>2]=d.gid;I[c+28>>2]=d.rdev;I[c+32>>2]=0;Ja[c+40>>3]=BigInt(d.size);I[c+48>>2]=4096;I[c+52>>2]=d.blocks;I[c+56>>2]=d.atime.getTime()/1E3|0;I[c+60>>2]=0;I[c+64>>2]=d.mtime.getTime()/1E3|0;I[c+68>>2]=0;I[c+72>>2]=d.ctime.getTime()/1E3|0;I[c+76>>2]=0;Ja[c+80>>3]=BigInt(d.ino);return 0}var Zb=void 0;
|
|
54
|
+
function Y(){Zb+=4;return I[Zb-4>>2]}function Z(a){a=R[a];if(!a)throw new M(8);return a}function $b(a,b,c){function d(p){return(p=p.toTimeString().match(/\(([A-Za-z ]+)\)$/))?p[1]:"GMT"}var e=(new Date).getFullYear(),f=new Date(e,0,1),k=new Date(e,6,1);e=f.getTimezoneOffset();var m=k.getTimezoneOffset();I[a>>2]=60*Math.max(e,m);I[b>>2]=Number(e!=m);a=d(f);b=d(k);a=Fa(a);b=Fa(b);m<e?(I[c>>2]=a,I[c+4>>2]=b):(I[c>>2]=b,I[c+4>>2]=a)}function ac(a,b,c){ac.Ha||(ac.Ha=!0,$b(a,b,c))}var bc;
|
|
55
|
+
bc=qa?()=>{var a=process.hrtime();return 1E3*a[0]+a[1]/1E6}:()=>performance.now();var cc={};function dc(){if(!ec){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:oa||"./this.program"},b;for(b in cc)void 0===cc[b]?delete a[b]:a[b]=cc[b];var c=[];for(b in a)c.push(b+"="+a[b]);ec=c}return ec}var ec;
|
|
56
|
+
function wb(a,b,c,d){a||(a=this);this.parent=a;this.ma=a.ma;this.pa=null;this.id=qb++;this.name=b;this.mode=c;this.ea={};this.fa={};this.rdev=d}Object.defineProperties(wb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});Pb();S=Array(4096);Eb(N,"/");V("/tmp");V("/home");V("/home/web_user");
|
|
57
|
+
(()=>{V("/dev");fb(259,{read:()=>0,write:(b,c,d,e)=>e});Gb("/dev/null",259);eb(1280,hb);eb(1536,ib);Gb("/dev/tty",1280);Gb("/dev/tty1",1536);var a=bb();Wb("random",a);Wb("urandom",a);V("/dev/shm");V("/dev/shm/tmp")})();(()=>{V("/proc");var a=V("/proc/self");V("/proc/self/fd");Eb({ma:()=>{var b=mb(a,"fd",16895,73);b.ea={lookup:(c,d)=>{var e=R[+d];if(!e)throw new M(8);c={parent:null,ma:{Fa:"fake"},ea:{readlink:()=>e.path}};return c.parent=c}};return b}},"/proc/self/fd")})();
|
|
58
|
+
var hc={u:function(a,b){try{a=F(a);if(b&-8)var c=-28;else{var d=T(a,{na:!0}).node;d?(a="",b&4&&(a+="r"),b&2&&(a+="w"),b&1&&(a+="x"),c=a&&U(d,a)?-2:0):c=-44}return c}catch(e){if("undefined"===typeof X||!(e instanceof M))throw e;return-e.ha}},K:function(a,b){try{return a=F(a),Jb(a,b),0}catch(c){if("undefined"===typeof X||!(c instanceof M))throw c;return-c.ha}},I:function(a){try{return a=F(a),Kb(a),0}catch(b){if("undefined"===typeof X||!(b instanceof M))throw b;return-b.ha}},i:function(a,b){try{var c=
|
|
59
|
+
R[a];if(!c)throw new M(8);Jb(c.node,b);return 0}catch(d){if("undefined"===typeof X||!(d instanceof M))throw d;return-d.ha}},J:function(a){try{var b=R[a];if(!b)throw new M(8);Kb(b.node);return 0}catch(c){if("undefined"===typeof X||!(c instanceof M))throw c;return-c.ha}},a:function(a,b,c){Zb=c;try{var d=Z(a);switch(b){case 0:var e=Y();return 0>e?-28:n(d.path,d.flags,0,e).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=Y(),d.flags|=e,0;case 5:return e=Y(),Ia[e+0>>1]=2,0;case 6:case 7:return 0;
|
|
60
|
+
case 16:case 8:return-28;case 9:return I[fc()>>2]=28,-1;default:return-28}}catch(f){if("undefined"===typeof X||!(f instanceof M))throw f;return-f.ha}},F:function(a,b){try{var c=Z(a);return Yb(r,c.path,b)}catch(d){if("undefined"===typeof X||!(d instanceof M))throw d;return-d.ha}},B:function(a,b,c,d){try{b=F(b);var e=d&256;d&=4096;var f=b;if("/"===f[0])b=f;else{if(-100===a)var k="/";else{var m=R[a];if(!m)throw new M(8);k=m.path}if(0==f.length){if(!d)throw new M(44);b=k}else b=L(k+"/"+f)}return Yb(e?
|
|
61
|
+
Ib:r,b,c)}catch(p){if("undefined"===typeof X||!(p instanceof M))throw p;return-p.ha}},z:function(a,b){try{var c=R[a];if(!c)throw new M(8);if(0===(c.flags&2097155))throw new M(28);Lb(c.node,b);return 0}catch(d){if("undefined"===typeof X||!(d instanceof M))throw d;return-d.ha}},y:function(a,b){try{if(0===b)return-28;if(b<Ea("/")+1)return-68;D("/",l,a,b);return a}catch(c){if("undefined"===typeof X||!(c instanceof M))throw c;return-c.ha}},v:function(){return 0},H:function(a,b,c){Zb=c;try{var d=Z(a);switch(b){case 21509:case 21505:return d.tty?
|
|
62
|
+
0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return d.tty?0:-59;case 21519:if(!d.tty)return-59;var e=Y();return I[e>>2]=0;case 21520:return d.tty?-28:-59;case 21531:a=e=Y();if(!d.fa.Ja)throw new M(59);return d.fa.Ja(d,b,a);case 21523:return d.tty?0:-59;case 21524:return d.tty?0:-59;default:B("bad ioctl syscall "+b)}}catch(f){if("undefined"===typeof X||!(f instanceof M))throw f;return-f.ha}},C:function(a,b){try{return a=F(a),Yb(Ib,a,b)}catch(c){if("undefined"===typeof X||
|
|
63
|
+
!(c instanceof M))throw c;return-c.ha}},s:function(a,b){try{return a=F(a),a=L(a),"/"===a[a.length-1]&&(a=a.substr(0,a.length-1)),V(a,b),0}catch(c){if("undefined"===typeof X||!(c instanceof M))throw c;return-c.ha}},r:function(a,b,c,d,e,f){try{a:{f<<=12;var k=!1;if(0!==(d&16)&&0!==a%65536)var m=-28;else{if(0!==(d&32)){var p=jb(b);if(!p){m=-48;break a}k=!0}else{var q=R[e];if(!q){m=-8;break a}var t=f;if(0!==(c&2)&&0===(d&2)&&2!==(q.flags&2097155))throw new M(2);if(1===(q.flags&2097155))throw new M(2);
|
|
64
|
+
if(!q.fa.ta)throw new M(43);var v=q.fa.ta(q,a,b,t,c,d);p=v.Oa;k=v.va}Xb[p]={La:p,Ka:b,va:k,fd:e,Na:c,flags:d,offset:f};m=p}}return m}catch(H){if("undefined"===typeof X||!(H instanceof M))throw H;return-H.ha}},q:function(a,b){try{var c=Xb[a];if(0!==b&&c){if(b===c.Ka){var d=R[c.fd];if(d&&c.Na&2){var e=c.flags,f=c.offset,k=l.slice(a,a+b);d&&d.fa.ua&&d.fa.ua(d,k,f,b,e)}Xb[a]=null;c.va&&gc(c.La)}var m=0}else m=-28;return m}catch(p){if("undefined"===typeof X||!(p instanceof M))throw p;return-p.ha}},h:function(a,
|
|
65
|
+
b,c){Zb=c;try{var d=F(a),e=c?Y():0;return n(d,b,e).fd}catch(f){if("undefined"===typeof X||!(f instanceof M))throw f;return-f.ha}},p:function(a,b,c){try{a=F(a);if(0>=c)var d=-28;else{var e=sb(a),f=Math.min(c,Ea(e)),k=E[b+f];D(e,l,b,c+1);E[b+f]=k;d=f}return d}catch(m){if("undefined"===typeof X||!(m instanceof M))throw m;return-m.ha}},o:function(a){try{a=F(a);var b=T(a,{parent:!0}).node,c=ab(a),d=O(b,c),e=Ab(b,c,!0);if(e)throw new M(e);if(!b.ea.rmdir)throw new M(63);if(d.pa)throw new M(10);b.ea.rmdir(b,
|
|
66
|
+
c);vb(d);return 0}catch(f){if("undefined"===typeof X||!(f instanceof M))throw f;return-f.ha}},D:function(a,b){try{return a=F(a),Yb(r,a,b)}catch(c){if("undefined"===typeof X||!(c instanceof M))throw c;return-c.ha}},n:function(a){try{return a=F(a),ka(a),0}catch(b){if("undefined"===typeof X||!(b instanceof M))throw b;return-b.ha}},d:function(){B("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},l:function(){B("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},
|
|
67
|
+
j:function(a,b){a=new Date(1E3*I[a>>2]);I[b>>2]=a.getSeconds();I[b+4>>2]=a.getMinutes();I[b+8>>2]=a.getHours();I[b+12>>2]=a.getDate();I[b+16>>2]=a.getMonth();I[b+20>>2]=a.getFullYear()-1900;I[b+24>>2]=a.getDay();var c=new Date(a.getFullYear(),0,1);I[b+28>>2]=(a.getTime()-c.getTime())/864E5|0;I[b+36>>2]=-(60*a.getTimezoneOffset());var d=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();c=c.getTimezoneOffset();I[b+32>>2]=(d!=c&&a.getTimezoneOffset()==Math.min(c,d))|0},k:ac,e:bc,G:function(a,b,c){l.copyWithin(a,
|
|
68
|
+
b,b+c)},c:function(a){var b=l.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{xa.grow(Math.min(2147483648,d)-Ha.byteLength+65535>>>16);Ka();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},w:function(a,b){var c=0;dc().forEach(function(d,e){var f=b+c;e=I[a+4*e>>2]=f;for(f=0;f<d.length;++f)E[e++>>0]=d.charCodeAt(f);E[e>>0]=0;c+=d.length+1});return 0},x:function(a,b){var c=dc();I[a>>
|
|
69
|
+
2]=c.length;var d=0;c.forEach(function(e){d+=e.length+1});I[b>>2]=d;return 0},b:function(a){try{var b=Z(a);ja(b);return 0}catch(c){if("undefined"===typeof X||!(c instanceof M))throw c;return c.ha}},m:function(a,b){try{var c=Z(a);E[b>>0]=c.tty?2:16384===(c.mode&61440)?3:40960===(c.mode&61440)?7:4;return 0}catch(d){if("undefined"===typeof X||!(d instanceof M))throw d;return d.ha}},g:function(a,b,c,d){try{a:{for(var e=Z(a),f=a=0;f<c;f++){var k=I[b+(8*f+4)>>2],m=ia(e,E,I[b+8*f>>2],k,void 0);if(0>m){var p=
|
|
70
|
+
-1;break a}a+=m;if(m<k)break}p=a}I[d>>2]=p;return 0}catch(q){if("undefined"===typeof X||!(q instanceof M))throw q;return q.ha}},t:function(a,b,c,d){try{var e=Number(b&BigInt(4294967295))|0,f=Number(b>>BigInt(32))|0,k=Z(a);a=4294967296*f+(e>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;Nb(k,a,c);Ja[d>>3]=BigInt(k.position);k.xa&&0===a&&0===c&&(k.xa=null);return 0}catch(m){if("undefined"===typeof X||!(m instanceof M))throw m;return m.ha}},A:function(a){try{var b=Z(a);return b.fa&&b.fa.fsync?
|
|
71
|
+
-b.fa.fsync(b):0}catch(c){if("undefined"===typeof X||!(c instanceof M))throw c;return c.ha}},f:function(a,b,c,d){try{a:{for(var e=Z(a),f=a=0;f<c;f++){var k=Ob(e,E,I[b+8*f>>2],I[b+(8*f+4)>>2]);if(0>k){var m=-1;break a}a+=k}m=a}I[d>>2]=m;return 0}catch(p){if("undefined"===typeof X||!(p instanceof M))throw p;return p.ha}},E:function(a){var b=Date.now();I[a>>2]=b/1E3|0;I[a+4>>2]=b%1E3*1E3|0;return 0},L:function(a){var b=Date.now()/1E3|0;a&&(I[a>>2]=b);return b},M:function(a,b){if(b){var c=b+8;b=1E3*I[c>>
|
|
72
|
+
2];b+=I[c+4>>2]/1E3}else b=Date.now();a=F(a);try{var d=T(a,{na:!0}).node;d.ea.ja(d,{timestamp:Math.max(b,b)});var e=0}catch(f){if(!(f instanceof M)){b:{e=Error();if(!e.stack){try{throw Error();}catch(k){e=k}if(!e.stack){e="(no stack trace available)";break b}}e=e.stack.toString()}g.extraStackTrace&&(e+="\n"+g.extraStackTrace());e=Ya(e);throw f+" : "+e;}e=f.ha;I[fc()>>2]=e;e=-1}return e}};
|
|
73
|
+
(function(){function a(e){g.asm=e.exports;xa=g.asm.N;Ka();La=g.asm.$;Na.unshift(g.asm.O);J--;g.monitorRunDependencies&&g.monitorRunDependencies(J);0==J&&(null!==Qa&&(clearInterval(Qa),Qa=null),Ra&&(e=Ra,Ra=null,e()))}function b(e){a(e.instance)}function c(e){return Wa().then(function(f){return WebAssembly.instantiate(f,d)}).then(function(f){return f}).then(e,function(f){y("failed to asynchronously prepare wasm: "+f);B(f)})}var d={a:hc};J++;g.monitorRunDependencies&&g.monitorRunDependencies(J);if(g.instantiateWasm)try{return g.instantiateWasm(d,
|
|
74
|
+
a)}catch(e){return y("Module.instantiateWasm callback failed with error: "+e),!1}(function(){return z||"function"!==typeof WebAssembly.instantiateStreaming||Sa()||K.startsWith("file://")||"function"!==typeof fetch?c(b):fetch(K,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(f){y("wasm streaming compile failed: "+f);y("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
|
75
|
+
g.___wasm_call_ctors=function(){return(g.___wasm_call_ctors=g.asm.O).apply(null,arguments)};var fa=g._dbCall=function(){return(fa=g._dbCall=g.asm.P).apply(null,arguments)};g._jsbatonGetString=function(){return(g._jsbatonGetString=g.asm.Q).apply(null,arguments)};var ca=g._sqlite3_malloc=function(){return(ca=g._sqlite3_malloc=g.asm.R).apply(null,arguments)},ha=g._sqlite3_free=function(){return(ha=g._sqlite3_free=g.asm.S).apply(null,arguments)};
|
|
76
|
+
g._dbFileLoadOrSave=function(){return(g._dbFileLoadOrSave=g.asm.T).apply(null,arguments)};var la=g._jsbatonGetInt64=function(){return(la=g._jsbatonGetInt64=g.asm.U).apply(null,arguments)};g._sqlite3_errmsg=function(){return(g._sqlite3_errmsg=g.asm.V).apply(null,arguments)};g._jsbatonGetErrmsg=function(){return(g._jsbatonGetErrmsg=g.asm.W).apply(null,arguments)};
|
|
77
|
+
var ma=g._sqlite3_initialize=function(){return(ma=g._sqlite3_initialize=g.asm.X).apply(null,arguments)},fc=g.___errno_location=function(){return(fc=g.___errno_location=g.asm.Y).apply(null,arguments)},Ga=g._malloc=function(){return(Ga=g._malloc=g.asm.Z).apply(null,arguments)},gc=g._free=function(){return(gc=g._free=g.asm._).apply(null,arguments)},kb=g._memalign=function(){return(kb=g._memalign=g.asm.aa).apply(null,arguments)},Ba=g.stackSave=function(){return(Ba=g.stackSave=g.asm.ba).apply(null,arguments)},
|
|
78
|
+
Ca=g.stackRestore=function(){return(Ca=g.stackRestore=g.asm.ca).apply(null,arguments)},Aa=g.stackAlloc=function(){return(Aa=g.stackAlloc=g.asm.da).apply(null,arguments)};g.cwrap=h;var ic;Ra=function jc(){ic||kc();ic||(Ra=jc)};
|
|
79
|
+
function kc(){function a(){if(!ic&&(ic=!0,g.calledRun=!0,!ya)){g.noFSInit||Qb||(Qb=!0,Pb(),g.stdin=g.stdin,g.stdout=g.stdout,g.stderr=g.stderr,g.stdin?Wb("stdin",g.stdin):Hb("/dev/tty","/dev/stdin"),g.stdout?Wb("stdout",null,g.stdout):Hb("/dev/tty","/dev/stdout"),g.stderr?Wb("stderr",null,g.stderr):Hb("/dev/tty1","/dev/stderr"),n("/dev/stdin",0),n("/dev/stdout",1),n("/dev/stderr",1));rb=!1;Xa(Na);if(g.onRuntimeInitialized)g.onRuntimeInitialized();if(g.postRun)for("function"==typeof g.postRun&&(g.postRun=
|
|
80
|
+
[g.postRun]);g.postRun.length;){var b=g.postRun.shift();Oa.unshift(b)}Xa(Oa)}}if(!(0<J)){if(g.preRun)for("function"==typeof g.preRun&&(g.preRun=[g.preRun]);g.preRun.length;)Pa();Xa(Ma);0<J||(g.setStatus?(g.setStatus("Running..."),setTimeout(function(){setTimeout(function(){g.setStatus("")},1);a()},1)):a())}}g.run=kc;if(g.preInit)for("function"==typeof g.preInit&&(g.preInit=[g.preInit]);0<g.preInit.length;)g.preInit.pop()();kc();
|
|
81
|
+
|
|
82
|
+
}());
|
|
83
|
+
/*jslint-enable*/
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/sqlmath_custom.mjs
DELETED