alasql 4.0.5 → 4.1.0
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 +21 -10
- package/dist/alasql.js +21 -10
- package/dist/alasql.min.js +3 -3
- package/package.json +1 -1
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.0.
|
|
1
|
+
//! AlaSQL v4.0.6 build: develop-01a11a12 | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.0.
|
|
4
|
+
@version 4.0.6
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2023 Andrey Gershun & Mathias Wulff
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
//! AlaSQL v4.0.
|
|
1
|
+
//! AlaSQL v4.0.6 build: develop-01a11a12 | © 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 v4.0.
|
|
1
|
+
//! AlaSQL v4.0.6 build: develop-01a11a12 | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.0.
|
|
4
|
+
@version 4.0.6
|
|
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 = '4.0.
|
|
146
|
-
alasql.build = 'develop-
|
|
145
|
+
alasql.version = '4.0.6';
|
|
146
|
+
alasql.build = 'develop-01a11a12';
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
149
|
Debug flag
|
|
@@ -15156,8 +15156,9 @@ yy.Declare.prototype.toString = function () {
|
|
|
15156
15156
|
|
|
15157
15157
|
yy.Declare.prototype.execute = function (databaseid, params, cb) {
|
|
15158
15158
|
var res = 1;
|
|
15159
|
-
|
|
15160
|
-
|
|
15159
|
+
var that = this; // without this assigned to a variable, inside the forEach, the reference to `this` is lost. It is needed for the Function statement for binding
|
|
15160
|
+
if (that.declares && that.declares.length > 0) {
|
|
15161
|
+
that.declares.forEach(function (declare) {
|
|
15161
15162
|
var dbtypeid = declare.dbtypeid;
|
|
15162
15163
|
if (!alasql.fn[dbtypeid]) {
|
|
15163
15164
|
dbtypeid = dbtypeid.toUpperCase();
|
|
@@ -15174,7 +15175,7 @@ yy.Declare.prototype.execute = function (databaseid, params, cb) {
|
|
|
15174
15175
|
alasql.vars[declare.variable] = new Function(
|
|
15175
15176
|
'params,alasql',
|
|
15176
15177
|
'return ' + declare.expression.toJS('({})', '', null)
|
|
15177
|
-
)(params, alasql);
|
|
15178
|
+
).bind(that)(params, alasql);
|
|
15178
15179
|
if (alasql.declares[declare.variable]) {
|
|
15179
15180
|
alasql.vars[declare.variable] = alasql.stdfn.CONVERT(
|
|
15180
15181
|
alasql.vars[declare.variable],
|
|
@@ -17172,6 +17173,7 @@ alasql.from.CSV = function (contents, opts, cb, idx, query) {
|
|
|
17172
17173
|
separator: ',',
|
|
17173
17174
|
quote: '"',
|
|
17174
17175
|
headers: true,
|
|
17176
|
+
raw: false
|
|
17175
17177
|
};
|
|
17176
17178
|
alasql.utils.extend(opt, opts);
|
|
17177
17179
|
var res;
|
|
@@ -17254,7 +17256,7 @@ alasql.from.CSV = function (contents, opts, cb, idx, query) {
|
|
|
17254
17256
|
hs.forEach(function (h, idx) {
|
|
17255
17257
|
r[h] = a[idx];
|
|
17256
17258
|
// Please avoid === here
|
|
17257
|
-
if (typeof r[h] !== 'undefined' && r[h].length !== 0 && r[h].trim() == +r[h]) {
|
|
17259
|
+
if (!opt.raw && typeof r[h] !== 'undefined' && r[h].length !== 0 && r[h].trim() == +r[h]) {
|
|
17258
17260
|
// jshint ignore:line
|
|
17259
17261
|
r[h] = +r[h];
|
|
17260
17262
|
}
|
|
@@ -17265,7 +17267,7 @@ alasql.from.CSV = function (contents, opts, cb, idx, query) {
|
|
|
17265
17267
|
var r = {};
|
|
17266
17268
|
hs.forEach(function (h, idx) {
|
|
17267
17269
|
r[h] = a[idx];
|
|
17268
|
-
if (typeof r[h] !== 'undefined' && r[h].length !== 0 && r[h].trim() == +r[h]) {
|
|
17270
|
+
if (!opt.raw && typeof r[h] !== 'undefined' && r[h].length !== 0 && r[h].trim() == +r[h]) {
|
|
17269
17271
|
// jshint ignore:line
|
|
17270
17272
|
r[h] = +r[h];
|
|
17271
17273
|
}
|
|
@@ -17274,7 +17276,16 @@ alasql.from.CSV = function (contents, opts, cb, idx, query) {
|
|
|
17274
17276
|
}
|
|
17275
17277
|
n++;
|
|
17276
17278
|
} else {
|
|
17277
|
-
|
|
17279
|
+
var r = {};
|
|
17280
|
+
// different bug here, if headers are not defined, the numerical values will not be parsed
|
|
17281
|
+
a.forEach(function (v, idx) {
|
|
17282
|
+
r[idx] = a[idx];
|
|
17283
|
+
if (!opt.raw && typeof r[idx] !== 'undefined' && r[idx].length !== 0 && r[idx].trim() == +r[idx]) {
|
|
17284
|
+
// jshint ignore:line
|
|
17285
|
+
r[idx] = +r[idx];
|
|
17286
|
+
}
|
|
17287
|
+
});
|
|
17288
|
+
rows.push(r);
|
|
17278
17289
|
}
|
|
17279
17290
|
}
|
|
17280
17291
|
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.0.
|
|
1
|
+
//! AlaSQL v4.0.6 build: develop-01a11a12 | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.0.
|
|
4
|
+
@version 4.0.6
|
|
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 = '4.0.
|
|
146
|
-
alasql.build = 'develop-
|
|
145
|
+
alasql.version = '4.0.6';
|
|
146
|
+
alasql.build = 'develop-01a11a12';
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
149
|
Debug flag
|
|
@@ -15156,8 +15156,9 @@ yy.Declare.prototype.toString = function () {
|
|
|
15156
15156
|
|
|
15157
15157
|
yy.Declare.prototype.execute = function (databaseid, params, cb) {
|
|
15158
15158
|
var res = 1;
|
|
15159
|
-
|
|
15160
|
-
|
|
15159
|
+
var that = this; // without this assigned to a variable, inside the forEach, the reference to `this` is lost. It is needed for the Function statement for binding
|
|
15160
|
+
if (that.declares && that.declares.length > 0) {
|
|
15161
|
+
that.declares.forEach(function (declare) {
|
|
15161
15162
|
var dbtypeid = declare.dbtypeid;
|
|
15162
15163
|
if (!alasql.fn[dbtypeid]) {
|
|
15163
15164
|
dbtypeid = dbtypeid.toUpperCase();
|
|
@@ -15174,7 +15175,7 @@ yy.Declare.prototype.execute = function (databaseid, params, cb) {
|
|
|
15174
15175
|
alasql.vars[declare.variable] = new Function(
|
|
15175
15176
|
'params,alasql',
|
|
15176
15177
|
'return ' + declare.expression.toJS('({})', '', null)
|
|
15177
|
-
)(params, alasql);
|
|
15178
|
+
).bind(that)(params, alasql);
|
|
15178
15179
|
if (alasql.declares[declare.variable]) {
|
|
15179
15180
|
alasql.vars[declare.variable] = alasql.stdfn.CONVERT(
|
|
15180
15181
|
alasql.vars[declare.variable],
|
|
@@ -17172,6 +17173,7 @@ alasql.from.CSV = function (contents, opts, cb, idx, query) {
|
|
|
17172
17173
|
separator: ',',
|
|
17173
17174
|
quote: '"',
|
|
17174
17175
|
headers: true,
|
|
17176
|
+
raw: false
|
|
17175
17177
|
};
|
|
17176
17178
|
alasql.utils.extend(opt, opts);
|
|
17177
17179
|
var res;
|
|
@@ -17254,7 +17256,7 @@ alasql.from.CSV = function (contents, opts, cb, idx, query) {
|
|
|
17254
17256
|
hs.forEach(function (h, idx) {
|
|
17255
17257
|
r[h] = a[idx];
|
|
17256
17258
|
// Please avoid === here
|
|
17257
|
-
if (typeof r[h] !== 'undefined' && r[h].length !== 0 && r[h].trim() == +r[h]) {
|
|
17259
|
+
if (!opt.raw && typeof r[h] !== 'undefined' && r[h].length !== 0 && r[h].trim() == +r[h]) {
|
|
17258
17260
|
// jshint ignore:line
|
|
17259
17261
|
r[h] = +r[h];
|
|
17260
17262
|
}
|
|
@@ -17265,7 +17267,7 @@ alasql.from.CSV = function (contents, opts, cb, idx, query) {
|
|
|
17265
17267
|
var r = {};
|
|
17266
17268
|
hs.forEach(function (h, idx) {
|
|
17267
17269
|
r[h] = a[idx];
|
|
17268
|
-
if (typeof r[h] !== 'undefined' && r[h].length !== 0 && r[h].trim() == +r[h]) {
|
|
17270
|
+
if (!opt.raw && typeof r[h] !== 'undefined' && r[h].length !== 0 && r[h].trim() == +r[h]) {
|
|
17269
17271
|
// jshint ignore:line
|
|
17270
17272
|
r[h] = +r[h];
|
|
17271
17273
|
}
|
|
@@ -17274,7 +17276,16 @@ alasql.from.CSV = function (contents, opts, cb, idx, query) {
|
|
|
17274
17276
|
}
|
|
17275
17277
|
n++;
|
|
17276
17278
|
} else {
|
|
17277
|
-
|
|
17279
|
+
var r = {};
|
|
17280
|
+
// different bug here, if headers are not defined, the numerical values will not be parsed
|
|
17281
|
+
a.forEach(function (v, idx) {
|
|
17282
|
+
r[idx] = a[idx];
|
|
17283
|
+
if (!opt.raw && typeof r[idx] !== 'undefined' && r[idx].length !== 0 && r[idx].trim() == +r[idx]) {
|
|
17284
|
+
// jshint ignore:line
|
|
17285
|
+
r[idx] = +r[idx];
|
|
17286
|
+
}
|
|
17287
|
+
});
|
|
17288
|
+
rows.push(r);
|
|
17278
17289
|
}
|
|
17279
17290
|
}
|
|
17280
17291
|
|