alasql 2.1.5 → 2.1.6
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/README.md +1 -1
- package/dist/alasql-worker.js +2 -2
- package/dist/alasql-worker.min.js +1 -1
- package/dist/alasql.fs.js +31 -67
- package/dist/alasql.js +31 -67
- package/dist/alasql.min.js +14 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
- _AlaSQL is an unfunded open source project installed 95k time each month. [Please donate your time](https://github.com/AlaSQL/alasql/issues?q=is%3Aopen+label%3A%22Help+wanted%22+
|
|
1
|
+
- _AlaSQL is an unfunded open source project installed 95k time each month. [Please donate your time](https://github.com/AlaSQL/alasql/issues?q=is%3Aopen+label%3A%22Help+wanted%22+sort%3Acreated-desc). We appreciate any and all contributions we can get._
|
|
2
2
|
|
|
3
3
|
- _Have a question? Ask on [Stack Overflow](http://stackoverflow.com/questions/ask?tags=AlaSQL) using the "alasql" tag._
|
|
4
4
|
|
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v2.1.
|
|
1
|
+
//! AlaSQL v2.1.5-develop-eec33e2f | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 2.1.
|
|
4
|
+
@version 2.1.5-develop-eec33e2f
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
//! AlaSQL v2.1.
|
|
1
|
+
//! AlaSQL v2.1.5-develop-eec33e2f | © 2014-2022 Andrey Gershun & Mathias 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,o){"function"==typeof(e=e||[])&&(scope=o,o=e,e=[]),"object"!=typeof e&&(e=[e]);var t=i.lastid++;i.buffer[t]=o,i.webworker.postMessage({id:t,sql:r,params:e})}var a;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&&(a=function(r,e,n,s){return new Promise(function(o,t){i(r,e,function(r,e){e?t(e):(n&&s&&!1!==i.options.progress&&i.options.progress(n,s),o(r))})})},i.promise=function(r,e){if("undefined"==typeof Promise)throw new Error("Please include a Promise/A+ library");if("string"==typeof r)return a(r,e);if(!isArray(r)||r.length<1||void 0!==e)throw new Error("Error in .promise parameters");var o=r;if(!(o.length<1)){for(var t,n,s=[],i=0;i<o.length;i++){if("string"==typeof(n=o[i])&&(n=[n]),!isArray(n)||n.length<1||2<n.length)throw new Error("Error in .promise parameter");t=n[0],n=n[1]||void 0,s.push(a(t,n,i,o.length))}return Promise.all(s)}}),i=i||!1)return i.worker=function(){throw new Error("Can find webworker in this enviroment")},"undefined"!=typeof Worker&&(i.worker=function(r,e,o){if(void 0===(r=!0===r?void 0:r))for(var t=document.getElementsByTagName("script"),n=0;n<t.length;n++){if("alasql-worker.js"===t[n].src.substr(-16).toLowerCase()){r=t[n].src.substr(0,t[n].src.length-16)+"alasql.js";break}if("alasql-worker.min.js"===t[n].src.substr(-20).toLowerCase()){r=t[n].src.substr(0,t[n].src.length-20)+"alasql.min.js";break}if("alasql.js"===t[n].src.substr(-9).toLowerCase()){r=t[n].src;break}if("alasql.min.js"===t[n].src.substr(-13).toLowerCase()){r=t[n].src.substr(0,t[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=(s="importScripts('")+r+"');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(","),[],o)):!1===r&&delete i.webworker}),i.lastid=0,i.buffer={},i.worker(),i;throw new Error("alasql was not found")});
|
package/dist/alasql.fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v2.1.
|
|
1
|
+
//! AlaSQL v2.1.5-develop-eec33e2f | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 2.1.
|
|
4
|
+
@version 2.1.5-develop-eec33e2f
|
|
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 = '2.1.
|
|
145
|
+
alasql.version = '2.1.5-develop-eec33e2f';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -10508,8 +10508,8 @@ yy.Over.prototype.toString = function () {
|
|
|
10508
10508
|
*/
|
|
10509
10509
|
|
|
10510
10510
|
/**
|
|
10511
|
-
|
|
10512
|
-
|
|
10511
|
+
Expression statement ( = 2*2; )
|
|
10512
|
+
@class
|
|
10513
10513
|
@param {object} params Initial parameters
|
|
10514
10514
|
*/
|
|
10515
10515
|
yy.ExpressionStatement = function (params) {
|
|
@@ -10633,8 +10633,7 @@ yy.JavaScript.prototype.toString = function () {
|
|
|
10633
10633
|
return s;
|
|
10634
10634
|
};
|
|
10635
10635
|
|
|
10636
|
-
yy.JavaScript.prototype.toJS = function (
|
|
10637
|
-
|
|
10636
|
+
yy.JavaScript.prototype.toJS = function () {
|
|
10638
10637
|
return '(' + this.value + ')';
|
|
10639
10638
|
};
|
|
10640
10639
|
yy.JavaScript.prototype.execute = function (databaseid, params, cb) {
|
|
@@ -10683,8 +10682,6 @@ yy.Join.prototype.toString = function () {
|
|
|
10683
10682
|
return s;
|
|
10684
10683
|
};
|
|
10685
10684
|
|
|
10686
|
-
// }
|
|
10687
|
-
|
|
10688
10685
|
/**
|
|
10689
10686
|
Table class
|
|
10690
10687
|
@class
|
|
@@ -10762,6 +10759,7 @@ yy.Op.prototype.toString = function () {
|
|
|
10762
10759
|
|
|
10763
10760
|
return s;
|
|
10764
10761
|
}
|
|
10762
|
+
|
|
10765
10763
|
return (
|
|
10766
10764
|
this.left.toString() +
|
|
10767
10765
|
' ' +
|
|
@@ -10773,7 +10771,6 @@ yy.Op.prototype.toString = function () {
|
|
|
10773
10771
|
};
|
|
10774
10772
|
|
|
10775
10773
|
yy.Op.prototype.findAggregator = function (query) {
|
|
10776
|
-
|
|
10777
10774
|
if (this.left && this.left.findAggregator) {
|
|
10778
10775
|
this.left.findAggregator(query);
|
|
10779
10776
|
}
|
|
@@ -10905,17 +10902,28 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
10905
10902
|
}
|
|
10906
10903
|
|
|
10907
10904
|
if (this.op === 'IS') {
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10905
|
+
const leftOperand = leftJS();
|
|
10906
|
+
const rightOperand = rightJS();
|
|
10907
|
+
if (
|
|
10908
|
+
this.right instanceof yy.NullValue ||
|
|
10909
|
+
(this.right.op === 'NOT' && this.right.right instanceof yy.NullValue)
|
|
10910
|
+
) {
|
|
10911
|
+
s = `(
|
|
10912
|
+
(${leftOperand}==null) // Cant be ===
|
|
10913
|
+
===
|
|
10914
|
+
(${rightOperand}==null) // Cant be ===
|
|
10915
|
+
)`;
|
|
10916
|
+
} else {
|
|
10917
|
+
s = `(
|
|
10918
|
+
(${leftOperand} == ${rightOperand})
|
|
10919
|
+
||
|
|
10920
|
+
(
|
|
10921
|
+
${leftOperand} < 0
|
|
10922
|
+
&&
|
|
10923
|
+
true == ${rightOperand}
|
|
10924
|
+
)
|
|
10925
|
+
)`;
|
|
10926
|
+
}
|
|
10919
10927
|
}
|
|
10920
10928
|
|
|
10921
10929
|
if (this.op === '==') {
|
|
@@ -10978,7 +10986,6 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
10978
10986
|
')' +
|
|
10979
10987
|
')' +
|
|
10980
10988
|
')';
|
|
10981
|
-
|
|
10982
10989
|
}
|
|
10983
10990
|
|
|
10984
10991
|
if (this.op === 'IN') {
|
|
@@ -11014,13 +11021,10 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11014
11021
|
if (this.op === 'NOT IN') {
|
|
11015
11022
|
if (this.right instanceof yy.Select) {
|
|
11016
11023
|
s = '(';
|
|
11017
|
-
//this.query.queriesdata['+this.queriesidx+']
|
|
11018
|
-
// s += 'alasql.utils.flatArray(this.query.queriesfn['+(this.queriesidx)+'](params,null,p))';
|
|
11019
11024
|
s += 'alasql.utils.flatArray(this.queriesfn[' + this.queriesidx + '](params,null,p))';
|
|
11020
11025
|
s += '.indexOf(';
|
|
11021
11026
|
s += 'alasql.utils.getValueOf(' + leftJS() + '))<0)';
|
|
11022
11027
|
} else if (Array.isArray(this.right)) {
|
|
11023
|
-
// if(this.right.length == 0) return 'true';
|
|
11024
11028
|
s = '([' + this.right.map(ref).join(',') + '].indexOf(';
|
|
11025
11029
|
s += 'alasql.utils.getValueOf(' + leftJS() + '))<0)';
|
|
11026
11030
|
} else {
|
|
@@ -11034,7 +11038,6 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11034
11038
|
if (this.allsome === 'ALL') {
|
|
11035
11039
|
var s;
|
|
11036
11040
|
if (this.right instanceof yy.Select) {
|
|
11037
|
-
// var s = 'this.query.queriesdata['+this.queriesidx+']';
|
|
11038
11041
|
s = 'alasql.utils.flatArray(this.query.queriesfn[' + this.queriesidx + '](params,null,p))';
|
|
11039
11042
|
|
|
11040
11043
|
s += '.every(function(b){return (';
|
|
@@ -11053,7 +11056,6 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11053
11056
|
if (this.allsome === 'SOME' || this.allsome === 'ANY') {
|
|
11054
11057
|
var s;
|
|
11055
11058
|
if (this.right instanceof yy.Select) {
|
|
11056
|
-
// var s = 'this.query.queriesdata['+this.queriesidx+']';
|
|
11057
11059
|
s = 'alasql.utils.flatArray(this.query.queriesfn[' + this.queriesidx + '](params,null,p))';
|
|
11058
11060
|
s += '.some(function(b){return (';
|
|
11059
11061
|
s += leftJS() + ')' + op + 'b})';
|
|
@@ -11092,12 +11094,9 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11092
11094
|
// // + ')';
|
|
11093
11095
|
// }
|
|
11094
11096
|
|
|
11095
|
-
// Change names
|
|
11096
|
-
|
|
11097
11097
|
var expr = s || '(' + leftJS() + op + rightJS() + ')';
|
|
11098
11098
|
|
|
11099
11099
|
var declareRefs = 'y=[(' + refs.join('), (') + ')]';
|
|
11100
|
-
|
|
11101
11100
|
if (op === '&&' || op === '||' || op === 'IS' || op === 'IS NULL' || op === 'IS NOT NULL') {
|
|
11102
11101
|
return '(' + declareRefs + ', ' + expr + ')';
|
|
11103
11102
|
}
|
|
@@ -11149,8 +11148,6 @@ yy.StringValue.prototype.toType = function () {
|
|
|
11149
11148
|
};
|
|
11150
11149
|
|
|
11151
11150
|
yy.StringValue.prototype.toJS = function () {
|
|
11152
|
-
|
|
11153
|
-
// return "'"+doubleqq(this.value)+"'";
|
|
11154
11151
|
return "'" + escapeq(this.value) + "'";
|
|
11155
11152
|
};
|
|
11156
11153
|
|
|
@@ -11183,8 +11180,6 @@ yy.ArrayValue.prototype.toType = function () {
|
|
|
11183
11180
|
};
|
|
11184
11181
|
|
|
11185
11182
|
yy.ArrayValue.prototype.toJS = function (context, tableid, defcols) {
|
|
11186
|
-
|
|
11187
|
-
// return "'"+doubleqq(this.value)+"'";
|
|
11188
11183
|
return (
|
|
11189
11184
|
'[(' +
|
|
11190
11185
|
this.value
|
|
@@ -11332,7 +11327,6 @@ yy.Column = function (params) {
|
|
|
11332
11327
|
yy.Column.prototype.toString = function () {
|
|
11333
11328
|
var s;
|
|
11334
11329
|
if (this.columnid == +this.columnid) {
|
|
11335
|
-
// jshint ignore:line
|
|
11336
11330
|
s = '[' + this.columnid + ']';
|
|
11337
11331
|
} else {
|
|
11338
11332
|
s = this.columnid;
|
|
@@ -11351,7 +11345,6 @@ yy.Column.prototype.toString = function () {
|
|
|
11351
11345
|
};
|
|
11352
11346
|
|
|
11353
11347
|
yy.Column.prototype.toJS = function (context, tableid, defcols) {
|
|
11354
|
-
|
|
11355
11348
|
var s = '';
|
|
11356
11349
|
if (!this.tableid && tableid === '' && !defcols) {
|
|
11357
11350
|
if (this.columnid !== '_') {
|
|
@@ -11365,17 +11358,10 @@ yy.Column.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11365
11358
|
}
|
|
11366
11359
|
} else {
|
|
11367
11360
|
if (context === 'g') {
|
|
11368
|
-
// if(this.columnid == '_') {
|
|
11369
|
-
// } else {
|
|
11370
11361
|
s = "g['" + this.nick + "']";
|
|
11371
|
-
// }
|
|
11372
11362
|
} else if (this.tableid) {
|
|
11373
11363
|
if (this.columnid !== '_') {
|
|
11374
|
-
// if() {
|
|
11375
|
-
// s = context+'[\''+tableid + '\'][\''+this.tableid+'\'][\''+this.columnid+'\']';
|
|
11376
|
-
// } else {
|
|
11377
11364
|
s = context + "['" + this.tableid + "']['" + this.columnid + "']";
|
|
11378
|
-
// }
|
|
11379
11365
|
} else {
|
|
11380
11366
|
if (context === 'g') {
|
|
11381
11367
|
s = "g['_']";
|
|
@@ -11398,22 +11384,13 @@ yy.Column.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11398
11384
|
|
|
11399
11385
|
} else {
|
|
11400
11386
|
if (this.columnid !== '_') {
|
|
11401
|
-
// if(defcols['.'][this.tableid]) {
|
|
11402
|
-
|
|
11403
|
-
// s = context+'[\''+tableid + '\'][\''+this.tableid + '\'][\''+this.columnid+'\']';
|
|
11404
|
-
// } else {
|
|
11405
11387
|
s = context + "['" + (this.tableid || tableid) + "']['" + this.columnid + "']";
|
|
11406
|
-
// }
|
|
11407
11388
|
} else {
|
|
11408
11389
|
s = context + "['" + (this.tableid || tableid) + "']";
|
|
11409
11390
|
}
|
|
11410
11391
|
}
|
|
11411
11392
|
} else if (tableid === -1) {
|
|
11412
|
-
// if(this.columnid != '') {
|
|
11413
11393
|
s = context + "['" + this.columnid + "']";
|
|
11414
|
-
// } else {
|
|
11415
|
-
// s = context;
|
|
11416
|
-
// }
|
|
11417
11394
|
} else {
|
|
11418
11395
|
if (this.columnid !== '_') {
|
|
11419
11396
|
s = context + "['" + (this.tableid || tableid) + "']['" + this.columnid + "']";
|
|
@@ -11422,9 +11399,6 @@ yy.Column.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11422
11399
|
}
|
|
11423
11400
|
}
|
|
11424
11401
|
}
|
|
11425
|
-
|
|
11426
|
-
// console.trace(new Error());
|
|
11427
|
-
|
|
11428
11402
|
return s;
|
|
11429
11403
|
};
|
|
11430
11404
|
|
|
@@ -11456,16 +11430,8 @@ yy.AggrValue.prototype.toString = function () {
|
|
|
11456
11430
|
};
|
|
11457
11431
|
|
|
11458
11432
|
yy.AggrValue.prototype.findAggregator = function (query) {
|
|
11459
|
-
|
|
11460
|
-
// var colas = this.as || this.toString();
|
|
11461
|
-
|
|
11462
11433
|
var colas = escapeq(this.toString()) + ':' + query.selectGroup.length;
|
|
11463
|
-
|
|
11464
|
-
// if(!query.selectColumns[colas]) {
|
|
11465
|
-
// }
|
|
11466
|
-
|
|
11467
11434
|
var found = false;
|
|
11468
|
-
|
|
11469
11435
|
if (!found) {
|
|
11470
11436
|
if (!this.nick) {
|
|
11471
11437
|
this.nick = colas;
|
|
@@ -11482,8 +11448,6 @@ yy.AggrValue.prototype.findAggregator = function (query) {
|
|
|
11482
11448
|
}
|
|
11483
11449
|
query.selectGroup.push(this);
|
|
11484
11450
|
}
|
|
11485
|
-
|
|
11486
|
-
// this.reduced = true;
|
|
11487
11451
|
return;
|
|
11488
11452
|
};
|
|
11489
11453
|
|
|
@@ -11505,8 +11469,7 @@ yy.AggrValue.prototype.toType = function () {
|
|
|
11505
11469
|
return this.expression.toType();
|
|
11506
11470
|
};
|
|
11507
11471
|
|
|
11508
|
-
yy.AggrValue.prototype.toJS = function (
|
|
11509
|
-
|
|
11472
|
+
yy.AggrValue.prototype.toJS = function () {
|
|
11510
11473
|
var colas = this.nick;
|
|
11511
11474
|
if (colas === undefined) {
|
|
11512
11475
|
colas = this.toString();
|
|
@@ -11517,6 +11480,7 @@ yy.AggrValue.prototype.toJS = function (/*context, tableid, defcols*/) {
|
|
|
11517
11480
|
yy.OrderExpression = function (params) {
|
|
11518
11481
|
return yy.extend(this, params);
|
|
11519
11482
|
};
|
|
11483
|
+
|
|
11520
11484
|
yy.OrderExpression.prototype.toString = yy.Expression.prototype.toString;
|
|
11521
11485
|
|
|
11522
11486
|
yy.GroupExpression = function (params) {
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v2.1.
|
|
1
|
+
//! AlaSQL v2.1.5-develop-eec33e2f | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 2.1.
|
|
4
|
+
@version 2.1.5-develop-eec33e2f
|
|
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 = '2.1.
|
|
145
|
+
alasql.version = '2.1.5-develop-eec33e2f';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -10502,8 +10502,8 @@ yy.Over.prototype.toString = function () {
|
|
|
10502
10502
|
*/
|
|
10503
10503
|
|
|
10504
10504
|
/**
|
|
10505
|
-
|
|
10506
|
-
|
|
10505
|
+
Expression statement ( = 2*2; )
|
|
10506
|
+
@class
|
|
10507
10507
|
@param {object} params Initial parameters
|
|
10508
10508
|
*/
|
|
10509
10509
|
yy.ExpressionStatement = function (params) {
|
|
@@ -10627,8 +10627,7 @@ yy.JavaScript.prototype.toString = function () {
|
|
|
10627
10627
|
return s;
|
|
10628
10628
|
};
|
|
10629
10629
|
|
|
10630
|
-
yy.JavaScript.prototype.toJS = function (
|
|
10631
|
-
|
|
10630
|
+
yy.JavaScript.prototype.toJS = function () {
|
|
10632
10631
|
return '(' + this.value + ')';
|
|
10633
10632
|
};
|
|
10634
10633
|
yy.JavaScript.prototype.execute = function (databaseid, params, cb) {
|
|
@@ -10677,8 +10676,6 @@ yy.Join.prototype.toString = function () {
|
|
|
10677
10676
|
return s;
|
|
10678
10677
|
};
|
|
10679
10678
|
|
|
10680
|
-
// }
|
|
10681
|
-
|
|
10682
10679
|
/**
|
|
10683
10680
|
Table class
|
|
10684
10681
|
@class
|
|
@@ -10756,6 +10753,7 @@ yy.Op.prototype.toString = function () {
|
|
|
10756
10753
|
|
|
10757
10754
|
return s;
|
|
10758
10755
|
}
|
|
10756
|
+
|
|
10759
10757
|
return (
|
|
10760
10758
|
this.left.toString() +
|
|
10761
10759
|
' ' +
|
|
@@ -10767,7 +10765,6 @@ yy.Op.prototype.toString = function () {
|
|
|
10767
10765
|
};
|
|
10768
10766
|
|
|
10769
10767
|
yy.Op.prototype.findAggregator = function (query) {
|
|
10770
|
-
|
|
10771
10768
|
if (this.left && this.left.findAggregator) {
|
|
10772
10769
|
this.left.findAggregator(query);
|
|
10773
10770
|
}
|
|
@@ -10899,17 +10896,28 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
10899
10896
|
}
|
|
10900
10897
|
|
|
10901
10898
|
if (this.op === 'IS') {
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10899
|
+
const leftOperand = leftJS();
|
|
10900
|
+
const rightOperand = rightJS();
|
|
10901
|
+
if (
|
|
10902
|
+
this.right instanceof yy.NullValue ||
|
|
10903
|
+
(this.right.op === 'NOT' && this.right.right instanceof yy.NullValue)
|
|
10904
|
+
) {
|
|
10905
|
+
s = `(
|
|
10906
|
+
(${leftOperand}==null) // Cant be ===
|
|
10907
|
+
===
|
|
10908
|
+
(${rightOperand}==null) // Cant be ===
|
|
10909
|
+
)`;
|
|
10910
|
+
} else {
|
|
10911
|
+
s = `(
|
|
10912
|
+
(${leftOperand} == ${rightOperand})
|
|
10913
|
+
||
|
|
10914
|
+
(
|
|
10915
|
+
${leftOperand} < 0
|
|
10916
|
+
&&
|
|
10917
|
+
true == ${rightOperand}
|
|
10918
|
+
)
|
|
10919
|
+
)`;
|
|
10920
|
+
}
|
|
10913
10921
|
}
|
|
10914
10922
|
|
|
10915
10923
|
if (this.op === '==') {
|
|
@@ -10972,7 +10980,6 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
10972
10980
|
')' +
|
|
10973
10981
|
')' +
|
|
10974
10982
|
')';
|
|
10975
|
-
|
|
10976
10983
|
}
|
|
10977
10984
|
|
|
10978
10985
|
if (this.op === 'IN') {
|
|
@@ -11008,13 +11015,10 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11008
11015
|
if (this.op === 'NOT IN') {
|
|
11009
11016
|
if (this.right instanceof yy.Select) {
|
|
11010
11017
|
s = '(';
|
|
11011
|
-
//this.query.queriesdata['+this.queriesidx+']
|
|
11012
|
-
// s += 'alasql.utils.flatArray(this.query.queriesfn['+(this.queriesidx)+'](params,null,p))';
|
|
11013
11018
|
s += 'alasql.utils.flatArray(this.queriesfn[' + this.queriesidx + '](params,null,p))';
|
|
11014
11019
|
s += '.indexOf(';
|
|
11015
11020
|
s += 'alasql.utils.getValueOf(' + leftJS() + '))<0)';
|
|
11016
11021
|
} else if (Array.isArray(this.right)) {
|
|
11017
|
-
// if(this.right.length == 0) return 'true';
|
|
11018
11022
|
s = '([' + this.right.map(ref).join(',') + '].indexOf(';
|
|
11019
11023
|
s += 'alasql.utils.getValueOf(' + leftJS() + '))<0)';
|
|
11020
11024
|
} else {
|
|
@@ -11028,7 +11032,6 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11028
11032
|
if (this.allsome === 'ALL') {
|
|
11029
11033
|
var s;
|
|
11030
11034
|
if (this.right instanceof yy.Select) {
|
|
11031
|
-
// var s = 'this.query.queriesdata['+this.queriesidx+']';
|
|
11032
11035
|
s = 'alasql.utils.flatArray(this.query.queriesfn[' + this.queriesidx + '](params,null,p))';
|
|
11033
11036
|
|
|
11034
11037
|
s += '.every(function(b){return (';
|
|
@@ -11047,7 +11050,6 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11047
11050
|
if (this.allsome === 'SOME' || this.allsome === 'ANY') {
|
|
11048
11051
|
var s;
|
|
11049
11052
|
if (this.right instanceof yy.Select) {
|
|
11050
|
-
// var s = 'this.query.queriesdata['+this.queriesidx+']';
|
|
11051
11053
|
s = 'alasql.utils.flatArray(this.query.queriesfn[' + this.queriesidx + '](params,null,p))';
|
|
11052
11054
|
s += '.some(function(b){return (';
|
|
11053
11055
|
s += leftJS() + ')' + op + 'b})';
|
|
@@ -11086,12 +11088,9 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11086
11088
|
// // + ')';
|
|
11087
11089
|
// }
|
|
11088
11090
|
|
|
11089
|
-
// Change names
|
|
11090
|
-
|
|
11091
11091
|
var expr = s || '(' + leftJS() + op + rightJS() + ')';
|
|
11092
11092
|
|
|
11093
11093
|
var declareRefs = 'y=[(' + refs.join('), (') + ')]';
|
|
11094
|
-
|
|
11095
11094
|
if (op === '&&' || op === '||' || op === 'IS' || op === 'IS NULL' || op === 'IS NOT NULL') {
|
|
11096
11095
|
return '(' + declareRefs + ', ' + expr + ')';
|
|
11097
11096
|
}
|
|
@@ -11143,8 +11142,6 @@ yy.StringValue.prototype.toType = function () {
|
|
|
11143
11142
|
};
|
|
11144
11143
|
|
|
11145
11144
|
yy.StringValue.prototype.toJS = function () {
|
|
11146
|
-
|
|
11147
|
-
// return "'"+doubleqq(this.value)+"'";
|
|
11148
11145
|
return "'" + escapeq(this.value) + "'";
|
|
11149
11146
|
};
|
|
11150
11147
|
|
|
@@ -11177,8 +11174,6 @@ yy.ArrayValue.prototype.toType = function () {
|
|
|
11177
11174
|
};
|
|
11178
11175
|
|
|
11179
11176
|
yy.ArrayValue.prototype.toJS = function (context, tableid, defcols) {
|
|
11180
|
-
|
|
11181
|
-
// return "'"+doubleqq(this.value)+"'";
|
|
11182
11177
|
return (
|
|
11183
11178
|
'[(' +
|
|
11184
11179
|
this.value
|
|
@@ -11326,7 +11321,6 @@ yy.Column = function (params) {
|
|
|
11326
11321
|
yy.Column.prototype.toString = function () {
|
|
11327
11322
|
var s;
|
|
11328
11323
|
if (this.columnid == +this.columnid) {
|
|
11329
|
-
// jshint ignore:line
|
|
11330
11324
|
s = '[' + this.columnid + ']';
|
|
11331
11325
|
} else {
|
|
11332
11326
|
s = this.columnid;
|
|
@@ -11345,7 +11339,6 @@ yy.Column.prototype.toString = function () {
|
|
|
11345
11339
|
};
|
|
11346
11340
|
|
|
11347
11341
|
yy.Column.prototype.toJS = function (context, tableid, defcols) {
|
|
11348
|
-
|
|
11349
11342
|
var s = '';
|
|
11350
11343
|
if (!this.tableid && tableid === '' && !defcols) {
|
|
11351
11344
|
if (this.columnid !== '_') {
|
|
@@ -11359,17 +11352,10 @@ yy.Column.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11359
11352
|
}
|
|
11360
11353
|
} else {
|
|
11361
11354
|
if (context === 'g') {
|
|
11362
|
-
// if(this.columnid == '_') {
|
|
11363
|
-
// } else {
|
|
11364
11355
|
s = "g['" + this.nick + "']";
|
|
11365
|
-
// }
|
|
11366
11356
|
} else if (this.tableid) {
|
|
11367
11357
|
if (this.columnid !== '_') {
|
|
11368
|
-
// if() {
|
|
11369
|
-
// s = context+'[\''+tableid + '\'][\''+this.tableid+'\'][\''+this.columnid+'\']';
|
|
11370
|
-
// } else {
|
|
11371
11358
|
s = context + "['" + this.tableid + "']['" + this.columnid + "']";
|
|
11372
|
-
// }
|
|
11373
11359
|
} else {
|
|
11374
11360
|
if (context === 'g') {
|
|
11375
11361
|
s = "g['_']";
|
|
@@ -11392,22 +11378,13 @@ yy.Column.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11392
11378
|
|
|
11393
11379
|
} else {
|
|
11394
11380
|
if (this.columnid !== '_') {
|
|
11395
|
-
// if(defcols['.'][this.tableid]) {
|
|
11396
|
-
|
|
11397
|
-
// s = context+'[\''+tableid + '\'][\''+this.tableid + '\'][\''+this.columnid+'\']';
|
|
11398
|
-
// } else {
|
|
11399
11381
|
s = context + "['" + (this.tableid || tableid) + "']['" + this.columnid + "']";
|
|
11400
|
-
// }
|
|
11401
11382
|
} else {
|
|
11402
11383
|
s = context + "['" + (this.tableid || tableid) + "']";
|
|
11403
11384
|
}
|
|
11404
11385
|
}
|
|
11405
11386
|
} else if (tableid === -1) {
|
|
11406
|
-
// if(this.columnid != '') {
|
|
11407
11387
|
s = context + "['" + this.columnid + "']";
|
|
11408
|
-
// } else {
|
|
11409
|
-
// s = context;
|
|
11410
|
-
// }
|
|
11411
11388
|
} else {
|
|
11412
11389
|
if (this.columnid !== '_') {
|
|
11413
11390
|
s = context + "['" + (this.tableid || tableid) + "']['" + this.columnid + "']";
|
|
@@ -11416,9 +11393,6 @@ yy.Column.prototype.toJS = function (context, tableid, defcols) {
|
|
|
11416
11393
|
}
|
|
11417
11394
|
}
|
|
11418
11395
|
}
|
|
11419
|
-
|
|
11420
|
-
// console.trace(new Error());
|
|
11421
|
-
|
|
11422
11396
|
return s;
|
|
11423
11397
|
};
|
|
11424
11398
|
|
|
@@ -11450,16 +11424,8 @@ yy.AggrValue.prototype.toString = function () {
|
|
|
11450
11424
|
};
|
|
11451
11425
|
|
|
11452
11426
|
yy.AggrValue.prototype.findAggregator = function (query) {
|
|
11453
|
-
|
|
11454
|
-
// var colas = this.as || this.toString();
|
|
11455
|
-
|
|
11456
11427
|
var colas = escapeq(this.toString()) + ':' + query.selectGroup.length;
|
|
11457
|
-
|
|
11458
|
-
// if(!query.selectColumns[colas]) {
|
|
11459
|
-
// }
|
|
11460
|
-
|
|
11461
11428
|
var found = false;
|
|
11462
|
-
|
|
11463
11429
|
if (!found) {
|
|
11464
11430
|
if (!this.nick) {
|
|
11465
11431
|
this.nick = colas;
|
|
@@ -11476,8 +11442,6 @@ yy.AggrValue.prototype.findAggregator = function (query) {
|
|
|
11476
11442
|
}
|
|
11477
11443
|
query.selectGroup.push(this);
|
|
11478
11444
|
}
|
|
11479
|
-
|
|
11480
|
-
// this.reduced = true;
|
|
11481
11445
|
return;
|
|
11482
11446
|
};
|
|
11483
11447
|
|
|
@@ -11499,8 +11463,7 @@ yy.AggrValue.prototype.toType = function () {
|
|
|
11499
11463
|
return this.expression.toType();
|
|
11500
11464
|
};
|
|
11501
11465
|
|
|
11502
|
-
yy.AggrValue.prototype.toJS = function (
|
|
11503
|
-
|
|
11466
|
+
yy.AggrValue.prototype.toJS = function () {
|
|
11504
11467
|
var colas = this.nick;
|
|
11505
11468
|
if (colas === undefined) {
|
|
11506
11469
|
colas = this.toString();
|
|
@@ -11511,6 +11474,7 @@ yy.AggrValue.prototype.toJS = function (/*context, tableid, defcols*/) {
|
|
|
11511
11474
|
yy.OrderExpression = function (params) {
|
|
11512
11475
|
return yy.extend(this, params);
|
|
11513
11476
|
};
|
|
11477
|
+
|
|
11514
11478
|
yy.OrderExpression.prototype.toString = yy.Expression.prototype.toString;
|
|
11515
11479
|
|
|
11516
11480
|
yy.GroupExpression = function (params) {
|