alasql 3.1.0 → 4.0.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.
@@ -1,7 +1,7 @@
1
- //! AlaSQL v3.0.0 build: develop-4287740e | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.0.0 build: develop-17e468d3 | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 3.0.0
4
+ @version 4.0.0
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2023 Andrey Gershun & Mathias Wulff
@@ -1,2 +1,2 @@
1
- //! AlaSQL v3.0.0 build: develop-4287740e | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.0.0 build: develop-17e468d3 | © 2014-2023 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 v3.0.0 build: develop-4287740e | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.0.0 build: develop-17e468d3 | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 3.0.0
4
+ @version 4.0.0
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2023 Andrey Gershun & Mathias Wulff
@@ -142,8 +142,8 @@ var alasql = function(sql, params, cb, scope) {
142
142
  Current version of alasql
143
143
  @constant {string}
144
144
  */
145
- alasql.version = '3.0.0';
146
- alasql.build = 'develop-4287740e';
145
+ alasql.version = '4.0.0';
146
+ alasql.build = 'develop-17e468d3';
147
147
 
148
148
  /**
149
149
  Debug flag
@@ -3697,7 +3697,7 @@ var loadBinaryFile = (utils.loadBinaryFile = function (
3697
3697
  var data = e.target.result;
3698
3698
  success(data);
3699
3699
  };
3700
- reader.onerror = error();
3700
+ reader.onerror = error;
3701
3701
  reader.readAsArrayBuffer(files[0]);
3702
3702
  } else if (path instanceof Blob) {
3703
3703
  success(path);
@@ -4485,7 +4485,7 @@ alasql.options = {
4485
4485
  errorlog: false,
4486
4486
 
4487
4487
  /** Use valueof in orderfn */
4488
- valueof: false,
4488
+ valueof: true,
4489
4489
 
4490
4490
  /** DROP database in any case */
4491
4491
  dropifnotexists: false,
@@ -9606,7 +9606,9 @@ yy.Select.prototype.compileOrder = function (query, params) {
9606
9606
  //if(alasql.options.valueof)
9607
9607
  if (ord.expression instanceof yy.Column) {
9608
9608
  var columnid = ord.expression.columnid;
9609
- if (query.xcolumns[columnid]) {
9609
+ if (alasql.options.valueof) {
9610
+ dg = '.valueOf()';
9611
+ } else if (query.xcolumns[columnid]) {
9610
9612
  var dbtypeid = query.xcolumns[columnid].dbtypeid;
9611
9613
  if (
9612
9614
  dbtypeid == 'DATE' ||
@@ -9617,14 +9619,13 @@ yy.Select.prototype.compileOrder = function (query, params) {
9617
9619
  )
9618
9620
  dg = '.valueOf()';
9619
9621
  // TODO Add other types mapping
9620
- } else {
9621
- if (alasql.options.valueof) dg = '.valueOf()'; // TODO Check
9622
9622
  }
9623
- // dg = '.valueOf()';
9624
9623
  }
9625
9624
  if (ord.expression instanceof yy.ParamValue) {
9626
9625
  var columnid = params[ord.expression.param];
9627
- if (query.xcolumns[columnid]) {
9626
+ if (alasql.options.valueof) {
9627
+ dg = '.valueOf()';
9628
+ } else if (query.xcolumns[columnid]) {
9628
9629
  var dbtypeid = query.xcolumns[columnid].dbtypeid;
9629
9630
  if (
9630
9631
  dbtypeid == 'DATE' ||
@@ -9635,10 +9636,7 @@ yy.Select.prototype.compileOrder = function (query, params) {
9635
9636
  )
9636
9637
  dg = '.valueOf()';
9637
9638
  // TODO Add other types mapping
9638
- } else {
9639
- if (alasql.options.valueof) dg = '.valueOf()'; // TODO Check
9640
9639
  }
9641
- // dg = '.valueOf()';
9642
9640
  }
9643
9641
  // COLLATE NOCASE
9644
9642
  if (ord.nocase) dg += '.toUpperCase()';
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v3.0.0 build: develop-4287740e | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.0.0 build: develop-17e468d3 | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 3.0.0
4
+ @version 4.0.0
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2023 Andrey Gershun & Mathias Wulff
@@ -142,8 +142,8 @@ var alasql = function(sql, params, cb, scope) {
142
142
  Current version of alasql
143
143
  @constant {string}
144
144
  */
145
- alasql.version = '3.0.0';
146
- alasql.build = 'develop-4287740e';
145
+ alasql.version = '4.0.0';
146
+ alasql.build = 'develop-17e468d3';
147
147
 
148
148
  /**
149
149
  Debug flag
@@ -3697,7 +3697,7 @@ var loadBinaryFile = (utils.loadBinaryFile = function (
3697
3697
  var data = e.target.result;
3698
3698
  success(data);
3699
3699
  };
3700
- reader.onerror = error();
3700
+ reader.onerror = error;
3701
3701
  reader.readAsArrayBuffer(files[0]);
3702
3702
  } else if (path instanceof Blob) {
3703
3703
  success(path);
@@ -4485,7 +4485,7 @@ alasql.options = {
4485
4485
  errorlog: false,
4486
4486
 
4487
4487
  /** Use valueof in orderfn */
4488
- valueof: false,
4488
+ valueof: true,
4489
4489
 
4490
4490
  /** DROP database in any case */
4491
4491
  dropifnotexists: false,
@@ -9606,7 +9606,9 @@ yy.Select.prototype.compileOrder = function (query, params) {
9606
9606
  //if(alasql.options.valueof)
9607
9607
  if (ord.expression instanceof yy.Column) {
9608
9608
  var columnid = ord.expression.columnid;
9609
- if (query.xcolumns[columnid]) {
9609
+ if (alasql.options.valueof) {
9610
+ dg = '.valueOf()';
9611
+ } else if (query.xcolumns[columnid]) {
9610
9612
  var dbtypeid = query.xcolumns[columnid].dbtypeid;
9611
9613
  if (
9612
9614
  dbtypeid == 'DATE' ||
@@ -9617,14 +9619,13 @@ yy.Select.prototype.compileOrder = function (query, params) {
9617
9619
  )
9618
9620
  dg = '.valueOf()';
9619
9621
  // TODO Add other types mapping
9620
- } else {
9621
- if (alasql.options.valueof) dg = '.valueOf()'; // TODO Check
9622
9622
  }
9623
- // dg = '.valueOf()';
9624
9623
  }
9625
9624
  if (ord.expression instanceof yy.ParamValue) {
9626
9625
  var columnid = params[ord.expression.param];
9627
- if (query.xcolumns[columnid]) {
9626
+ if (alasql.options.valueof) {
9627
+ dg = '.valueOf()';
9628
+ } else if (query.xcolumns[columnid]) {
9628
9629
  var dbtypeid = query.xcolumns[columnid].dbtypeid;
9629
9630
  if (
9630
9631
  dbtypeid == 'DATE' ||
@@ -9635,10 +9636,7 @@ yy.Select.prototype.compileOrder = function (query, params) {
9635
9636
  )
9636
9637
  dg = '.valueOf()';
9637
9638
  // TODO Add other types mapping
9638
- } else {
9639
- if (alasql.options.valueof) dg = '.valueOf()'; // TODO Check
9640
9639
  }
9641
- // dg = '.valueOf()';
9642
9640
  }
9643
9641
  // COLLATE NOCASE
9644
9642
  if (ord.nocase) dg += '.toUpperCase()';