alasql 1.7.4 → 1.7.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/.github/workflows/nodejs.yml +1 -1
- package/README.md +7 -9
- package/bin/alasql-cli.js +1 -1
- package/dist/alasql-worker.js +2 -2
- package/dist/alasql-worker.min.js +2 -2
- package/dist/alasql.fs.js +72 -56
- package/dist/alasql.js +72 -56
- package/dist/alasql.min.js +2 -2
- package/package/dist/alasql-echo.js +20 -0
- package/package/dist/alasql-prolog.js +51 -0
- package/package/dist/alasql-worker.js +245 -0
- package/package/dist/alasql-worker.min.js +2 -0
- package/package/dist/alasql.d.ts +88 -0
- package/package/dist/alasql.fs.js +19728 -0
- package/package/dist/alasql.js +19723 -0
- package/package/dist/alasql.min.js +2 -0
- package/package.json +16 -15
- package/yarn-error.log +3004 -1800
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<h2>
|
|
2
|
+
Please use version 1.x as prior versions has a security flaw if you use user generated data to concat your SQL strings instead of providing them as a parameters to AlaSQL.
|
|
3
|
+
</h2>
|
|
4
|
+
|
|
1
5
|
_AlaSQL is an open source project used on more than two million page views per month - and we appreciate any and all contributions we can get. [Please help out](https://github.com/agershun/alasql/labels/Please%20help%20out%21)._
|
|
2
6
|
|
|
3
7
|
_Have a question? Ask on [Stack Overflow](http://stackoverflow.com/questions/ask?tags=AlaSQL) using the "alasql" tag._
|
|
@@ -471,7 +475,7 @@ var b = browserify("./main.js").bundle();
|
|
|
471
475
|
|
|
472
476
|
#### Vue
|
|
473
477
|
|
|
474
|
-
For some frameworks (lige Vue) alasql cant access XLSX by it self. We recommend
|
|
478
|
+
For some frameworks (lige Vue) alasql cant access XLSX by it self. We recommend handeling it by including AlaSQL the following way:
|
|
475
479
|
|
|
476
480
|
```import alasql from 'alasql';
|
|
477
481
|
import XLSX from 'xlsx';
|
|
@@ -601,15 +605,9 @@ The testruns can be found in the [testlog](TESTLOG.md).
|
|
|
601
605
|
|
|
602
606
|
|
|
603
607
|
|
|
604
|
-
##
|
|
605
|
-
|
|
606
|
-
See [Contributing](CONTRIBUTING.md) for details.
|
|
607
|
-
|
|
608
|
-
Thanks to all the people who already contributed!
|
|
608
|
+
## Bleeding Edge
|
|
609
609
|
|
|
610
|
-
|
|
611
|
-
<img src="https://contributors-img.web.app/image?repo=agershun/alasql" />
|
|
612
|
-
</a>
|
|
610
|
+
If you want to try the most recent development version of the library please download [this file](https://rawgit.com/agershun/alasql/develop/dist/alasql.fs.js) or visit the [testbench](https://rawgit.com/agershun/alasql/develop/utils/testbench.html) to play around in the browser console.
|
|
613
611
|
|
|
614
612
|
|
|
615
613
|
## License
|
package/bin/alasql-cli.js
CHANGED
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v1.7.
|
|
1
|
+
//! AlaSQL v1.7.6 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 1.7.
|
|
4
|
+
@version 1.7.6
|
|
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
|
-
!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,
|
|
1
|
+
//! AlaSQL v1.7.6 | © 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.
|
|
1
|
+
//! AlaSQL v1.7.6 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 1.7.
|
|
4
|
+
@version 1.7.6
|
|
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.
|
|
145
|
+
alasql.version = '1.7.6';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -4027,11 +4027,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
|
4027
4027
|
return +obj;
|
|
4028
4028
|
}
|
|
4029
4029
|
|
|
4030
|
-
var temp = obj.constructor(); // changed
|
|
4030
|
+
var temp = (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
|
|
4031
4031
|
|
|
4032
4032
|
for (var key in obj) {
|
|
4033
4033
|
if (obj.hasOwnProperty(key)) {
|
|
4034
|
-
temp[key] = cloneDeep(obj[key]);
|
|
4034
|
+
/* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(temp, key, {value: cloneDeep(obj[key]), writable: true, enumerable: true, configurable: true}); } else { temp[key] = cloneDeep(obj[key]); }
|
|
4035
4035
|
}
|
|
4036
4036
|
}
|
|
4037
4037
|
return temp;
|
|
@@ -4103,7 +4103,7 @@ var extend = (utils.extend = function extend(a, b) {
|
|
|
4103
4103
|
a = a || {};
|
|
4104
4104
|
for (var key in b) {
|
|
4105
4105
|
if (b.hasOwnProperty(key)) {
|
|
4106
|
-
a[key] = b[key];
|
|
4106
|
+
/* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(a, key, {value: b[key], writable: true, enumerable: true, configurable: true}); } else { a[key] = b[key]; }
|
|
4107
4107
|
}
|
|
4108
4108
|
}
|
|
4109
4109
|
return a;
|
|
@@ -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
|
|
6678
|
+
return 'alasql.vars[' + jss(st.variable) + ']=' + st.expression.toJS('x', '');
|
|
6673
6679
|
} else if (st.method === '$') {
|
|
6674
|
-
return
|
|
6680
|
+
return 'params[' + jss(st.variable) + ']=' + st.expression.toJS('x', '');
|
|
6675
6681
|
} else {
|
|
6676
|
-
return
|
|
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
|
-
|
|
6764
|
-
columnid +
|
|
6765
|
-
"
|
|
6769
|
+
'if((a[' +
|
|
6770
|
+
jss(columnid) +
|
|
6771
|
+
"]||'')" +
|
|
6766
6772
|
dg +
|
|
6767
6773
|
(ord.direction === 'ASC' ? '>' : '<') +
|
|
6768
|
-
|
|
6769
|
-
columnid +
|
|
6770
|
-
"
|
|
6774
|
+
'(b[' +
|
|
6775
|
+
jss(columnid) +
|
|
6776
|
+
"]||'')" +
|
|
6771
6777
|
dg +
|
|
6772
6778
|
')return 1;';
|
|
6773
|
-
s +=
|
|
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()';
|
|
@@ -9061,7 +9076,7 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
9061
9076
|
aft2 = '';
|
|
9062
9077
|
|
|
9063
9078
|
if (typeof query.groupStar !== 'undefined') {
|
|
9064
|
-
aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
|
|
9079
|
+
aft2 += "for(var f in p['" + query.groupStar + "']) {if(/^__proto__$/.test(f))Object.defineProperty(g,f,{writable:true,enumerable:true,configurable:true});g[f]=p['" + query.groupStar + "'][f];};";
|
|
9065
9080
|
}
|
|
9066
9081
|
|
|
9067
9082
|
/*
|
|
@@ -9334,9 +9349,10 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9334
9349
|
|
|
9335
9350
|
if (columns && columns.length > 0) {
|
|
9336
9351
|
columns.forEach(function (tcol) {
|
|
9352
|
+
var escapedColumnId = escapeq(tcol.columnid);
|
|
9337
9353
|
if (joinstar && alasql.options.joinstar == 'underscore') {
|
|
9338
9354
|
ss.push(
|
|
9339
|
-
"'" + alias + '_' +
|
|
9355
|
+
"'" + alias + '_' + escapedColumnId + "':p['" + alias + "']['" + escapedColumnId + "']"
|
|
9340
9356
|
);
|
|
9341
9357
|
} else if (joinstar && alasql.options.joinstar == 'json') {
|
|
9342
9358
|
// ss.push('\''+alias+'_'+tcol.columnid+'\':p[\''+alias+'\'][\''+tcol.columnid+'\']');
|
|
@@ -9344,16 +9360,16 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9344
9360
|
"r['" +
|
|
9345
9361
|
alias +
|
|
9346
9362
|
"']['" +
|
|
9347
|
-
|
|
9363
|
+
escapedColumnId +
|
|
9348
9364
|
"']=p['" +
|
|
9349
9365
|
alias +
|
|
9350
9366
|
"']['" +
|
|
9351
|
-
|
|
9367
|
+
escapedColumnId +
|
|
9352
9368
|
"'];";
|
|
9353
9369
|
} else {
|
|
9354
|
-
var value = "p['" + alias + "']['" +
|
|
9370
|
+
var value = "p['" + alias + "']['" + escapedColumnId + "']";
|
|
9355
9371
|
if (!columnIds[tcol.columnid]) {
|
|
9356
|
-
var key = "'" +
|
|
9372
|
+
var key = "'" + escapedColumnId + "':";
|
|
9357
9373
|
ss.push(key + value);
|
|
9358
9374
|
columnIds[tcol.columnid] = {
|
|
9359
9375
|
id: ss.length - 1,
|
|
@@ -9384,7 +9400,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9384
9400
|
} else {
|
|
9385
9401
|
|
|
9386
9402
|
// if column not exist, then copy all
|
|
9387
|
-
sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
|
|
9403
|
+
sp += 'var w=p["' + alias + '"];for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
|
|
9388
9404
|
|
|
9389
9405
|
query.dirtyColumns = true;
|
|
9390
9406
|
}
|
|
@@ -9392,7 +9408,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9392
9408
|
|
|
9393
9409
|
});
|
|
9394
9410
|
|
|
9395
|
-
return {s: ss.join(','), sp: sp};
|
|
9411
|
+
return { s: ss.join(','), sp: sp };
|
|
9396
9412
|
}
|
|
9397
9413
|
|
|
9398
9414
|
yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
@@ -9443,14 +9459,14 @@ yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
|
9443
9459
|
if (false && tbid && !query.defcols['.'][col.tableid] && !query.defcols[col.columnid]) {
|
|
9444
9460
|
ss.push(
|
|
9445
9461
|
"'" +
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
9451
|
-
|
|
9452
|
-
|
|
9453
|
-
|
|
9462
|
+
escapeq(col.as || col.columnid) +
|
|
9463
|
+
"':p['" +
|
|
9464
|
+
query.defaultTableid +
|
|
9465
|
+
"']['" +
|
|
9466
|
+
col.tableid +
|
|
9467
|
+
"']['" +
|
|
9468
|
+
col.columnid +
|
|
9469
|
+
"']"
|
|
9454
9470
|
);
|
|
9455
9471
|
} else {
|
|
9456
9472
|
// workaround for multisheet xlsx export with custom COLUMNS
|
|
@@ -9485,12 +9501,12 @@ yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
|
9485
9501
|
} else {
|
|
9486
9502
|
ss.push(
|
|
9487
9503
|
"'" +
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9504
|
+
escapeq(col.as || col.columnid) +
|
|
9505
|
+
"':p['" +
|
|
9506
|
+
tbid +
|
|
9507
|
+
"']['" +
|
|
9508
|
+
col.columnid +
|
|
9509
|
+
"']"
|
|
9494
9510
|
);
|
|
9495
9511
|
}
|
|
9496
9512
|
}
|
|
@@ -9575,9 +9591,9 @@ yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
|
9575
9591
|
) {
|
|
9576
9592
|
ss.push(
|
|
9577
9593
|
"'" +
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9594
|
+
escapeq(col.as) +
|
|
9595
|
+
"':" +
|
|
9596
|
+
n2u(col.expression.toJS('p', query.defaultTableid, query.defcols))
|
|
9581
9597
|
);
|
|
9582
9598
|
} else if (col.aggregatorid === 'COUNT') {
|
|
9583
9599
|
ss.push("'" + escapeq(col.as) + "':1");
|
|
@@ -9607,9 +9623,9 @@ yy.Select.prototype.compileSelect1 = function (query, params) {
|
|
|
9607
9623
|
|
|
9608
9624
|
ss.push(
|
|
9609
9625
|
"'" +
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9626
|
+
escapeq(col.as || col.columnid || col.toString()) +
|
|
9627
|
+
"':" +
|
|
9628
|
+
n2u(col.toJS('p', query.defaultTableid, query.defcols))
|
|
9613
9629
|
);
|
|
9614
9630
|
// ss.push('\''+escapeq(col.toString())+'\':'+col.toJS("p",query.defaultTableid));
|
|
9615
9631
|
//if(col instanceof yy.Expression) {
|
|
@@ -9713,10 +9729,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
|
|
|
9713
9729
|
self.columns.forEach(function (col) {
|
|
9714
9730
|
|
|
9715
9731
|
if (col instanceof yy.Column && col.columnid === '*') {
|
|
9716
|
-
// s += 'for(var k in g){r[k]=g[k]};';
|
|
9732
|
+
// s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9717
9733
|
// s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
|
|
9718
9734
|
|
|
9719
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
9735
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9720
9736
|
return '';
|
|
9721
9737
|
|
|
9722
9738
|
} else {
|
|
@@ -10462,8 +10478,8 @@ yy.Over.prototype.toString = function () {
|
|
|
10462
10478
|
*/
|
|
10463
10479
|
|
|
10464
10480
|
/**
|
|
10465
|
-
|
|
10466
|
-
|
|
10481
|
+
Expression statement ( = 2*2; )
|
|
10482
|
+
@class
|
|
10467
10483
|
@param {object} params Initial parameters
|
|
10468
10484
|
*/
|
|
10469
10485
|
yy.ExpressionStatement = function (params) {
|
|
@@ -10838,7 +10854,7 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
|
|
|
10838
10854
|
var ljs = '(' + leftJS() + '||{})';
|
|
10839
10855
|
|
|
10840
10856
|
if (typeof this.right === 'string') {
|
|
10841
|
-
s = ljs + '["' + this.right + '"]';
|
|
10857
|
+
s = ljs + '["' + escapeq(this.right) + '"]';
|
|
10842
10858
|
} else if (typeof this.right === 'number') {
|
|
10843
10859
|
s = ljs + '[' + this.right + ']';
|
|
10844
10860
|
} else if (this.right instanceof yy.FuncValue) {
|
|
@@ -11069,7 +11085,7 @@ yy.VarValue.prototype.toType = function () {
|
|
|
11069
11085
|
};
|
|
11070
11086
|
|
|
11071
11087
|
yy.VarValue.prototype.toJS = function () {
|
|
11072
|
-
return "alasql.vars['" + this.variable + "']";
|
|
11088
|
+
return "alasql.vars['" + escapeq(this.variable) + "']";
|
|
11073
11089
|
};
|
|
11074
11090
|
|
|
11075
11091
|
yy.NumValue = function (params) {
|
|
@@ -11463,7 +11479,7 @@ yy.AggrValue.prototype.toJS = function (/*context, tableid, defcols*/) {
|
|
|
11463
11479
|
|
|
11464
11480
|
var colas = this.nick;
|
|
11465
11481
|
if (colas === undefined) {
|
|
11466
|
-
colas = this.toString();
|
|
11482
|
+
colas = escapeq(this.toString());
|
|
11467
11483
|
}
|
|
11468
11484
|
return "g['" + colas + "']";
|
|
11469
11485
|
};
|
|
@@ -13033,7 +13049,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
13033
13049
|
|
|
13034
13050
|
table.update(
|
|
13035
13051
|
function (t) {
|
|
13036
|
-
for (var f in r) t[f] = r[f];
|
|
13052
|
+
for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
13037
13053
|
},
|
|
13038
13054
|
table.data.indexOf(toreplace),
|
|
13039
13055
|
params
|
|
@@ -14579,7 +14595,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
14579
14595
|
});
|
|
14580
14596
|
} else {
|
|
14581
14597
|
|
|
14582
|
-
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
|
|
14598
|
+
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
|
|
14583
14599
|
sw = JSONtoJS(values);
|
|
14584
14600
|
}
|
|
14585
14601
|
}
|
|
@@ -17175,8 +17191,7 @@ alasql.into.XLSX = function (filename, opts, data, columns, cb) {
|
|
|
17175
17191
|
var colm = 1,
|
|
17176
17192
|
rowm = 1;
|
|
17177
17193
|
}
|
|
17178
|
-
var
|
|
17179
|
-
var colmax = Math.max(col0 + columns.length - 1 + zeroColumnFix, colm);
|
|
17194
|
+
var colmax = Math.max(col0 + columns.length, colm);
|
|
17180
17195
|
var rowmax = Math.max(row0 + dataLength + 2, rowm);
|
|
17181
17196
|
|
|
17182
17197
|
var i = row0 + 1;
|
|
@@ -18765,6 +18780,7 @@ LS.dropDatabase = function (lsdbid, ifexists, cb) {
|
|
|
18765
18780
|
|
|
18766
18781
|
LS.attachDatabase = function (lsdbid, databaseid, args, params, cb) {
|
|
18767
18782
|
var res = 1;
|
|
18783
|
+
// console.warn({lsdbid, databaseid, args, params, cb, dbs: Object.keys(alasql.databases)})
|
|
18768
18784
|
if (alasql.databases[databaseid]) {
|
|
18769
18785
|
throw new Error('Unable to attach database as "' + databaseid + '" because it already exists');
|
|
18770
18786
|
}
|