sqlmath 2026.2.28 → 2026.3.1

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 CHANGED
@@ -5,6 +5,12 @@
5
5
  - sqlite - Add similar error-handling from builtin-sql-function PERCENTILE() into custom-sql-function QUANTILE().
6
6
  - none
7
7
 
8
+ # v2026.3.1
9
+ - sqlmath-python - bugfix - Fix 762-character-limit SQL-string-bug in python-function db_exec().
10
+ - jslint-ci - Update shell-function shLintPython().
11
+ - python - Auto-detect-and-load lib_lightgbm.dll.
12
+ - sqlite - Add sqlite-extension csv.c, tsv.c.
13
+
8
14
  # v2026.2.28
9
15
  - python-ci - Fix ruff lint-errors.
10
16
  - jslint-ci - Update shell-function shCiBase() to check npm-version-support, before running npm-pkg-fix.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
  # Status
5
- | Branch | [master<br>(v2026.2.28)](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) |
5
+ | Branch | [master<br>(v2026.3.1)](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 | [![ci](https://github.com/sqlmath/sqlmath/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/sqlmath/sqlmath/actions?query=branch%3Amaster) | [![ci](https://github.com/sqlmath/sqlmath/actions/workflows/ci.yml/badge.svg?branch=beta)](https://github.com/sqlmath/sqlmath/actions?query=branch%3Abeta) | [![ci](https://github.com/sqlmath/sqlmath/actions/workflows/ci.yml/badge.svg?branch=alpha)](https://github.com/sqlmath/sqlmath/actions?query=branch%3Aalpha) |
8
8
  | Coverage | [![coverage](https://sqlmath.github.io/sqlmath/branch-master/.artifact/coverage/coverage_badge.svg)](https://sqlmath.github.io/sqlmath/branch-master/.artifact/coverage/index.html) | [![coverage](https://sqlmath.github.io/sqlmath/branch-beta/.artifact/coverage/coverage_badge.svg)](https://sqlmath.github.io/sqlmath/branch-beta/.artifact/coverage/index.html) | [![coverage](https://sqlmath.github.io/sqlmath/branch-alpha/.artifact/coverage/coverage_badge.svg)](https://sqlmath.github.io/sqlmath/branch-alpha/.artifact/coverage/index.html) |
@@ -121,11 +121,11 @@ PORT=8080 sh jslint_ci.sh shHttpFileServer
121
121
  ```shell
122
122
  python -m build
123
123
  #
124
- twine upload --repository testpypi dist/sqlmath-2026.2.28*
125
- py -m pip install --index-url https://test.pypi.org/simple/ sqlmath==2026.2.28
124
+ twine upload --repository testpypi dist/sqlmath-2026.3.1*
125
+ py -m pip install --index-url https://test.pypi.org/simple/ sqlmath==2026.3.1
126
126
  #
127
- twine upload dist/sqlmath-2026.2.28*
128
- pip install sqlmath==2026.2.28
127
+ twine upload dist/sqlmath-2026.3.1*
128
+ pip install sqlmath==2026.3.1
129
129
  ```
130
130
 
131
131
 
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
Binary file
Binary file
Binary file
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.2.28";
166
+ let jslint_edition = "v2026.3.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
@@ -32,5 +32,5 @@
32
32
  },
33
33
  "shCiArtifactUpload": 1,
34
34
  "shCiPublishNpm": 1,
35
- "version": "2026.2.28"
35
+ "version": "2026.3.1"
36
36
  }
package/sqlmath.mjs CHANGED
@@ -50,14 +50,14 @@ const SQLITE_RESPONSETYPE_LASTVALUE = 2;
50
50
 
51
51
  const FILENAME_DBTMP = "/tmp/__dbtmp1"; //jslint-ignore-line
52
52
 
53
- const LGBM_DTYPE_FLOAT32 = 0; /* float32 (single precision float)*/
54
- const LGBM_DTYPE_FLOAT64 = 1; /* float64 (double precision float)*/
55
- const LGBM_DTYPE_INT32 = 2; /* int32*/
56
- const LGBM_DTYPE_INT64 = 3; /* int64*/
53
+ const LGBM_DTYPE_FLOAT32 = 0; /* float32 (single precision float)*/
54
+ const LGBM_DTYPE_FLOAT64 = 1; /* float64 (double precision float)*/
55
+ const LGBM_DTYPE_INT32 = 2; /* int32*/
56
+ const LGBM_DTYPE_INT64 = 3; /* int64*/
57
57
  const LGBM_FEATURE_IMPORTANCE_GAIN = 1; /* Gain type of feature importance*/
58
58
  const LGBM_FEATURE_IMPORTANCE_SPLIT = 0;/* Split type of feature importance*/
59
- const LGBM_MATRIX_TYPE_CSC = 1; /* CSC sparse matrix type*/
60
- const LGBM_MATRIX_TYPE_CSR = 0; /* CSR sparse matrix type*/
59
+ const LGBM_MATRIX_TYPE_CSC = 1; /* CSC sparse matrix type*/
60
+ const LGBM_MATRIX_TYPE_CSR = 0; /* CSR sparse matrix type*/
61
61
  const LGBM_PREDICT_CONTRIB = 3; /* Predict feature contributions (SHAP values)*/
62
62
  const LGBM_PREDICT_LEAF_INDEX = 2; /* Predict leaf index*/
63
63
  const LGBM_PREDICT_NORMAL = 0; /* Normal prediction w/ transform (if needed)*/
@@ -87,7 +87,7 @@ const SQLITE_OPEN_WAL = 0x00080000; /* VFS only */
87
87
  let DB_EXEC_PROFILE_DICT = {};
88
88
  let DB_EXEC_PROFILE_MODE;
89
89
  let DB_EXEC_PROFILE_SQL_LENGTH;
90
- let DB_OPEN_INIT;
90
+ let DB_STATE = {};
91
91
  let IS_BROWSER;
92
92
  let SQLMATH_EXE;
93
93
  let SQLMATH_NODE;
@@ -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.2.28";
131
+ let version = "v2026.3.1";
132
132
 
133
133
  async function assertErrorThrownAsync(asyncFunc, regexp) {
134
134
 
@@ -1017,7 +1017,6 @@ async function dbOpenAsync({
1017
1017
  // );
1018
1018
  let connPool;
1019
1019
  let db = {busy: 0, filename, ii: 0};
1020
- let libLgbm;
1021
1020
  assertOrThrow(typeof filename === "string", `invalid filename ${filename}`);
1022
1021
  assertOrThrow(
1023
1022
  !dbData || isExternalBuffer(dbData),
@@ -1048,21 +1047,37 @@ async function dbOpenAsync({
1048
1047
  return ptr;
1049
1048
  }));
1050
1049
  db.connPool = connPool;
1051
- if (!IS_BROWSER && !DB_OPEN_INIT) {
1052
- DB_OPEN_INIT = true;
1053
- // init lgbm
1054
- libLgbm = process.platform;
1055
- libLgbm = libLgbm.replace("darwin", "lib_lightgbm.dylib");
1056
- libLgbm = libLgbm.replace("win32", "lib_lightgbm.dll");
1057
- libLgbm = libLgbm.replace(process.platform, "lib_lightgbm.so");
1058
- libLgbm = `${import.meta.dirname}/sqlmath/${libLgbm}`;
1059
- await dbExecAsync({
1060
- db,
1061
- sql: (`
1050
+ if (!IS_BROWSER && !DB_STATE.init) {
1051
+ DB_STATE.init = true;
1052
+ await Promise.all([
1053
+ // PRAGMA busy_timeout
1054
+ dbExecAsync({
1055
+ db,
1056
+ sql: (`
1062
1057
  PRAGMA busy_timeout = ${timeoutBusy};
1058
+ `)
1059
+ }),
1060
+ // LGBM_DLOPEN
1061
+ (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");
1067
+ libLgbm = `${import.meta.dirname}/sqlmath/${libLgbm}`;
1068
+ await moduleFs.promises.access(
1069
+ libLgbm
1070
+ ).then(async function () {
1071
+ await dbExecAsync({
1072
+ db,
1073
+ sql: (`
1063
1074
  SELECT LGBM_DLOPEN('${libLgbm}');
1064
- `)
1065
- });
1075
+ `)
1076
+ });
1077
+ DB_STATE.lgbm = true;
1078
+ }).catch(noop);
1079
+ }())
1080
+ ]);
1066
1081
  }
