alasql 1.7.2 → 1.7.3

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.
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npm test
@@ -1,7 +1,7 @@
1
- //! AlaSQL v1.7.2 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v1.7.3-develop-0be167bcundefined | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 1.7.2
4
+ @version 1.7.3-develop-0be167bcundefined
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.2 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
- !function(r,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():r.alasql=e()}(this,function(){function a(r,e,t){"function"==typeof(e=e||[])&&(scope=t,t=e,e=[]),"object"!=typeof e&&(e=[e]);var o=a.lastid++;a.buffer[o]=t,a.webworker.postMessage({id:o,sql:r,params:e})}if(a.options={},a.options.progress=function(){},isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)},a.promise=function(){throw new Error("Please include a Promise/A+ library")},"undefined"!=typeof Promise){function i(r,e,n,s){return new Promise(function(t,o){a(r,e,function(r,e){e?o(e):(n&&s&&!1!==a.options.progress&&a.options.progress(n,s),t(r))})})}a.promise=function(r,e){if("undefined"==typeof Promise)throw new Error("Please include a Promise/A+ library");if("string"==typeof r)return i(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=[],s=0;s<r.length;s++){if("string"==typeof(e=r[s])&&(e=[e]),!isArray(e)||e.length<1||2<e.length)throw new Error("Error in .promise parameter");t=e[0],o=e[1]||void 0,n.push(i(t,o,s,r.length))}return Promise.all(n)}}(r)}}if(!(a=a||!1))throw new Error("alasql was not found");return a.worker=function(){throw new Error("Can find webworker in this enviroment")},"undefined"!=typeof Worker&&(a.worker=function(r,e,t){if(!0===r&&(r=void 0),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");if(!1!==r){var 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});});}";var i=new Blob([s],{type:"text/plain"});if(a.webworker=new Worker(URL.createObjectURL(i)),a.webworker.onmessage=function(r){var e=r.data.id;a.buffer[e](r.data.data),delete a.buffer[e]},a.webworker.onerror=function(r){throw r},1<arguments.length)a("REQUIRE "+e.map(function(r){return'"'+r+'"'}).join(","),[],t)}else if(!1===r)return void delete a.webworker}),a.lastid=0,a.buffer={},a.worker(),a});
1
+ //! AlaSQL v1.7.3-develop-0be167bcundefined | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
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.2 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v1.7.3-develop-0be167bcundefined | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 1.7.2
4
+ @version 1.7.3-develop-0be167bcundefined
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.2';
145
+ alasql.version = '1.7.3-develop-0be167bcundefined';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -4328,6 +4328,12 @@ var getXLSX = function () {
4328
4328
  return XLSX;
4329
4329
  };
4330
4330
 
