alasql 2.5.5 → 3.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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  - _Have a question? Ask on [Stack Overflow](http://stackoverflow.com/questions/ask?tags=AlaSQL) using the "alasql" tag._
4
4
 
5
- - _Wondering if you should upgrade to v2? You probably should, but check the two breaking changes [here](https://github.com/AlaSQL/alasql/releases/tag/v2.0.1)_
5
+ - _Wondering if you should upgrade to v3? You probably should, unless you are using WebSQL. Check the the breaking changes [here](https://github.com/AlaSQL/alasql/releases/tag/v3.0.0)_
6
6
 
7
7
 
8
8
  [![CI-test](https://github.com/alasql/alasql/workflows/CI-test/badge.svg)](https://github.com/alasql/alasql/actions)
@@ -113,14 +113,14 @@ yarn add alasql # yarn
113
113
 
114
114
  npm install alasql # npm
115
115
 
116
- npm install -g alasql # global installation for command line tools
116
+ npm install -g alasql # global install of command line tool
117
117
  ```
118
118
 
119
- For the browser: include [alasql.min.js](https://cdn.jsdelivr.net/npm/alasql)
119
+ For the browsers: include [alasql.min.js](https://cdn.jsdelivr.net/npm/alasql)
120
120
 
121
121
 
122
122
  ```html
123
- <script src="https://cdn.jsdelivr.net/npm/alasql@2"></script>
123
+ <script src="https://cdn.jsdelivr.net/npm/alasql@3"></script>
124
124
  ```
125
125
 
126
126
 
@@ -645,7 +645,6 @@ and other people for useful tools, which make our work much easier.
645
645
  ### Related projects that have inspired us
646
646
 
647
647
  * [AlaX](http://github.com/alasql/alax) - Export to Excel with colors and formats
648
- * [WebSQLShim](http://github.com/alasql/WebSQLShim) - WebSQL shim over IndexedDB (work in progress)
649
648
  * [AlaMDX](http://github.com/alasql/alamdx) - JavaScript MDX OLAP library (work in progress)
650
649
  * [Other similar projects](http://github.com/alasql/alasql/wiki/Similar-Projects.md) - list of databases on JavaScript
651
650
 
package/bin/alasql-cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  //
4
4
  // Command line interface for Alasql
5
- // Version: 2.5.5
5
+ // Version: 3.0.1
6
6
  // Date: 28.07.2015
7
7
  // (c) 2014-2022, Andrey Gershun & Mathias Wulff
8
8
  //
@@ -1,7 +1,7 @@
1
- //! AlaSQL v2.5.5 build: v2-hotfix-8eb69ccf | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v3.0.1 build: develop-26e0bfa8 | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 2.5.5
4
+ @version 3.0.1
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2023 Andrey Gershun & Mathias Wulff
@@ -1,2 +1,2 @@
1
- //! AlaSQL v2.5.5 build: v2-hotfix-8eb69ccf | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v3.0.1 build: develop-26e0bfa8 | © 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 v2.5.5 build: v2-hotfix-8eb69ccf | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v3.0.1 build: develop-26e0bfa8 | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 2.5.5
4
+ @version 3.0.1
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 = '2.5.5';
146
- alasql.build = 'v2-hotfix-8eb69ccf';
145
+ alasql.version = '3.0.1';
146
+ alasql.build = 'develop-26e0bfa8';
147
147
 
148
148
  /**
149
149
  Debug flag
@@ -9062,10 +9062,9 @@ function compileSelectStar(query, aliases, joinstar) {
9062
9062
 
9063
9063
  if (columns && columns.length > 0) {
9064
9064
  columns.forEach(function (tcol) {
9065
- const escapedColumnId = escapeq(tcol.columnid);
9066
9065
  if (joinstar && alasql.options.joinstar == 'underscore') {
9067
9066
  ss.push(
9068
- "'" + alias + '_' + escapedColumnId + "':p['" + alias + "']['" + escapedColumnId + "']"
9067
+ "'" + alias + '_' + tcol.columnid + "':p['" + alias + "']['" + tcol.columnid + "']"
9069
9068
  );
9070
9069
  } else if (joinstar && alasql.options.joinstar == 'json') {
9071
9070
  // ss.push('\''+alias+'_'+tcol.columnid+'\':p[\''+alias+'\'][\''+tcol.columnid+'\']');
@@ -9073,16 +9072,16 @@ function compileSelectStar(query, aliases, joinstar) {
9073
9072
  "r['" +
9074
9073
  alias +
9075
9074
  "']['" +
9076
- escapedColumnId +
9075
+ tcol.columnid +
9077
9076
  "']=p['" +
9078
9077
  alias +
9079
9078
  "']['" +
9080
- escapedColumnId +
9079
+ tcol.columnid +
9081
9080
  "'];";
9082
9081
  } else {
9083
- var value = "p['" + alias + "']['" + escapedColumnId + "']";
9082
+ var value = "p['" + alias + "']['" + tcol.columnid + "']";
9084
9083
  if (!columnIds[tcol.columnid]) {
9085
- var key = "'" + escapedColumnId + "':";
9084
+ var key = "'" + tcol.columnid + "':";
9086
9085
  ss.push(key + value);
9087
9086
  columnIds[tcol.columnid] = {
9088
9087
  id: ss.length - 1,
@@ -9097,7 +9096,7 @@ function compileSelectStar(query, aliases, joinstar) {
9097
9096
  }
9098
9097
  }
9099
9098
 
9100
- query.selectColumns[escapedColumnId] = true;
9099
+ query.selectColumns[escapeq(tcol.columnid)] = true;
9101
9100
 
9102
9101
  var coldef = {
9103
9102
  columnid: tcol.columnid,
@@ -10575,7 +10574,7 @@ yy.Over = class Over {
10575
10574
  var ljs = '(' + leftJS() + '||{})';
10576
10575
 
10577
10576
  if (typeof this.right === 'string') {
10578
- s = ljs + '["' + escapeq(this.right) + '"]';
10577
+ s = ljs + '["' + this.right + '"]';
10579
10578
  } else if (typeof this.right === 'number') {
10580
10579
  s = ljs + '[' + this.right + ']';
10581
10580
  } else if (this.right instanceof yy.FuncValue) {
@@ -10814,7 +10813,7 @@ yy.Over = class Over {
10814
10813
  }
10815
10814
 
10816
10815
  toJS() {
10817
- return "alasql.vars['" + escapeq(this.variable) + "']";
10816
+ return "alasql.vars['" + this.variable + "']";
10818
10817
  }
10819
10818
  }
10820
10819
 
@@ -11203,7 +11202,7 @@ yy.Over = class Over {
11203
11202
  toJS() {
11204
11203
  var colas = this.nick;
11205
11204
  if (colas === undefined) {
11206
- colas = escapeq(this.toString());
11205
+ colas = this.toString();
11207
11206
  }
11208
11207
  return "g['" + colas + "']";
11209
11208
  }
@@ -17888,43 +17887,6 @@ yy.Assert.prototype.execute = function (databaseid) {
17888
17887
  return 1;
17889
17888
  };
17890
17889
 
17891
- //
17892
- // 91websql.js
17893
- // WebSQL database support
17894
- // (c) 2014, Andrey Gershun
17895
- //
17896
-
17897
- var WEBSQL = (alasql.engines.WEBSQL = function () {});
17898
-
17899
- WEBSQL.createDatabase = function (wdbid, args, dbid, cb) {
17900
- var res = 1;
17901
- var wdb = openDatabase(wdbid, args[0], args[1], args[2]);
17902
- if (this.dbid) {
17903
- var db = alasql.createDatabase(this.dbid);
17904
- db.engineid = 'WEBSQL';
17905
- db.wdbid = wdbid;
17906
- db.wdb = db;
17907
- }
17908
- if (!wdb) {
17909
- throw new Error('Cannot create WebSQL database "' + this.dbid + '"');
17910
- }
17911
- if (cb) cb(res);
17912
- return res;
17913
- };
17914
-
17915
- WEBSQL.dropDatabase = function (databaseid) {
17916
- throw new Error('This is impossible to drop WebSQL database.');
17917
- };
17918
-
17919
- WEBSQL.attachDatabase = function (databaseid, dbid, args, params, cb) {
17920
- var res = 1;
17921
- if (alasql.databases[dbid]) {
17922
- throw new Error('Unable to attach database as "' + dbid + '" because it already exists');
17923
- }
17924
- alasql.openDatabase(databaseid, args[0], args[1], args[2]);
17925
- return res;
17926
- };
17927
-
17928
17890
  //
17929
17891
  // 91indexeddb.js
17930
17892
  // AlaSQL IndexedDB module
@@ -18727,8 +18689,8 @@ LS.rollback = function (databaseid, cb) {
18727
18689
  };
18728
18690
 
18729
18691
  //
18730
- // 91websql.js
18731
- // WebSQL database support
18692
+ // 93sqlite.js
18693
+ // SQLite database support
18732
18694
  // (c) 2014, Andrey Gershun
18733
18695
  //
18734
18696
 
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v2.5.5 build: v2-hotfix-8eb69ccf | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v3.0.1 build: develop-26e0bfa8 | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 2.5.5
4
+ @version 3.0.1
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 = '2.5.5';
146
- alasql.build = 'v2-hotfix-8eb69ccf';
145
+ alasql.version = '3.0.1';
146
+ alasql.build = 'develop-26e0bfa8';
147
147
 
148
148
  /**
149
149
  Debug flag
@@ -9062,10 +9062,9 @@ function compileSelectStar(query, aliases, joinstar) {
9062
9062
 
9063
9063
  if (columns && columns.length > 0) {
9064
9064
  columns.forEach(function (tcol) {
9065
- const escapedColumnId = escapeq(tcol.columnid);
9066
9065
  if (joinstar && alasql.options.joinstar == 'underscore') {
9067
9066
  ss.push(
9068
- "'" + alias + '_' + escapedColumnId + "':p['" + alias + "']['" + escapedColumnId + "']"
9067
+ "'" + alias + '_' + tcol.columnid + "':p['" + alias + "']['" + tcol.columnid + "']"
9069
9068
  );
9070
9069
  } else if (joinstar && alasql.options.joinstar == 'json') {
9071
9070
  // ss.push('\''+alias+'_'+tcol.columnid+'\':p[\''+alias+'\'][\''+tcol.columnid+'\']');
@@ -9073,16 +9072,16 @@ function compileSelectStar(query, aliases, joinstar) {
9073
9072
  "r['" +
9074
9073
  alias +
9075
9074
  "']['" +
9076
- escapedColumnId +
9075
+ tcol.columnid +
9077
9076
  "']=p['" +
9078
9077
  alias +
9079
9078
  "']['" +
9080
- escapedColumnId +
9079
+ tcol.columnid +
9081
9080
  "'];";
9082
9081
  } else {
9083
- var value = "p['" + alias + "']['" + escapedColumnId + "']";
9082
+ var value = "p['" + alias + "']['" + tcol.columnid + "']";
9084
9083
  if (!columnIds[tcol.columnid]) {
9085
- var key = "'" + escapedColumnId + "':";
9084
+ var key = "'" + tcol.columnid + "':";
9086
9085
  ss.push(key + value);
9087
9086
  columnIds[tcol.columnid] = {
9088
9087
  id: ss.length - 1,
@@ -9097,7 +9096,7 @@ function compileSelectStar(query, aliases, joinstar) {
9097
9096
  }
9098
9097
  }
9099
9098
 
9100
- query.selectColumns[escapedColumnId] = true;
9099
+ query.selectColumns[escapeq(tcol.columnid)] = true;
9101
9100
 
9102
9101
  var coldef = {
9103
9102
  columnid: tcol.columnid,
@@ -10575,7 +10574,7 @@ yy.Over = class Over {
10575
10574
  var ljs = '(' + leftJS() + '||{})';
10576
10575
 
10577
10576
  if (typeof this.right === 'string') {
10578
- s = ljs + '["' + escapeq(this.right) + '"]';
10577
+ s = ljs + '["' + this.right + '"]';
10579
10578
  } else if (typeof this.right === 'number') {
10580
10579
  s = ljs + '[' + this.right + ']';
10581
10580
  } else if (this.right instanceof yy.FuncValue) {
@@ -10814,7 +10813,7 @@ yy.Over = class Over {
10814
10813
  }
10815
10814
 
10816
10815
  toJS() {
10817
- return "alasql.vars['" + escapeq(this.variable) + "']";
10816
+ return "alasql.vars['" + this.variable + "']";
10818
10817
  }
10819
10818
  }
10820
10819
 
@@ -11203,7 +11202,7 @@ yy.Over = class Over {
11203
11202
  toJS() {
11204
11203
  var colas = this.nick;
11205
11204
  if (colas === undefined) {
11206
- colas = escapeq(this.toString());
11205
+ colas = this.toString();
11207
11206
  }
11208
11207
  return "g['" + colas + "']";
11209
11208
  }
@@ -17888,43 +17887,6 @@ yy.Assert.prototype.execute = function (databaseid) {
17888
17887
  return 1;
17889
17888
  };
17890
17889
 
17891
- //
17892
- // 91websql.js
17893
- // WebSQL database support
17894
- // (c) 2014, Andrey Gershun
17895
- //
17896
-
17897
- var WEBSQL = (alasql.engines.WEBSQL = function () {});
17898
-
17899
- WEBSQL.createDatabase = function (wdbid, args, dbid, cb) {
17900
- var res = 1;
17901
- var wdb = openDatabase(wdbid, args[0], args[1], args[2]);
17902
- if (this.dbid) {
17903
- var db = alasql.createDatabase(this.dbid);
17904
- db.engineid = 'WEBSQL';
17905
- db.wdbid = wdbid;
17906
- db.wdb = db;
17907
- }
17908
- if (!wdb) {
17909
- throw new Error('Cannot create WebSQL database "' + this.dbid + '"');
17910
- }
17911
- if (cb) cb(res);
17912
- return res;
17913
- };
17914
-
17915
- WEBSQL.dropDatabase = function (databaseid) {
17916
- throw new Error('This is impossible to drop WebSQL database.');
17917
- };
17918
-
17919
- WEBSQL.attachDatabase = function (databaseid, dbid, args, params, cb) {
17920
- var res = 1;
17921
- if (alasql.databases[dbid]) {
17922
- throw new Error('Unable to attach database as "' + dbid + '" because it already exists');
17923
- }
17924
- alasql.openDatabase(databaseid, args[0], args[1], args[2]);
17925
- return res;
17926
- };
17927
-
17928
17890
  //
17929
17891
  // 91indexeddb.js
17930
17892
  // AlaSQL IndexedDB module
@@ -18727,8 +18689,8 @@ LS.rollback = function (databaseid, cb) {
18727
18689
  };
18728
18690
 
18729
18691
  //
18730
- // 91websql.js
18731
- // WebSQL database support
18692
+ // 93sqlite.js
18693
+ // SQLite database support
18732
18694
  // (c) 2014, Andrey Gershun
18733
18695
  //
18734
18696