1067
1082
  return db;
1068
1083
  }
@@ -1075,7 +1090,7 @@ async function dbTableImportAsync({
1075
1090
  tableName,
1076
1091
  textData
1077
1092
  }) {
1078
- // this function will create table from imported csv/json <textData>
1093
+ // This function will create table from imported csv/json <textData>.
1079
1094
  let colList;
1080
1095
  let rowList;
1081
1096
  let rowidList;
@@ -1516,7 +1531,7 @@ function jsonParseArraybuffer(buf) {
1516
1531
  function jsonRowListFromCsv({
1517
1532
  csv
1518
1533
  }) {
1519
- // this function will convert <csv>-text to json list-of-list
1534
+ // This function will convert <csv>-text to json list-of-list.
1520
1535
  //
1521
1536
  // https://tools.ietf.org/html/rfc4180#section-2
1522
1537
  // Definition of the CSV Format
@@ -1901,6 +1916,7 @@ sqlmathInit(); // coverage-hack
1901
1916
 
1902
1917
  export {
1903
1918
  DB_EXEC_PROFILE_DICT,
1919
+ DB_STATE,
1904
1920
  LGBM_DTYPE_FLOAT32,
1905
1921
  LGBM_DTYPE_FLOAT64,
1906
1922
  LGBM_DTYPE_INT32,
package/test.mjs CHANGED
@@ -1108,30 +1108,20 @@ UPDATE __lgbm_state
1108
1108
  `);
1109
1109
  async function testLgbm(sqlDataXxx, sqlTrainXxx, sqlPredictXxx, sqlIi) {
1110
1110
  let db = await dbOpenAsync({});
1111
- let fileActual = `.tmp/test_lgbm_preb_${sqlIi}.txt`;
1111
+ let fileActual = `.tmp/test_lgbm_preb_${sqlIi}.js.txt`;
1112
1112
  await Promise.all([
1113
- dbTableImportAsync({
1113
+ [filePreb, "__lgbm_file_preb"],
1114
+ [fileTest, "__lgbm_file_test"],
1115
+ [fileTrain, "__lgbm_file_train"]
1116
+ ].map(async function ([filename, tableName]) {
1117
+ await dbTableImportAsync({
1114
1118
  db,
1115
- filename: filePreb,
1119
+ filename,
1116
1120
  headerMissing: true,
1117
1121
  mode: "tsv",
1118
- tableName: "__lgbm_file_preb"
1119
- }),
1120
- dbTableImportAsync({
1121
- db,
1122
- filename: fileTest,
1123
- headerMissing: true,
1124
- mode: "tsv",
1125
- tableName: "__lgbm_file_test"
1126
- }),
1127
- dbTableImportAsync({
1128
- db,
1129
- filename: fileTrain,
1130
- headerMissing: true,
1131
- mode: "tsv",
1132
- tableName: "__lgbm_file_train"
1133
- })
1134
- ]);
1122
+ tableName
1123
+ });
1124
+ }));
1135
1125
  await dbExecAsync({
1136
1126
  db,
1137
1127
  sql: (`
@@ -1186,7 +1176,7 @@ SELECT
1186
1176
  }
1187
1177
  await dbFileSaveAsync({
1188
1178
  db,
1189
- filename: `.tmp/test_lgbm_${sqlIi}.sqlite`
1179
+ filename: `.tmp/test_lgbm_${sqlIi}.js.sqlite`
1190
1180
  });
1191
1181
  assertJsonEqual(
1192
1182
  noop(