alasql 1.7.3 → 1.7.5
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-worker.min.js +1 -1
- package/dist/alasql.fs.js +35 -34
- package/dist/alasql.js +35 -34
- package/dist/alasql.min.js +2 -2
- package/package/dist/alasql-echo.js +20 -0
- package/package/dist/alasql-prolog.js +51 -0
- package/package/dist/alasql-worker.js +245 -0
- package/package/dist/alasql-worker.min.js +2 -0
- package/package/dist/alasql.d.ts +88 -0
- package/package/dist/alasql.fs.js +19728 -0
- package/package/dist/alasql.js +19723 -0
- package/package/dist/alasql.min.js +2 -0
- package/package.json +11 -3
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v1.7.
|
|
1
|
+
//! AlaSQL v1.7.5-v1-hotfix-95227342undefined | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 1.7.
|
|
4
|
+
@version 1.7.5-v1-hotfix-95227342undefined
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
//! AlaSQL v1.7.
|
|
1
|
+
//! AlaSQL v1.7.5-v1-hotfix-95227342undefined | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
!function(r,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():r.alasql=e()}(this,function(){function i(r,e,t){"function"==typeof(e=e||[])&&(scope=t,t=e,e=[]),"object"!=typeof e&&(e=[e]);var o=i.lastid++;i.buffer[o]=t,i.webworker.postMessage({id:o,sql:r,params:e})}var s;if(i.options={},i.options.progress=function(){},isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)},i.promise=function(){throw new Error("Please include a Promise/A+ library")},"undefined"!=typeof Promise&&(s=function(r,e,n,s){return new Promise(function(t,o){i(r,e,function(r,e){e?o(e):(n&&s&&!1!==i.options.progress&&i.options.progress(n,s),t(r))})})},i.promise=function(r,e){if("undefined"==typeof Promise)throw new Error("Please include a Promise/A+ library");if("string"==typeof r)return s(r,e);if(!isArray(r)||r.length<1||void 0!==e)throw new Error("Error in .promise parameters");return function(r){if(!(r.length<1)){for(var e,t,o=[],n=0;n<r.length;n++){if("string"==typeof(t=r[n])&&(t=[t]),!isArray(t)||t.length<1||2<t.length)throw new Error("Error in .promise parameter");e=t[0],t=t[1]||void 0,o.push(s(e,t,n,r.length))}return Promise.all(o)}}(r)}),!(i=i||!1))throw new Error("alasql was not found");return i.worker=function(){throw new Error("Can find webworker in this enviroment")},"undefined"!=typeof Worker&&(i.worker=function(r,e,t){if(void 0===(r=!0===r?void 0:r))for(var o=document.getElementsByTagName("script"),n=0;n<o.length;n++){if("alasql-worker.js"===o[n].src.substr(-16).toLowerCase()){r=o[n].src.substr(0,o[n].src.length-16)+"alasql.js";break}if("alasql-worker.min.js"===o[n].src.substr(-20).toLowerCase()){r=o[n].src.substr(0,o[n].src.length-20)+"alasql.min.js";break}if("alasql.js"===o[n].src.substr(-9).toLowerCase()){r=o[n].src;break}if("alasql.min.js"===o[n].src.substr(-13).toLowerCase()){r=o[n].src.substr(0,o[n].src.length-13)+"alasql.min.js";break}}if(void 0===r)throw new Error("Path to alasql.js is not specified");var s;!1!==r?(s="importScripts('",s+=r,s+="');self.onmessage = function(event) {alasql(event.data.sql,event.data.params, function(data){postMessage({id:event.data.id, data:data});});}",s=new Blob([s],{type:"text/plain"}),i.webworker=new Worker(URL.createObjectURL(s)),i.webworker.onmessage=function(r){var e=r.data.id;i.buffer[e](r.data.data),delete i.buffer[e]},i.webworker.onerror=function(r){throw r},1<arguments.length&&i("REQUIRE "+e.map(function(r){return'"'+r+'"'}).join(","),[],t)):!1===r&&delete i.webworker}),i.lastid=0,i.buffer={},i.worker(),i});
|
package/dist/alasql.fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v1.7.
|
|
1
|
+
//! AlaSQL v1.7.5-v1-hotfix-95227342undefined | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 1.7.
|
|
4
|
+
@version 1.7.5-v1-hotfix-95227342undefined
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
|
|
@@ -142,7 +142,7 @@ var alasql = function(sql, params, cb, scope) {
|
|
|
142
142
|
Current version of alasql
|
|
143
143
|
@constant {string}
|
|
144
144
|
*/
|
|
145
|
-
alasql.version = '1.7.
|
|
145
|
+
alasql.version = '1.7.5-v1-hotfix-95227342undefined';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -9349,9 +9349,10 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9349
9349
|
|
|
9350
9350
|
if (columns && columns.length > 0) {
|
|
9351
9351
|
columns.forEach(function (tcol) {
|
|
9352
|
+
var escapedColumnId = escapeq(tcol.columnid);
|
|
9352
9353
|
if (joinstar && alasql.options.joinstar == 'underscore') {
|
|
9353
9354
|
ss.push(
|
|
9354
|
-
"'" + alias + '_' +
|
|
9355
|
+
"'" + alias + '_' + escapedColumnId + "':p['" + alias + "']['" + escapedColumnId + "']"
|
|
9355
9356
|
);
|
|
9356
9357
|
} else if (joinstar && alasql.options.joinstar == 'json') {
|
|
9357
9358
|
// ss.push('\''+alias+'_'+tcol.columnid+'\':p[\''+alias+'\'][\''+tcol.columnid+'\']');
|
|
@@ -9359,16 +9360,16 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9359
9360
|
"r['" +
|
|
9360
9361
|
alias +
|
|
9361
9362
|
"']['" +
|
|
9362
|
-
|
|
9363
|
+
escapedColumnId +
|
|
9363
9364
|
"']=p['" +
|
|
9364
9365
|
alias +
|
|
9365
9366
|
"']['" +
|
|
9366
|
-
|
|
9367
|
+
escapedColumnId +
|
|
9367
9368
|
"'];";
|
|
9368
9369
|
} else {
|
|
9369
|
-
var value = "p['" + alias + "']['" +
|
|
9370
|
+
var value = "p['" + alias + "']['" + escapedColumnId + "']";
|
|
9370
9371
|
if (!columnIds[tcol.columnid]) {
|
|
9371
|
-
var key = "'" +
|
|
9372
|
+
var key = "'" + escapedColumnId + "':";
|
|
9372
9373
|
ss.push(key + value);
|
|
9373
9374
|
columnIds[tcol.columnid] = {
|
|
9374
9375
|
id: ss.length - 1,
|
|
@@ -9407,7 +9408,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9407
9408
|
|
|
9408
9409
|
});
|
|
9409
9410
|
|
|
9410
|
-
return {s: ss.join(','), sp: sp};
|
|
9411
|
+
return { s: ss.join(','), sp: sp };
|
|
9411
9412
|
}
|
|
9412
9413
|
|
|
9413
9414
|
yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
@@ -9458,14 +9459,14 @@ yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
|
9458
9459
|
if (false && tbid && !query.defcols['.'][col.tableid] && !query.defcols[col.columnid]) {
|
|
9459
9460
|
ss.push(
|
|
9460
9461
|
"'" +
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9462
|
+
escapeq(col.as || col.columnid) +
|
|
9463
|
+
"':p['" +
|
|
9464
|
+
query.defaultTableid +
|
|
9465
|
+
"']['" +
|
|
9466
|
+
col.tableid +
|
|
9467
|
+
"']['" +
|
|
9468
|
+
col.columnid +
|
|
9469
|
+
"']"
|
|
9469
9470
|
);
|
|
9470
9471
|
} else {
|
|
9471
9472
|
// workaround for multisheet xlsx export with custom COLUMNS
|
|
@@ -9500,12 +9501,12 @@ yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
|
9500
9501
|
} else {
|
|
9501
9502
|
ss.push(
|
|
9502
9503
|
"'" +
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9504
|
+
escapeq(col.as || col.columnid) +
|
|
9505
|
+
"':p['" +
|
|
9506
|
+
tbid +
|
|
9507
|
+
"']['" +
|
|
9508
|
+
col.columnid +
|
|
9509
|
+
"']"
|
|
9509
9510
|
);
|
|
9510
9511
|
}
|
|
9511
9512
|
}
|
|
@@ -9590,9 +9591,9 @@ yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
|
9590
9591
|
) {
|
|
9591
9592
|
ss.push(
|
|
9592
9593
|
"'" +
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9594
|
+
escapeq(col.as) +
|
|
9595
|
+
"':" +
|
|
9596
|
+
n2u(col.expression.toJS('p', query.defaultTableid, query.defcols))
|
|
9596
9597
|
);
|
|
9597
9598
|
} else if (col.aggregatorid === 'COUNT') {
|
|
9598
9599
|
ss.push("'" + escapeq(col.as) + "':1");
|
|
@@ -9622,9 +9623,9 @@ yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
|
9622
9623
|
|
|
9623
9624
|
ss.push(
|
|
9624
9625
|
"'" +
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
9626
|
+
escapeq(col.as || col.columnid || col.toString()) +
|
|
9627
|
+
"':" +
|
|
9628
|
+
n2u(col.toJS('p', query.defaultTableid, query.defcols))
|
|
9628
9629
|
);
|
|
9629
9630
|
// ss.push('\''+escapeq(col.toString())+'\':'+col.toJS("p",query.defaultTableid));
|
|
9630
9631
|
//if(col instanceof yy.Expression) {
|
|
@@ -10477,8 +10478,8 @@ yy.Over.prototype.toString = function () {
|
|
|
10477
10478
|
*/
|
|
10478
10479
|
|
|
10479
10480
|
/**
|
|
10480
|
-
|
|
10481
|
-
|
|
10481
|
+
Expression statement ( = 2*2; )
|
|
10482
|
+
@class
|
|
10482
10483
|
@param {object} params Initial parameters
|
|
10483
10484
|
*/
|
|
10484
10485
|
yy.ExpressionStatement = function (params) {
|
|
@@ -10853,7 +10854,7 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
10853
10854
|
var ljs = '(' + leftJS() + '||{})';
|
|
10854
10855
|
|
|
10855
10856
|
if (typeof this.right === 'string') {
|
|
10856
|
-
s = ljs + '["' + this.right + '"]';
|
|
10857
|
+
s = ljs + '["' + escapeq(this.right) + '"]';
|
|
10857
10858
|
} else if (typeof this.right === 'number') {
|
|
10858
10859
|
s = ljs + '[' + this.right + ']';
|
|
10859
10860
|
} else if (this.right instanceof yy.FuncValue) {
|
|
@@ -11084,7 +11085,7 @@ yy.VarValue.prototype.toType = function () {
|
|
|
11084
11085
|
};
|
|
11085
11086
|
|
|
11086
11087
|
yy.VarValue.prototype.toJS = function () {
|
|
11087
|
-
return "alasql.vars['" + this.variable + "']";
|
|
11088
|
+
return "alasql.vars['" + escapeq(this.variable) + "']";
|
|
11088
11089
|
};
|
|
11089
11090
|
|
|
11090
11091
|
yy.NumValue = function (params) {
|
|
@@ -11478,7 +11479,7 @@ yy.AggrValue.prototype.toJS = function (/*context, tableid, defcols*/) {
|
|
|
11478
11479
|
|
|
11479
11480
|
var colas = this.nick;
|
|
11480
11481
|
if (colas === undefined) {
|
|
11481
|
-
colas = this.toString();
|
|
11482
|
+
colas = escapeq(this.toString());
|
|
11482
11483
|
}
|
|
11483
11484
|
return "g['" + colas + "']";
|
|
11484
11485
|
};
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v1.7.
|
|
1
|
+
//! AlaSQL v1.7.5-v1-hotfix-95227342undefined | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 1.7.
|
|
4
|
+
@version 1.7.5-v1-hotfix-95227342undefined
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
|
|
@@ -142,7 +142,7 @@ var alasql = function(sql, params, cb, scope) {
|
|
|
142
142
|
Current version of alasql
|
|
143
143
|
@constant {string}
|
|
144
144
|
*/
|
|
145
|
-
alasql.version = '1.7.
|
|
145
|
+
alasql.version = '1.7.5-v1-hotfix-95227342undefined';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -9344,9 +9344,10 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9344
9344
|
|
|
9345
9345
|
if (columns && columns.length > 0) {
|
|
9346
9346
|
columns.forEach(function (tcol) {
|
|
9347
|
+
var escapedColumnId = escapeq(tcol.columnid);
|
|
9347
9348
|
if (joinstar && alasql.options.joinstar == 'underscore') {
|
|
9348
9349
|
ss.push(
|
|
9349
|
-
"'" + alias + '_' +
|
|
9350
|
+
"'" + alias + '_' + escapedColumnId + "':p['" + alias + "']['" + escapedColumnId + "']"
|
|
9350
9351
|
);
|
|
9351
9352
|
} else if (joinstar && alasql.options.joinstar == 'json') {
|
|
9352
9353
|
// ss.push('\''+alias+'_'+tcol.columnid+'\':p[\''+alias+'\'][\''+tcol.columnid+'\']');
|
|
@@ -9354,16 +9355,16 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9354
9355
|
"r['" +
|
|
9355
9356
|
alias +
|
|
9356
9357
|
"']['" +
|
|
9357
|
-
|
|
9358
|
+
escapedColumnId +
|
|
9358
9359
|
"']=p['" +
|
|
9359
9360
|
alias +
|
|
9360
9361
|
"']['" +
|
|
9361
|
-
|
|
9362
|
+
escapedColumnId +
|
|
9362
9363
|
"'];";
|
|
9363
9364
|
} else {
|
|
9364
|
-
var value = "p['" + alias + "']['" +
|
|
9365
|
+
var value = "p['" + alias + "']['" + escapedColumnId + "']";
|
|
9365
9366
|
if (!columnIds[tcol.columnid]) {
|
|
9366
|
-
var key = "'" +
|
|
9367
|
+
var key = "'" + escapedColumnId + "':";
|
|
9367
9368
|
ss.push(key + value);
|
|
9368
9369
|
columnIds[tcol.columnid] = {
|
|
9369
9370
|
id: ss.length - 1,
|
|
@@ -9402,7 +9403,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9402
9403
|
|
|
9403
9404
|
});
|
|
9404
9405
|
|
|
9405
|
-
return {s: ss.join(','), sp: sp};
|
|
9406
|
+
return { s: ss.join(','), sp: sp };
|
|
9406
9407
|
}
|
|
9407
9408
|
|
|
9408
9409
|
yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
@@ -9453,14 +9454,14 @@ yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
|
9453
9454
|
if (false && tbid && !query.defcols['.'][col.tableid] && !query.defcols[col.columnid]) {
|
|
9454
9455
|
ss.push(
|
|
9455
9456
|
"'" +
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9457
|
+
escapeq(col.as || col.columnid) +
|
|
9458
|
+
"':p['" +
|
|
9459
|
+
query.defaultTableid +
|
|
9460
|
+
"']['" +
|
|
9461
|
+
col.tableid +
|
|
9462
|
+
"']['" +
|
|
9463
|
+
col.columnid +
|
|
9464
|
+
"']"
|
|
9464
9465
|
);
|
|
9465
9466
|
} else {
|
|
9466
9467
|
// workaround for multisheet xlsx export with custom COLUMNS
|
|
@@ -9495,12 +9496,12 @@ yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
|
9495
9496
|
} else {
|
|
9496
9497
|
ss.push(
|
|
9497
9498
|
"'" +
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9499
|
+
escapeq(col.as || col.columnid) +
|
|
9500
|
+
"':p['" +
|
|
9501
|
+
tbid +
|
|
9502
|
+
"']['" +
|
|
9503
|
+
col.columnid +
|
|
9504
|
+
"']"
|
|
9504
9505
|
);
|
|
9505
9506
|
}
|
|
9506
9507
|
}
|
|
@@ -9585,9 +9586,9 @@ yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
|
9585
9586
|
) {
|
|
9586
9587
|
ss.push(
|
|
9587
9588
|
"'" +
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9589
|
+
escapeq(col.as) +
|
|
9590
|
+
"':" +
|
|
9591
|
+
n2u(col.expression.toJS('p', query.defaultTableid, query.defcols))
|
|
9591
9592
|
);
|
|
9592
9593
|
} else if (col.aggregatorid === 'COUNT') {
|
|
9593
9594
|
ss.push("'" + escapeq(col.as) + "':1");
|
|
@@ -9617,9 +9618,9 @@ yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
|
9617
9618
|
|
|
9618
9619
|
ss.push(
|
|
9619
9620
|
"'" +
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9621
|
+
escapeq(col.as || col.columnid || col.toString()) +
|
|
9622
|
+
"':" +
|
|
9623
|
+
n2u(col.toJS('p', query.defaultTableid, query.defcols))
|
|
9623
9624
|
);
|
|
9624
9625
|
// ss.push('\''+escapeq(col.toString())+'\':'+col.toJS("p",query.defaultTableid));
|
|
9625
9626
|
//if(col instanceof yy.Expression) {
|
|
@@ -10472,8 +10473,8 @@ yy.Over.prototype.toString = function () {
|
|
|
10472
10473
|
*/
|
|
10473
10474
|
|
|
10474
10475
|
/**
|
|
10475
|
-
|
|
10476
|
-
|
|
10476
|
+
Expression statement ( = 2*2; )
|
|
10477
|
+
@class
|
|
10477
10478
|
@param {object} params Initial parameters
|
|
10478
10479
|
*/
|
|
10479
10480
|
yy.ExpressionStatement = function (params) {
|
|
@@ -10848,7 +10849,7 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
10848
10849
|
var ljs = '(' + leftJS() + '||{})';
|
|
10849
10850
|
|
|
10850
10851
|
if (typeof this.right === 'string') {
|
|
10851
|
-
s = ljs + '["' + this.right + '"]';
|
|
10852
|
+
s = ljs + '["' + escapeq(this.right) + '"]';
|
|
10852
10853
|
} else if (typeof this.right === 'number') {
|
|
10853
10854
|
s = ljs + '[' + this.right + ']';
|
|
10854
10855
|
} else if (this.right instanceof yy.FuncValue) {
|
|
@@ -11079,7 +11080,7 @@ yy.VarValue.prototype.toType = function () {
|
|
|
11079
11080
|
};
|
|
11080
11081
|
|
|
11081
11082
|
yy.VarValue.prototype.toJS = function () {
|
|
11082
|
-
return "alasql.vars['" + this.variable + "']";
|
|
11083
|
+
return "alasql.vars['" + escapeq(this.variable) + "']";
|
|
11083
11084
|
};
|
|
11084
11085
|
|
|
11085
11086
|
yy.NumValue = function (params) {
|
|
@@ -11473,7 +11474,7 @@ yy.AggrValue.prototype.toJS = function (/*context, tableid, defcols*/) {
|
|
|
11473
11474
|
|
|
11474
11475
|
var colas = this.nick;
|
|
11475
11476
|
if (colas === undefined) {
|
|
11476
|
-
colas = this.toString();
|
|
11477
|
+
colas = escapeq(this.toString());
|
|
11477
11478
|
}
|
|
11478
11479
|
return "g['" + colas + "']";
|
|
11479
11480
|
};
|