sqlmath 2024.3.25 → 2024.5.26
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/CHANGELOG.md +12 -1
- package/README.md +15 -13
- package/jslint.mjs +1 -1
- package/package.json +3 -3
- package/sqlmath.mjs +107 -21
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@
|
|
|
4
4
|
- sqlmath - Add sqlite-extension for lightgbm.
|
|
5
5
|
- none
|
|
6
6
|
|
|
7
|
+
# v2024.5.26
|
|
8
|
+
- webdemo - Replace market-indices .spx/.ndx/.dji with futures .es/.nq/.ym.
|
|
9
|
+
- sqlite - Decouple c-function str99JsonAppendText() from builtin-function jsonAppendString().
|
|
10
|
+
- sqlite - Update to sqlite v3.42.0.
|
|
11
|
+
- sqlmath - Remove little-used sqlean-regexp-extension and file sqlmath_external_pcre2.c.
|
|
12
|
+
- sqlmath - bugfix - Fix off-by-2 root-mean-square-deviation calculation of parameter lee in sql-function win_sinefit2().
|
|
13
|
+
- sqlmath - bugfix - Fix null-case handling-behavior for function dbExecAndReturnLastBlobAsync().
|
|
14
|
+
- sqlmath - Add functions dbExecAndReturnFirstRow(), dbExecAndReturnFirstTable(), listOrEmptyList().
|
|
15
|
+
- jslint - Update jslint to v2024.4.1-beta.
|
|
16
|
+
- ci - bugfix - Fix package.json config-regression breaking ci.
|
|
17
|
+
|
|
7
18
|
# v2024.3.25
|
|
8
19
|
- jslint-ci - Add shell-functions shGitPullrequestCleanup(), shGitPullrequest() to automatically cleanup or create-and-push github-pull-commit to origin/alpha.
|
|
9
20
|
- ci - Fix tmpdir in shell-function shBrowserScreenshot().
|
|
@@ -33,7 +44,7 @@
|
|
|
33
44
|
- sqlean - Add sqlean-extension regexp with regexp-replacement and pcre2 - increases wasm size to 1.1mb.
|
|
34
45
|
- zlib - Update to zlib v1.3.
|
|
35
46
|
- sqlmath - Fix SIGSEGV error when binding external-buffer during db_exec.
|
|
36
|
-
- sqlite - Update to sqlite v3.
|
|
47
|
+
- sqlite - Update to sqlite v3.42.0.
|
|
37
48
|
- python - Add python-functions db_file_load(), db_file_save().
|
|
38
49
|
- sqlmath - Revamp how js-arraybuffers are passed to c-api without copying.
|
|
39
50
|
- python - Revamp python-c-extension to support cp312.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
# Status
|
|
5
|
-
| Branch | [master<br>(v2024.
|
|
5
|
+
| Branch | [master<br>(v2024.5.26)](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
6
|
|--:|:--:|:--:|:--:|
|
|
7
7
|
| 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
8
|
| 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) |
|
|
@@ -106,7 +106,6 @@ PORT=8080 sh jslint_ci.sh shHttpFileServer
|
|
|
106
106
|
# License
|
|
107
107
|
- [sqlite](https://github.com/sqlite/sqlite) is under [public domain](https://www.sqlite.org/copyright.html).
|
|
108
108
|
- [jslint](https://github.com/jslint-org/jslint) is under [Unlicense License](https://github.com/jslint-org/jslint/blob/master/LICENSE).
|
|
109
|
-
- [pcre2](https://github.com/PCRE2Project/pcre2) is under [3-Clause BSD License](https://github.com/PCRE2Project/pcre2/blob/pcre2-10.42/LICENCE)
|
|
110
109
|
- [zlib](https://github.com/madler/zlib) is under [zlib License](https://github.com/madler/zlib/blob/v1.2.13/LICENSE).
|
|
111
110
|
- [cpplint.py](cpplint.py) is under [3-Clause BSD License](https://github.com/cpplint/cpplint/blob/1.5.5/LICENSE).
|
|
112
111
|
- [indent.exe](indent.exe) is under [GPLv3 License](https://www.gnu.org/licenses/gpl-3.0.txt).
|
|
@@ -122,11 +121,11 @@ PORT=8080 sh jslint_ci.sh shHttpFileServer
|
|
|
122
121
|
```shell
|
|
123
122
|
python -m build
|
|
124
123
|
#
|
|
125
|
-
twine upload --repository testpypi dist/sqlmath-2024.
|
|
126
|
-
py -m pip install --index-url https://test.pypi.org/simple/ sqlmath==2024.
|
|
124
|
+
twine upload --repository testpypi dist/sqlmath-2024.5.26*
|
|
125
|
+
py -m pip install --index-url https://test.pypi.org/simple/ sqlmath==2024.5.26
|
|
127
126
|
#
|
|
128
|
-
twine upload dist/sqlmath-2024.
|
|
129
|
-
pip install sqlmath==2024.
|
|
127
|
+
twine upload dist/sqlmath-2024.5.26*
|
|
128
|
+
pip install sqlmath==2024.5.26
|
|
130
129
|
```
|
|
131
130
|
|
|
132
131
|
|
|
@@ -134,13 +133,16 @@ pip install sqlmath==2024.3.25
|
|
|
134
133
|
### sqlite upgrade
|
|
135
134
|
- goto https://www.sqlite.org/changes.html
|
|
136
135
|
```shell
|
|
137
|
-
curl -L https://www.sqlite.org/2023/sqlite-autoconf-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
curl -L https://www.sqlite.org/2023/sqlite-autoconf-3440200.tar.gz | tar -xz
|
|
137
|
+
mv sqlite-autoconf-3440200 .sqlite-autoconf-3440200
|
|
138
|
+
git grep "3\.42\.0\|3420000"
|
|
139
|
+
for FILE in .ci.sh sqlmath_external_sqlite.c sqlmath_external_zlib.c
|
|
140
140
|
do
|
|
141
|
-
sed -i -e "s|\<3\.
|
|
142
|
-
sed -i -e "s|\<
|
|
141
|
+
sed -i -e "s|\<3\.42\.0\>|3.44.2|g" "$FILE"
|
|
142
|
+
sed -i -e "s|\<3420000\>|3440200|g" "$FILE"
|
|
143
143
|
done
|
|
144
|
-
git grep "3\.
|
|
145
|
-
shRollupFetch
|
|
144
|
+
git grep "3\.42\.0\|3420000"
|
|
145
|
+
shRollupFetch sqlmath_external_sqlite.c
|
|
146
|
+
shRollupFetch sqlmath_external_zlib.c
|
|
147
|
+
sh jslint_ci.sh shSqlmathUpdate
|
|
146
148
|
```
|
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 = "v2024.
|
|
166
|
+
let jslint_edition = "v2024.4.1-beta";
|
|
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.
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"engines": {
|
|
12
12
|
"node": ">=14"
|
|
13
13
|
},
|
|
14
|
-
"fileCount":
|
|
14
|
+
"fileCount": 41,
|
|
15
15
|
"homepage": "https://github.com/sqlmath/sqlmath",
|
|
16
16
|
"keywords": [
|
|
17
17
|
"data-science",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
|
-
"url": "https://github.com/sqlmath/sqlmath.git"
|
|
32
|
+
"url": "git+https://github.com/sqlmath/sqlmath.git"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "sh jslint_ci.sh shCiBuildNodejs",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
},
|
|
39
39
|
"shCiArtifactUpload": 1,
|
|
40
40
|
"shCiPublishNpm": 1,
|
|
41
|
-
"version": "2024.
|
|
41
|
+
"version": "2024.5.26"
|
|
42
42
|
}
|
package/sqlmath.mjs
CHANGED
|
@@ -92,6 +92,7 @@ let debugInline = (function () {
|
|
|
92
92
|
}());
|
|
93
93
|
let moduleChildProcess;
|
|
94
94
|
let moduleChildProcessSpawn;
|
|
95
|
+
let moduleCrypto;
|
|
95
96
|
let moduleFs;
|
|
96
97
|
let moduleFsInitResolveList;
|
|
97
98
|
let modulePath;
|
|
@@ -104,7 +105,7 @@ let {
|
|
|
104
105
|
let sqlMessageDict = {}; // dict of web-worker-callbacks
|
|
105
106
|
let sqlMessageId = 0;
|
|
106
107
|
let sqlWorker;
|
|
107
|
-
let version = "v2024.
|
|
108
|
+
let version = "v2024.5.26";
|
|
108
109
|
|
|
109
110
|
async function assertErrorThrownAsync(asyncFunc, regexp) {
|
|
110
111
|
|
|
@@ -341,7 +342,6 @@ async function ciBuildExt1NodejsConfigure({
|
|
|
341
342
|
],
|
|
342
343
|
"sources": [
|
|
343
344
|
"sqlmath_base.c",
|
|
344
|
-
"sqlmath_external_pcre2.c",
|
|
345
345
|
"sqlmath_external_sqlite.c",
|
|
346
346
|
"sqlmath_external_zlib.c"
|
|
347
347
|
],
|
|
@@ -626,14 +626,59 @@ async function dbCloseAsync(db) {
|
|
|
626
626
|
}));
|
|
627
627
|
}
|
|
628
628
|
|
|
629
|
+
async function dbExecAndReturnFirstRow({
|
|
630
|
+
bindList = [],
|
|
631
|
+
db,
|
|
632
|
+
sql
|
|
633
|
+
}) {
|
|
634
|
+
|
|
635
|
+
// This function will exec <sql> in <db>,
|
|
636
|
+
// and return first-row or empty-object.
|
|
637
|
+
|
|
638
|
+
return (
|
|
639
|
+
noop(
|
|
640
|
+
noop(
|
|
641
|
+
await dbExecAsync({
|
|
642
|
+
bindList,
|
|
643
|
+
db,
|
|
644
|
+
sql
|
|
645
|
+
})
|
|
646
|
+
)[0]
|
|
647
|
+
|| []
|
|
648
|
+
)[0]
|
|
649
|
+
|| {}
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
async function dbExecAndReturnFirstTable({
|
|
654
|
+
bindList = [],
|
|
655
|
+
db,
|
|
656
|
+
sql
|
|
657
|
+
}) {
|
|
658
|
+
|
|
659
|
+
// This function will exec <sql> in <db>,
|
|
660
|
+
// and return first-table or empty-list.
|
|
661
|
+
|
|
662
|
+
return (
|
|
663
|
+
noop(
|
|
664
|
+
await dbExecAsync({
|
|
665
|
+
bindList,
|
|
666
|
+
db,
|
|
667
|
+
sql
|
|
668
|
+
})
|
|
669
|
+
)[0]
|
|
670
|
+
|| []
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
|
|
629
674
|
function dbExecAndReturnLastBlobAsync({
|
|
630
675
|
bindList = [],
|
|
631
676
|
db,
|
|
632
677
|
sql
|
|
633
678
|
}) {
|
|
634
679
|
|
|
635
|
-
// This function will exec <sql> in <db
|
|
636
|
-
// from execution as raw blob/buffer.
|
|
680
|
+
// This function will exec <sql> in <db>,
|
|
681
|
+
// and return last-value retrieved from execution as raw blob/buffer.
|
|
637
682
|
|
|
638
683
|
return dbExecAsync({
|
|
639
684
|
bindList,
|
|
@@ -743,6 +788,25 @@ async function dbFileLoadAsync({
|
|
|
743
788
|
|
|
744
789
|
// This function will load <filename> to <db>.
|
|
745
790
|
|
|
791
|
+
let filename2;
|
|
792
|
+
async function _dbFileLoad() {
|
|
793
|
+
dbData = await dbCallAsync(
|
|
794
|
+
jsbatonCreate("_dbFileLoad"),
|
|
795
|
+
[
|
|
796
|
+
// 0. sqlite3 * pInMemory
|
|
797
|
+
db,
|
|
798
|
+
// 1. char *zFilename
|
|
799
|
+
filename,
|
|
800
|
+
// 2. const int isSave
|
|
801
|
+
modeSave,
|
|
802
|
+
// 3. undefined
|
|
803
|
+
undefined,
|
|
804
|
+
// 4. dbData - same position as dbOpenAsync
|
|
805
|
+
dbData
|
|
806
|
+
],
|
|
807
|
+
"modeDb"
|
|
808
|
+
);
|
|
809
|
+
}
|
|
746
810
|
if (modeNoop) {
|
|
747
811
|
return;
|
|
748
812
|
}
|
|
@@ -753,22 +817,22 @@ async function dbFileLoadAsync({
|
|
|
753
817
|
typeof filename === "string" && filename,
|
|
754
818
|
`invalid filename ${filename}`
|
|
755
819
|
);
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
820
|
+
// Save to tmpfile and then atomically-rename to actual-filename.
|
|
821
|
+
if (moduleFs && modeSave) {
|
|
822
|
+
filename2 = filename;
|
|
823
|
+
filename = modulePath.join(
|
|
824
|
+
modulePath.dirname(filename),
|
|
825
|
+
`.dbFileSaveAsync.${moduleCrypto.randomUUID()}`
|
|
826
|
+
);
|
|
827
|
+
try {
|
|
828
|
+
await _dbFileLoad();
|
|
829
|
+
await moduleFs.promises.rename(filename, filename2);
|
|
830
|
+
} finally {
|
|
831
|
+
await moduleFs.promises.unlink(filename).catch(noop);
|
|
832
|
+
}
|
|
833
|
+
} else {
|
|
834
|
+
await _dbFileLoad();
|
|
835
|
+
}
|
|
772
836
|
return dbData[1 + 0];
|
|
773
837
|
}
|
|
774
838
|
|
|
@@ -1431,6 +1495,13 @@ function jsonRowListFromCsv({
|
|
|
1431
1495
|
return rowList;
|
|
1432
1496
|
}
|
|
1433
1497
|
|
|
1498
|
+
function listOrEmptyList(list) {
|
|
1499
|
+
|
|
1500
|
+
// This function will return <list> or empty-list if falsy.
|
|
1501
|
+
|
|
1502
|
+
return list || [];
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1434
1505
|
async function moduleFsInit() {
|
|
1435
1506
|
|
|
1436
1507
|
// This function will import nodejs builtin-modules if they have not yet been
|
|
@@ -1455,11 +1526,13 @@ async function moduleFsInit() {
|
|
|
1455
1526
|
moduleFsInitResolveList = [];
|
|
1456
1527
|
[
|
|
1457
1528
|
moduleChildProcess,
|
|
1529
|
+
moduleCrypto,
|
|
1458
1530
|
moduleFs,
|
|
1459
1531
|
modulePath,
|
|
1460
1532
|
moduleUrl
|
|
1461
1533
|
] = await Promise.all([
|
|
1462
1534
|
import("child_process"),
|
|
1535
|
+
import("crypto"),
|
|
1463
1536
|
import("fs"),
|
|
1464
1537
|
import("path"),
|
|
1465
1538
|
import("url")
|
|
@@ -1623,6 +1696,15 @@ function sqlmathWebworkerInit({
|
|
|
1623
1696
|
}
|
|
1624
1697
|
}
|
|
1625
1698
|
|
|
1699
|
+
function waitAsync(timeout) {
|
|
1700
|
+
|
|
1701
|
+
// This function will wait <timeout> ms.
|
|
1702
|
+
|
|
1703
|
+
return new Promise(function (resolve) {
|
|
1704
|
+
setTimeout(resolve, timeout * !npm_config_mode_test);
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1626
1708
|
sqlmathInit(); // coverage-hack
|
|
1627
1709
|
await sqlmathInit();
|
|
1628
1710
|
sqlmathInit(); // coverage-hack
|
|
@@ -1657,6 +1739,8 @@ export {
|
|
|
1657
1739
|
childProcessSpawn2,
|
|
1658
1740
|
ciBuildExt,
|
|
1659
1741
|
dbCloseAsync,
|
|
1742
|
+
dbExecAndReturnFirstRow,
|
|
1743
|
+
dbExecAndReturnFirstTable,
|
|
1660
1744
|
dbExecAndReturnLastBlobAsync,
|
|
1661
1745
|
dbExecAsync,
|
|
1662
1746
|
dbFileLoadAsync,
|
|
@@ -1671,8 +1755,10 @@ export {
|
|
|
1671
1755
|
fsWriteFileUnlessTest,
|
|
1672
1756
|
jsbatonGetInt64,
|
|
1673
1757
|
jsbatonGetString,
|
|
1758
|
+
listOrEmptyList,
|
|
1674
1759
|
noop,
|
|
1675
1760
|
objectDeepCopyWithKeysSorted,
|
|
1676
1761
|
sqlmathWebworkerInit,
|
|
1677
|
-
version
|
|
1762
|
+
version,
|
|
1763
|
+
waitAsync
|
|
1678
1764
|
};
|