4331
+ var jss = JSON.stringify;
4332
+ var reName = /[^a-z\d@-_]+/gi;
4333
+ var nss = (e) => e.replace(reName, '');
4334
+ var reTick = /`/g;
4335
+ var tss = (e) => e.replace(reTick, '');
4336
+
4331
4337
  // set AlaSQl path
4332
4338
  alasql.path = alasql.utils.findAlaSQLPath();
4333
4339
 
@@ -6308,7 +6314,7 @@ yy.Search.prototype.toString = function () {
6308
6314
 
6309
6315
  yy.Search.prototype.toJS = function (context) {
6310
6316
 
6311
- var s = 'this.queriesfn[' + (this.queriesidx - 1) + '](this.params,null,' + context + ')';
6317
+ var s = 'this.queriesfn[' + jss(this.queriesidx - 1) + '](this.params,null,' + jss(context) + ')';
6312
6318
  // var s = '';
6313
6319
  return s;
6314
6320
  };
@@ -6669,11 +6675,11 @@ alasql.srch.SET = function (val, args, stope, params) {
6669
6675
  .map(function (st) {
6670
6676
 
6671
6677
  if (st.method === '@') {
6672
- return "alasql.vars['" + st.variable + "']=" + st.expression.toJS('x', '');
6678
+ return 'alasql.vars[' + jss(st.variable) + ']=' + st.expression.toJS('x', '');
6673
6679
  } else if (st.method === '$') {
6674
- return "params['" + st.variable + "']=" + st.expression.toJS('x', '');
6680
+ return 'params[' + jss(st.variable) + ']=' + st.expression.toJS('x', '');
6675
6681
  } else {
6676
- return "x['" + st.column.columnid + "']=" + st.expression.toJS('x', '');
6682
+ return 'x[' + jss(st.column.columnid) + ']=' + st.expression.toJS('x', '');
6677
6683
  }
6678
6684
  })
6679
6685
  .join(';');
@@ -6760,17 +6766,26 @@ var compileSearchOrder = function (order) {
6760
6766
  s += 'if(a' + dg + '==b' + dg + '){';
6761
6767
  } else {
6762
6768
  s +=
6763
- "if((a['" +
6764
- columnid +
6765
- "']||'')" +
6769
+ 'if((a[' +
6770
+ jss(columnid) +
6771
+ "]||'')" +
6766
6772
  dg +
6767
6773
  (ord.direction === 'ASC' ? '>' : '<') +
6768
- "(b['" +
6769
- columnid +
6770
- "']||'')" +
6774
+ '(b[' +
6775
+ jss(columnid) +
6776
+ "]||'')" +
6771
6777
  dg +
6772
6778
  ')return 1;';
6773
- s += "if((a['" + columnid + "']||'')" + dg + "==(b['" + columnid + "']||'')" + dg + '){';
6779
+ s +=
6780
+ 'if((a[' +
6781
+ jss(columnid) +
6782
+ "]||'')" +
6783
+ dg +
6784
+ '==(b[' +
6785
+ jss(columnid) +
6786
+ "]||'')" +
6787
+ dg +
6788
+ '){';
6774
6789
  }
6775
6790
  } else {
6776
6791
  dg = '.valueOf()';
@@ -7963,7 +7978,7 @@ yy.Select.prototype.compile = function (databaseid, params) {
7963
7978
  // If this is INTO() function, then call it
7964
7979
  // with one or two parameters
7965
7980
  //
7966
- var qs = "return alasql.into[" + JSON.stringify(this.into.funcid.toUpperCase()) + "](";
7981
+ var qs = 'return alasql.into[' + JSON.stringify(this.into.funcid.toUpperCase()) + '](';
7967
7982
  if (this.into.args && this.into.args.length > 0) {
7968
7983
  qs += this.into.args[0].toJS() + ',';
7969
7984
  if (this.into.args.length > 1) {
@@ -8409,7 +8424,7 @@ yy.Select.prototype.compileFrom = function (query) {
8409
8424
  ps += ');if(cb)res=cb(res,idx,query);return res';
8410
8425
  source.datafn = new Function('query,params,cb,idx,alasql', ps);
8411
8426
  } else if (tq instanceof yy.FuncValue) {
8412
- ps = "var res=alasql.from[" + JSON.stringify(tq.funcid.toUpperCase()) + "](";
8427
+ ps = 'var res=alasql.from[' + JSON.stringify(tq.funcid.toUpperCase()) + '](';
8413
8428
 
8414
8429
  if (tq.args && tq.args.length > 0) {
8415
8430
  if (tq.args[0]) {
@@ -8672,7 +8687,7 @@ yy.Select.prototype.compileJoins = function (query) {
8672
8687
  };
8673
8688
  // source.data = ;
8674
8689
 
8675
- var s = "var res=alasql.from[" + JSON.stringify(jn.func.funcid.toUpperCase()) + "](";
8690
+ var s = 'var res=alasql.from[' + JSON.stringify(jn.func.funcid.toUpperCase()) + '](';
8676
8691
 
8677
8692
  var args = jn.func.args;
8678
8693
  if (args && args.length > 0) {
@@ -10846,7 +10861,7 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
10846
10861
  if (!(!this.right.args || 0 === this.right.args.length)) {
10847
10862
  var ss = this.right.args.map(ref);
10848
10863
  }
10849
- s = '' + ljs + "[" + JSON.stringify(this.right.funcid) + "](" + ss.join(',') + ')';
10864
+ s = '' + ljs + '[' + JSON.stringify(this.right.funcid) + '](' + ss.join(',') + ')';
10850
10865
  } else {
10851
10866
  s = '' + ljs + '[' + rightJS() + ']';
10852
10867
  }
@@ -11821,10 +11836,13 @@ stdlib.MIN = stdlib.LEAST = function () {
11821
11836
  );
11822
11837
  };
11823
11838
 
11824
- stdlib.SUBSTRING = stdlib.SUBSTR = stdlib.MID = function (a, b, c) {
11825
- if (arguments.length == 2) return und(a, 'y.substr(' + b + '-1)');
11826
- else if (arguments.length == 3) return und(a, 'y.substr(' + b + '-1,' + c + ')');
11827
- };
11839
+ stdlib.SUBSTRING =
11840
+ stdlib.SUBSTR =
11841
+ stdlib.MID =
11842
+ function (a, b, c) {
11843
+ if (arguments.length == 2) return und(a, 'y.substr(' + b + '-1)');
11844
+ else if (arguments.length == 3) return und(a, 'y.substr(' + b + '-1,' + c + ')');
11845
+ };
11828
11846
 
11829
11847
  stdfn.REGEXP_LIKE = function (a, b, c) {
11830
11848
 
@@ -12048,13 +12066,16 @@ alasql.aggr.VARP = function (v, s, stage) {
12048
12066
  }
12049
12067
  };
12050
12068
 
12051
- alasql.aggr.STD = alasql.aggr.STDDEV = alasql.aggr.STDEVP = function (v, s, stage) {
12052
- if (stage == 1 || stage == 2) {
12053
- return alasql.aggr.VARP(v, s, stage);
12054
- } else {
12055
- return Math.sqrt(alasql.aggr.VARP(v, s, stage));
12056
- }
12057
- };
12069
+ alasql.aggr.STD =
12070
+ alasql.aggr.STDDEV =
12071
+ alasql.aggr.STDEVP =
12072
+ function (v, s, stage) {
12073
+ if (stage == 1 || stage == 2) {
12074
+ return alasql.aggr.VARP(v, s, stage);
12075
+ } else {
12076
+ return Math.sqrt(alasql.aggr.VARP(v, s, stage));
12077
+ }
12078
+ };
12058
12079
 
12059
12080
  alasql._aggrOriginal = alasql.aggr;
12060
12081
  alasql.aggr = {};
@@ -12076,34 +12097,37 @@ for (var i = 0; i < 256; i++) {
12076
12097
  lut[i] = (i < 16 ? '0' : '') + i.toString(16);
12077
12098
  }
12078
12099
 
12079
- stdfn.NEWID = stdfn.UUID = stdfn.GEN_RANDOM_UUID = function () {
12080
- var d0 = (Math.random() * 0xffffffff) | 0;
12081
- var d1 = (Math.random() * 0xffffffff) | 0;
12082
- var d2 = (Math.random() * 0xffffffff) | 0;
12083
- var d3 = (Math.random() * 0xffffffff) | 0;
12084
- return (
12085
- lut[d0 & 0xff] +
12086
- lut[(d0 >> 8) & 0xff] +
12087
- lut[(d0 >> 16) & 0xff] +
12088
- lut[(d0 >> 24) & 0xff] +
12089
- '-' +
12090
- lut[d1 & 0xff] +
12091
- lut[(d1 >> 8) & 0xff] +
12092
- '-' +
12093
- lut[((d1 >> 16) & 0x0f) | 0x40] +
12094
- lut[(d1 >> 24) & 0xff] +
12095
- '-' +
12096
- lut[(d2 & 0x3f) | 0x80] +
12097
- lut[(d2 >> 8) & 0xff] +
12098
- '-' +
12099
- lut[(d2 >> 16) & 0xff] +
12100
- lut[(d2 >> 24) & 0xff] +
12101
- lut[d3 & 0xff] +
12102
- lut[(d3 >> 8) & 0xff] +
12103
- lut[(d3 >> 16) & 0xff] +
12104
- lut[(d3 >> 24) & 0xff]
12105
- );
12106
- };
12100
+ stdfn.NEWID =
12101
+ stdfn.UUID =
12102
+ stdfn.GEN_RANDOM_UUID =
12103
+ function () {
12104
+ var d0 = (Math.random() * 0xffffffff) | 0;
12105
+ var d1 = (Math.random() * 0xffffffff) | 0;
12106
+ var d2 = (Math.random() * 0xffffffff) | 0;
12107
+ var d3 = (Math.random() * 0xffffffff) | 0;
12108
+ return (
12109
+ lut[d0 & 0xff] +
12110
+ lut[(d0 >> 8) & 0xff] +
12111
+ lut[(d0 >> 16) & 0xff] +
12112
+ lut[(d0 >> 24) & 0xff] +
12113
+ '-' +
12114
+ lut[d1 & 0xff] +
12115
+ lut[(d1 >> 8) & 0xff] +
12116
+ '-' +
12117
+ lut[((d1 >> 16) & 0x0f) | 0x40] +
12118
+ lut[(d1 >> 24) & 0xff] +
12119
+ '-' +
12120
+ lut[(d2 & 0x3f) | 0x80] +
12121
+ lut[(d2 >> 8) & 0xff] +
12122
+ '-' +
12123
+ lut[(d2 >> 16) & 0xff] +
12124
+ lut[(d2 >> 24) & 0xff] +
12125
+ lut[d3 & 0xff] +
12126
+ lut[(d3 >> 8) & 0xff] +
12127
+ lut[(d3 >> 16) & 0xff] +
12128
+ lut[(d3 >> 24) & 0xff]
12129
+ );
12130
+ };
12107
12131
 
12108
12132
  /*
12109
12133
  //
@@ -18755,6 +18779,7 @@ LS.dropDatabase = function (lsdbid, ifexists, cb) {
18755
18779
 
18756
18780
  LS.attachDatabase = function (lsdbid, databaseid, args, params, cb) {
18757
18781
  var res = 1;
18782
+ // console.warn({lsdbid, databaseid, args, params, cb, dbs: Object.keys(alasql.databases)})
18758
18783
  if (alasql.databases[databaseid]) {
18759
18784
  throw new Error('Unable to attach database as "' + databaseid + '" because it already exists');
18760
18785
  }
@@ -19657,7 +19682,14 @@ var saveAs =
19657
19682
  FS_proto.WRITING = 1;
19658
19683
  FS_proto.DONE = 2;
19659
19684
 
19660
- FS_proto.error = FS_proto.onwritestart = FS_proto.onprogress = FS_proto.onwrite = FS_proto.onabort = FS_proto.onerror = FS_proto.onwriteend = null;
19685
+ FS_proto.error =
19686
+ FS_proto.onwritestart =
19687
+ FS_proto.onprogress =
19688
+ FS_proto.onwrite =
19689
+ FS_proto.onabort =
19690
+ FS_proto.onerror =
19691
+ FS_proto.onwriteend =
19692
+ null;
19661
19693
 
19662
19694
  return saveAs;
19663
19695
  })(
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v1.7.2 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
1
+ //! AlaSQL v1.7.3-develop-0be167bcundefined | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 1.7.2
4
+ @version 1.7.3-develop-0be167bcundefined
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.2';
145
+ alasql.version = '1.7.3-develop-0be167bcundefined';
146
146
 
147
147
  /**
148
148
  Debug flag
@@ -4323,6 +4323,12 @@ var getXLSX = function () {
4323
4323
  return XLSX;
4324
4324
  };
4325
4325
 
4326
+ var jss = JSON.stringify;
4327
+ var reName = /[^a-z\d@-_]+/gi;
4328
+ var nss = (e) => e.replace(reName, '');
4329
+ var reTick = /`/g;
4330
+ var tss = (e) => e.replace(reTick, '');
4331
+
4326
4332
  // set AlaSQl path
