alasql 4.12.0 → 4.13.0
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/dist/alasql-worker.js +2 -2
- package/dist/alasql.fs.js +46 -7
- package/dist/alasql.js +46 -7
- package/dist/alasql.min.js +31 -31
- package/package.json +1 -1
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.
|
|
1
|
+
//! AlaSQL v4.12.0 build: develop-3626bf8c | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.
|
|
4
|
+
@version 4.12.0
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2025 Andrey Gershun & Mathias Wulff
|
package/dist/alasql.fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.
|
|
1
|
+
//! AlaSQL v4.12.0 build: develop-3626bf8c | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.
|
|
4
|
+
@version 4.12.0
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2025 Andrey Gershun & Mathias Wulff
|
|
@@ -141,8 +141,8 @@ SOFTWARE.
|
|
|
141
141
|
Current version of alasql
|
|
142
142
|
@constant {string}
|
|
143
143
|
*/
|
|
144
|
-
alasql.version = '4.
|
|
145
|
-
alasql.build = 'develop-
|
|
144
|
+
alasql.version = '4.12.0';
|
|
145
|
+
alasql.build = 'develop-3626bf8c';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -15113,7 +15113,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15113
15113
|
|
|
15114
15114
|
if (db.engineid && alasql.engines[db.engineid].intoTable && alasql.options.autocommit) {
|
|
15115
15115
|
var statement = function (params, cb) {
|
|
15116
|
-
var aa = new Function('db,params', 'var y;' + s33 + 'return aa;')(db, params);
|
|
15116
|
+
var aa = new Function('db,params,alasql', 'var y;' + s33 + 'return aa;')(db, params, alasql);
|
|
15117
15117
|
|
|
15118
15118
|
var res = alasql.engines[db.engineid].intoTable(db.databaseid, tableid, aa, null, cb);
|
|
15119
15119
|
// if(cb) cb(res);
|
|
@@ -17897,6 +17897,35 @@ alasql.from.RANGE = function (start, finish, cb, idx, query) {
|
|
|
17897
17897
|
return res;
|
|
17898
17898
|
};
|
|
17899
17899
|
|
|
17900
|
+
/**
|
|
17901
|
+
* UNNEST function - converts an array into a table for use in FROM clauses
|
|
17902
|
+
*
|
|
17903
|
+
* This function enables flattening of nested arrays when used with CROSS APPLY or OUTER APPLY.
|
|
17904
|
+
*
|
|
17905
|
+
* @param {Array} arr - The array to unnest
|
|
17906
|
+
* @param {Object} opts - Options (reserved for future use)
|
|
17907
|
+
* @param {Function} cb - Callback function
|
|
17908
|
+
* @param {number} idx - Index
|
|
17909
|
+
* @param {Object} query - Query object
|
|
17910
|
+
* @returns {Array} The input array, or empty array if input is not an array
|
|
17911
|
+
*
|
|
17912
|
+
* @example
|
|
17913
|
+
* // Flatten nested arrays
|
|
17914
|
+
* SELECT b.name, e.id, e.value
|
|
17915
|
+
* FROM data AS b
|
|
17916
|
+
* CROSS APPLY (SELECT * FROM UNNEST(b.entries)) AS e
|
|
17917
|
+
*/
|
|
17918
|
+
alasql.from.UNNEST = function (arr, opts, cb, idx, query) {
|
|
17919
|
+
var res = arr;
|
|
17920
|
+
if (!Array.isArray(res)) {
|
|
17921
|
+
res = [];
|
|
17922
|
+
}
|
|
17923
|
+
if (cb) {
|
|
17924
|
+
res = cb(res, idx, query);
|
|
17925
|
+
}
|
|
17926
|
+
return res;
|
|
17927
|
+
};
|
|
17928
|
+
|
|
17900
17929
|
// Read data from any file
|
|
17901
17930
|
alasql.from.FILE = function (filename, opts, cb, idx, query) {
|
|
17902
17931
|
var fname;
|
|
@@ -19205,6 +19234,8 @@ LS.storeTable = function (databaseid, tableid) {
|
|
|
19205
19234
|
tbl.columns = table.columns;
|
|
19206
19235
|
tbl.data = table.data;
|
|
19207
19236
|
tbl.identities = table.identities;
|
|
19237
|
+
tbl.defaultfns = table.defaultfns;
|
|
19238
|
+
tbl.onupdatefns = table.onupdatefns;
|
|
19208
19239
|
// TODO: May be add indexes, objects and other fields?
|
|
19209
19240
|
LS.set(db.lsdbid + '.' + tableid, tbl);
|
|
19210
19241
|
};
|
|
@@ -19821,7 +19852,11 @@ FS.createTable = function (databaseid, tableid, ifnotexists, cb) {
|
|
|
19821
19852
|
throw new Error('Table "' + tableid + '" alsready exists in the database "' + fsdbid + '"');
|
|
19822
19853
|
}
|
|
19823
19854
|
var table = alasql.databases[databaseid].tables[tableid];
|
|
19824
|
-
db.data.tables[tableid] = {
|
|
19855
|
+
db.data.tables[tableid] = {
|
|
19856
|
+
columns: table.columns,
|
|
19857
|
+
defaultfns: table.defaultfns,
|
|
19858
|
+
onupdatefns: table.onupdatefns,
|
|
19859
|
+
};
|
|
19825
19860
|
db.data[tableid] = [];
|
|
19826
19861
|
|
|
19827
19862
|
FS.updateFile(databaseid);
|
|
@@ -19900,7 +19935,11 @@ FS.commit = function (databaseid, cb) {
|
|
|
19900
19935
|
var fsdb = {tables: {}};
|
|
19901
19936
|
if (db.tables) {
|
|
19902
19937
|
for (var tbid in db.tables) {
|
|
19903
|
-
db.data.tables[tbid] = {
|
|
19938
|
+
db.data.tables[tbid] = {
|
|
19939
|
+
columns: db.tables[tbid].columns,
|
|
19940
|
+
defaultfns: db.tables[tbid].defaultfns,
|
|
19941
|
+
onupdatefns: db.tables[tbid].onupdatefns,
|
|
19942
|
+
};
|
|
19904
19943
|
db.data[tbid] = db.tables[tbid].data;
|
|
19905
19944
|
}
|
|
19906
19945
|
}
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.
|
|
1
|
+
//! AlaSQL v4.12.0 build: develop-3626bf8c | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.
|
|
4
|
+
@version 4.12.0
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2025 Andrey Gershun & Mathias Wulff
|
|
@@ -141,8 +141,8 @@ SOFTWARE.
|
|
|
141
141
|
Current version of alasql
|
|
142
142
|
@constant {string}
|
|
143
143
|
*/
|
|
144
|
-
alasql.version = '4.
|
|
145
|
-
alasql.build = 'develop-
|
|
144
|
+
alasql.version = '4.12.0';
|
|
145
|
+
alasql.build = 'develop-3626bf8c';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -15113,7 +15113,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
15113
15113
|
|
|
15114
15114
|
if (db.engineid && alasql.engines[db.engineid].intoTable && alasql.options.autocommit) {
|
|
15115
15115
|
var statement = function (params, cb) {
|
|
15116
|
-
var aa = new Function('db,params', 'var y;' + s33 + 'return aa;')(db, params);
|
|
15116
|
+
var aa = new Function('db,params,alasql', 'var y;' + s33 + 'return aa;')(db, params, alasql);
|
|
15117
15117
|
|
|
15118
15118
|
var res = alasql.engines[db.engineid].intoTable(db.databaseid, tableid, aa, null, cb);
|
|
15119
15119
|
// if(cb) cb(res);
|
|
@@ -17897,6 +17897,35 @@ alasql.from.RANGE = function (start, finish, cb, idx, query) {
|
|
|
17897
17897
|
return res;
|
|
17898
17898
|
};
|
|
17899
17899
|
|
|
17900
|
+
/**
|
|
17901
|
+
* UNNEST function - converts an array into a table for use in FROM clauses
|
|
17902
|
+
*
|
|
17903
|
+
* This function enables flattening of nested arrays when used with CROSS APPLY or OUTER APPLY.
|
|
17904
|
+
*
|
|
17905
|
+
* @param {Array} arr - The array to unnest
|
|
17906
|
+
* @param {Object} opts - Options (reserved for future use)
|
|
17907
|
+
* @param {Function} cb - Callback function
|
|
17908
|
+
* @param {number} idx - Index
|
|
17909
|
+
* @param {Object} query - Query object
|
|
17910
|
+
* @returns {Array} The input array, or empty array if input is not an array
|
|
17911
|
+
*
|
|
17912
|
+
* @example
|
|
17913
|
+
* // Flatten nested arrays
|
|
17914
|
+
* SELECT b.name, e.id, e.value
|
|
17915
|
+
* FROM data AS b
|
|
17916
|
+
* CROSS APPLY (SELECT * FROM UNNEST(b.entries)) AS e
|
|
17917
|
+
*/
|
|
17918
|
+
alasql.from.UNNEST = function (arr, opts, cb, idx, query) {
|
|
17919
|
+
var res = arr;
|
|
17920
|
+
if (!Array.isArray(res)) {
|
|
17921
|
+
res = [];
|
|
17922
|
+
}
|
|
17923
|
+
if (cb) {
|
|
17924
|
+
res = cb(res, idx, query);
|
|
17925
|
+
}
|
|
17926
|
+
return res;
|
|
17927
|
+
};
|
|
17928
|
+
|
|
17900
17929
|
// Read data from any file
|
|
17901
17930
|
alasql.from.FILE = function (filename, opts, cb, idx, query) {
|
|
17902
17931
|
var fname;
|
|
@@ -19205,6 +19234,8 @@ LS.storeTable = function (databaseid, tableid) {
|
|
|
19205
19234
|
tbl.columns = table.columns;
|
|
19206
19235
|
tbl.data = table.data;
|
|
19207
19236
|
tbl.identities = table.identities;
|
|
19237
|
+
tbl.defaultfns = table.defaultfns;
|
|
19238
|
+
tbl.onupdatefns = table.onupdatefns;
|
|
19208
19239
|
// TODO: May be add indexes, objects and other fields?
|
|
19209
19240
|
LS.set(db.lsdbid + '.' + tableid, tbl);
|
|
19210
19241
|
};
|
|
@@ -19821,7 +19852,11 @@ FS.createTable = function (databaseid, tableid, ifnotexists, cb) {
|
|
|
19821
19852
|
throw new Error('Table "' + tableid + '" alsready exists in the database "' + fsdbid + '"');
|
|
19822
19853
|
}
|
|
19823
19854
|
var table = alasql.databases[databaseid].tables[tableid];
|
|
19824
|
-
db.data.tables[tableid] = {
|
|
19855
|
+
db.data.tables[tableid] = {
|
|
19856
|
+
columns: table.columns,
|
|
19857
|
+
defaultfns: table.defaultfns,
|
|
19858
|
+
onupdatefns: table.onupdatefns,
|
|
19859
|
+
};
|
|
19825
19860
|
db.data[tableid] = [];
|
|
19826
19861
|
|
|
19827
19862
|
FS.updateFile(databaseid);
|
|
@@ -19900,7 +19935,11 @@ FS.commit = function (databaseid, cb) {
|
|
|
19900
19935
|
var fsdb = {tables: {}};
|
|
19901
19936
|
if (db.tables) {
|
|
19902
19937
|
for (var tbid in db.tables) {
|
|
19903
|
-
db.data.tables[tbid] = {
|
|
19938
|
+
db.data.tables[tbid] = {
|
|
19939
|
+
columns: db.tables[tbid].columns,
|
|
19940
|
+
defaultfns: db.tables[tbid].defaultfns,
|
|
19941
|
+
onupdatefns: db.tables[tbid].onupdatefns,
|
|
19942
|
+
};
|
|
19904
19943
|
db.data[tbid] = db.tables[tbid].data;
|
|
19905
19944
|
}
|
|
19906
19945
|
}
|