4327
4333
  alasql.path = alasql.utils.findAlaSQLPath();
4328
4334
 
@@ -6303,7 +6309,7 @@ yy.Search.prototype.toString = function () {
6303
6309
 
6304
6310
  yy.Search.prototype.toJS = function (context) {
6305
6311
 
6306
- var s = 'this.queriesfn[' + (this.queriesidx - 1) + '](this.params,null,' + context + ')';
6312
+ var s = 'this.queriesfn[' + jss(this.queriesidx - 1) + '](this.params,null,' + jss(context) + ')';
6307
6313
  // var s = '';
6308
6314
  return s;
6309
6315
  };
@@ -6664,11 +6670,11 @@ alasql.srch.SET = function (val, args, stope, params) {
6664
6670
  .map(function (st) {
6665
6671
 
6666
6672
  if (st.method === '@') {
6667
- return "alasql.vars['" + st.variable + "']=" + st.expression.toJS('x', '');
6673
+ return 'alasql.vars[' + jss(st.variable) + ']=' + st.expression.toJS('x', '');
6668
6674
  } else if (st.method === '$') {
6669
- return "params['" + st.variable + "']=" + st.expression.toJS('x', '');
6675
+ return 'params[' + jss(st.variable) + ']=' + st.expression.toJS('x', '');
6670
6676
  } else {
6671
- return "x['" + st.column.columnid + "']=" + st.expression.toJS('x', '');
6677
+ return 'x[' + jss(st.column.columnid) + ']=' + st.expression.toJS('x', '');
6672
6678
  }
6673
6679
  })
6674
6680
  .join(';');
@@ -6755,17 +6761,26 @@ var compileSearchOrder = function (order) {
6755
6761
  s += 'if(a' + dg + '==b' + dg + '){';
6756
6762
  } else {
6757
6763
  s +=
6758
- "if((a['" +
6759
- columnid +
6760
- "']||'')" +
6764
+ 'if((a[' +
6765
+ jss(columnid) +
6766
+ "]||'')" +
6761
6767
  dg +
6762
6768
  (ord.direction === 'ASC' ? '>' : '<') +
6763
- "(b['" +
6764
- columnid +
6765
- "']||'')" +
6769
+ '(b[' +
6770
+ jss(columnid) +
6771
+ "]||'')" +
6766
6772
  dg +
6767
6773
  ')return 1;';
6768
- s += "if((a['" + columnid + "']||'')" + dg + "==(b['" + columnid + "']||'')" + dg + '){';
6774
+ s +=
6775
+ 'if((a[' +
6776
+ jss(columnid) +
6777
+ "]||'')" +
6778
+ dg +
6779
+ '==(b[' +
6780
+ jss(columnid) +
6781
+ "]||'')" +
6782
+ dg +
6783
+ '){';
6769
6784
  }
6770
6785
  } else {
6771
6786
  dg = '.valueOf()';
@@ -7958,7 +7973,7 @@ yy.Select.prototype.compile = function (databaseid, params) {
7958
7973
  // If this is INTO() function, then call it
7959
7974
  // with one or two parameters
7960
7975
  //
7961
- var qs = "return alasql.into[" + JSON.stringify(this.into.funcid.toUpperCase()) + "](";
7976
+ var qs = 'return alasql.into[' + JSON.stringify(this.into.funcid.toUpperCase()) + '](';
7962
7977
  if (this.into.args && this.into.args.length > 0) {
7963
7978
  qs += this.into.args[0].toJS() + ',';
7964
7979
  if (this.into.args.length > 1) {
@@ -8404,7 +8419,7 @@ yy.Select.prototype.compileFrom = function (query) {
8404
8419
  ps += ');if(cb)res=cb(res,idx,query);return res';
8405
8420
  source.datafn = new Function('query,params,cb,idx,alasql', ps);
8406
8421
  } else if (tq instanceof yy.FuncValue) {
8407
- ps = "var res=alasql.from[" + JSON.stringify(tq.funcid.toUpperCase()) + "](";
8422
+ ps = 'var res=alasql.from[' + JSON.stringify(tq.funcid.toUpperCase()) + '](';
8408
8423
 
8409
8424
  if (tq.args && tq.args.length > 0) {
8410
8425
  if (tq.args[0]) {
@@ -8667,7 +8682,7 @@ yy.Select.prototype.compileJoins = function (query) {
8667
8682
  };
8668
8683
  // source.data = ;
8669
8684
 
8670
- var s = "var res=alasql.from[" + JSON.stringify(jn.func.funcid.toUpperCase()) + "](";
8685
+ var s = 'var res=alasql.from[' + JSON.stringify(jn.func.funcid.toUpperCase()) + '](';
8671
8686
 
8672
8687
  var args = jn.func.args;
8673
8688
  if (args && args.length > 0) {
@@ -10841,7 +10856,7 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
10841
10856
  if (!(!this.right.args || 0 === this.right.args.length)) {
10842
10857
  var ss = this.right.args.map(ref);
10843
10858
  }
10844
- s = '' + ljs + "[" + JSON.stringify(this.right.funcid) + "](" + ss.join(',') + ')';
10859
+ s = '' + ljs + '[' + JSON.stringify(this.right.funcid) + '](' + ss.join(',') + ')';
10845
10860
  } else {
10846
10861
  s = '' + ljs + '[' + rightJS() + ']';
10847
10862
  }
@@ -11816,10 +11831,13 @@ stdlib.MIN = stdlib.LEAST = function () {
11816
11831
  );
11817
11832
  };
11818
11833
 
11819
- stdlib.SUBSTRING = stdlib.SUBSTR = stdlib.MID = function (a, b, c) {
11820
- if (arguments.length == 2) return und(a, 'y.substr(' + b + '-1)');
11821
- else if (arguments.length == 3) return und(a, 'y.substr(' + b + '-1,' + c + ')');
11822
- };
11834
+ stdlib.SUBSTRING =
11835
+ stdlib.SUBSTR =
11836
+ stdlib.MID =
11837
+ function (a, b, c) {
11838
+ if (arguments.length == 2) return und(a, 'y.substr(' + b + '-1)');
11839
+ else if (arguments.length == 3) return und(a, 'y.substr(' + b + '-1,' + c + ')');
11840
+ };
11823
11841
 
11824
11842
  stdfn.REGEXP_LIKE = function (a, b, c) {
11825
11843
 
@@ -12043,13 +12061,16 @@ alasql.aggr.VARP = function (v, s, stage) {
12043
12061
  }
12044
12062
  };
12045
12063
 
12046
- alasql.aggr.STD = alasql.aggr.STDDEV = alasql.aggr.STDEVP = function (v, s, stage) {
12047
- if (stage == 1 || stage == 2) {
12048
- return alasql.aggr.VARP(v, s, stage);
12049
- } else {
12050
- return Math.sqrt(alasql.aggr.VARP(v, s, stage));
12051
- }
12052
- };
12064
+ alasql.aggr.STD =
12065
+ alasql.aggr.STDDEV =
12066
+ alasql.aggr.STDEVP =
12067
+ function (v, s, stage) {
12068
+ if (stage == 1 || stage == 2) {
12069
+ return alasql.aggr.VARP(v, s, stage);
12070
+ } else {
12071
+ return Math.sqrt(alasql.aggr.VARP(v, s, stage));
12072
+ }
12073
+ };
12053
12074
 
12054
12075
  alasql._aggrOriginal = alasql.aggr;
12055
12076
  alasql.aggr = {};
@@ -12071,34 +12092,37 @@ for (var i = 0; i < 256; i++) {
12071
12092
  lut[i] = (i < 16 ? '0' : '') + i.toString(16);
12072
12093
  }
12073
12094
 
12074
- stdfn.NEWID = stdfn.UUID = stdfn.GEN_RANDOM_UUID = function () {
12075
- var d0 = (Math.random() * 0xffffffff) | 0;
12076
- var d1 = (Math.random() * 0xffffffff) | 0;
12077
- var d2 = (Math.random() * 0xffffffff) | 0;
12078
- var d3 = (Math.random() * 0xffffffff) | 0;
12079
- return (
12080
- lut[d0 & 0xff] +
12081
- lut[(d0 >> 8) & 0xff] +
12082
- lut[(d0 >> 16) & 0xff] +
12083
- lut[(d0 >> 24) & 0xff] +
12084
- '-' +
12085
- lut[d1 & 0xff] +
12086
- lut[(d1 >> 8) & 0xff] +
12087
- '-' +
12088
- lut[((d1 >> 16) & 0x0f) | 0x40] +
12089
- lut[(d1 >> 24) & 0xff] +
12090
- '-' +
12091
- lut[(d2 & 0x3f) | 0x80] +
12092
- lut[(d2 >> 8) & 0xff] +
12093
- '-' +
12094
- lut[(d2 >> 16) & 0xff] +
12095
- lut[(d2 >> 24) & 0xff] +
12096
- lut[d3 & 0xff] +
12097
- lut[(d3 >> 8) & 0xff] +
12098
- lut[(d3 >> 16) & 0xff] +
12099
- lut[(d3 >> 24) & 0xff]
12100
- );
12101
- };
12095
+ stdfn.NEWID =
12096
+ stdfn.UUID =
12097
+ stdfn.GEN_RANDOM_UUID =
12098
+ function () {
12099
+ var d0 = (Math.random() * 0xffffffff) | 0;
12100
+ var d1 = (Math.random() * 0xffffffff) | 0;
12101
+ var d2 = (Math.random() * 0xffffffff) | 0;
12102
+ var d3 = (Math.random() * 0xffffffff) | 0;
12103
+ return (
12104
+ lut[d0 & 0xff] +
12105
+ lut[(d0 >> 8) & 0xff] +
12106
+ lut[(d0 >> 16) & 0xff] +
12107
+ lut[(d0 >> 24) & 0xff] +
12108
+ '-' +
12109
+ lut[d1 & 0xff] +
12110
+ lut[(d1 >> 8) & 0xff] +
12111
+ '-' +
12112
+ lut[((d1 >> 16) & 0x0f) | 0x40] +
12113
+ lut[(d1 >> 24) & 0xff] +
12114
+ '-' +
12115
+ lut[(d2 & 0x3f) | 0x80] +
12116
+ lut[(d2 >> 8) & 0xff] +
12117
+ '-' +
12118
+ lut[(d2 >> 16) & 0xff] +
12119
+ lut[(d2 >> 24) & 0xff] +
12120
+ lut[d3 & 0xff] +
12121
+ lut[(d3 >> 8) & 0xff] +
12122
+ lut[(d3 >> 16) & 0xff] +
12123
+ lut[(d3 >> 24) & 0xff]
12124
+ );
12125
+ };
12102
12126
 
12103
12127
  /*
12104
12128
  //
@@ -18750,6 +18774,7 @@ LS.dropDatabase = function (lsdbid, ifexists, cb) {
18750
18774
 
18751
18775
  LS.attachDatabase = function (lsdbid, databaseid, args, params, cb) {
18752
18776
  var res = 1;
18777
+ // console.warn({lsdbid, databaseid, args, params, cb, dbs: Object.keys(alasql.databases)})
18753
18778
  if (alasql.databases[databaseid]) {
18754
18779
  throw new Error('Unable to attach database as "' + databaseid + '" because it already exists');
18755
18780
  }
@@ -19652,7 +19677,14 @@ var saveAs =
19652
19677
  FS_proto.WRITING = 1;
19653
19678
  FS_proto.DONE = 2;
19654
19679
 
19655
- FS_proto.error = FS_proto.onwritestart = FS_proto.onprogress = FS_proto.onwrite = FS_proto.onabort = FS_proto.onerror = FS_proto.onwriteend = null;
19680
+ FS_proto.error =
19681
+ FS_proto.onwritestart =
19682
+ FS_proto.onprogress =
19683
+ FS_proto.onwrite =
19684
+ FS_proto.onabort =
19685
+ FS_proto.onerror =
19686
+ FS_proto.onwriteend =
19687
+ null;
19656
19688
 
19657
19689
  return saveAs;
19658
19690
  })(