alasql 4.2.0 → 4.2.2
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 +4 -1
- package/dist/alasql-worker.js +2 -2
- package/dist/alasql.fs.js +57 -32
- package/dist/alasql.js +57 -32
- package/dist/alasql.min.js +24 -24
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -97,10 +97,13 @@ var res = alasql("SELECT * FROM example1 ORDER BY b DESC");
|
|
|
97
97
|
console.log(res); // [{a:2,b:6},{a:1,b:5},{a:3,b:4}]
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
|
|
101
100
|
__If you are familiar with SQL, it should be no surprise that proper use of indexes on your tables is essential for good performance.__
|
|
102
101
|
|
|
102
|
+
#### Options
|
|
103
|
+
|
|
104
|
+
AlaSQL has several [configuration options](https://github.com/AlaSQL/alasql/wiki/AlaSQL-Options) which change the behavior. It can be set via SQL statements or via the options object before using `alasql`.
|
|
103
105
|
|
|
106
|
+
If you're using `NOW()` in queries often, setting `alasql.options.dateAsString` to `false` speed things up. It will just return a JS Date object instead of a string representation of a date.
|
|
104
107
|
|
|
105
108
|
## Installation
|
|
106
109
|
|
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.1
|
|
1
|
+
//! AlaSQL v4.2.1 build: develop-37ffe88b | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.1
|
|
4
|
+
@version 4.2.1
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2023 Andrey Gershun & Mathias Wulff
|
package/dist/alasql.fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.1
|
|
1
|
+
//! AlaSQL v4.2.1 build: develop-37ffe88b | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.1
|
|
4
|
+
@version 4.2.1
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2023 Andrey Gershun & Mathias Wulff
|
|
@@ -141,8 +141,8 @@ var alasql = function(sql, params, cb, scope) {
|
|
|
141
141
|
Current version of alasql
|
|
142
142
|
@constant {string}
|
|
143
143
|
*/
|
|
144
|
-
alasql.version = '4.1
|
|
145
|
-
alasql.build = 'develop-
|
|
144
|
+
alasql.version = '4.2.1';
|
|
145
|
+
alasql.build = 'develop-37ffe88b';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -3227,7 +3227,7 @@ function returnTrue() {
|
|
|
3227
3227
|
@function
|
|
3228
3228
|
@return {undefined} Always undefined
|
|
3229
3229
|
*/
|
|
3230
|
-
function returnUndefined() {
|
|
3230
|
+
function returnUndefined() {}
|
|
3231
3231
|
|
|
3232
3232
|
/**
|
|
3233
3233
|
Escape string
|
|
@@ -3522,7 +3522,7 @@ var loadFile = (utils.loadFile = function (path, asy, success, error) {
|
|
|
3522
3522
|
} else if (utils.isCordova) {
|
|
3523
3523
|
/* If Cordova */
|
|
3524
3524
|
utils.global.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
|
|
3525
|
-
fileSystem.root.getFile(path, {
|
|
3525
|
+
fileSystem.root.getFile(path, {create: false}, function (fileEntry) {
|
|
3526
3526
|
fileEntry.file(function (file) {
|
|
3527
3527
|
var fileReader = new FileReader();
|
|
3528
3528
|
fileReader.onloadend = function (e) {
|
|
@@ -3711,7 +3711,7 @@ var removeFile = (utils.removeFile = function (path, cb) {
|
|
|
3711
3711
|
utils.global.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
|
|
3712
3712
|
fileSystem.root.getFile(
|
|
3713
3713
|
path,
|
|
3714
|
-
{
|
|
3714
|
+
{create: false},
|
|
3715
3715
|
function (fileEntry) {
|
|
3716
3716
|
fileEntry.remove(cb);
|
|
3717
3717
|
cb && cb(); // jshint ignore:line
|
|
@@ -3779,7 +3779,7 @@ var fileExists = (utils.fileExists = function (path, cb) {
|
|
|
3779
3779
|
utils.global.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
|
|
3780
3780
|
fileSystem.root.getFile(
|
|
3781
3781
|
path,
|
|
3782
|
-
{
|
|
3782
|
+
{create: false},
|
|
3783
3783
|
function (fileEntry) {
|
|
3784
3784
|
cb(true);
|
|
3785
3785
|
},
|
|
@@ -3845,7 +3845,7 @@ var saveFile = (utils.saveFile = function (path, data, cb, opts) {
|
|
|
3845
3845
|
} else if (utils.isCordova) {
|
|
3846
3846
|
utils.global.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
|
|
3847
3847
|
// alasql.utils.removeFile(path,function(){
|
|
3848
|
-
fileSystem.root.getFile(path, {
|
|
3848
|
+
fileSystem.root.getFile(path, {create: true}, function (fileEntry) {
|
|
3849
3849
|
fileEntry.createWriter(function (fileWriter) {
|
|
3850
3850
|
fileWriter.onwriteend = function () {
|
|
3851
3851
|
if (cb) {
|
|
@@ -3866,7 +3866,7 @@ var saveFile = (utils.saveFile = function (path, data, cb, opts) {
|
|
|
3866
3866
|
disableAutoBom: false,
|
|
3867
3867
|
};
|
|
3868
3868
|
alasql.utils.extend(opt, opts);
|
|
3869
|
-
var blob = new Blob([data], {
|
|
3869
|
+
var blob = new Blob([data], {type: 'text/plain;charset=utf-8'});
|
|
3870
3870
|
saveAs(blob, path, opt.disableAutoBom);
|
|
3871
3871
|
if (cb) {
|
|
3872
3872
|
res = cb(res);
|
|
@@ -4543,7 +4543,7 @@ alasql.options = {
|
|
|
4543
4543
|
/** Check for NaN and convert it to undefined */
|
|
4544
4544
|
nan: false,
|
|
4545
4545
|
|
|
4546
|
-
excel: {
|
|
4546
|
+
excel: {cellDates: true},
|
|
4547
4547
|
|
|
4548
4548
|
/** Option for SELECT * FROM a,b */
|
|
4549
4549
|
joinstar: 'overwrite',
|
|
@@ -4634,7 +4634,7 @@ alasql.autoval = function (tablename, colname, getNext, databaseid) {
|
|
|
4634
4634
|
|
|
4635
4635
|
return (
|
|
4636
4636
|
db.tables[tablename].identities[colname].value -
|
|
4637
|
-
|
|
4637
|
+
db.tables[tablename].identities[colname].step || null
|
|
4638
4638
|
);
|
|
4639
4639
|
};
|
|
4640
4640
|
|
|
@@ -6629,8 +6629,10 @@ function queryfn3(query) {
|
|
|
6629
6629
|
var d = query.selectgfn(g, query.params, alasql);
|
|
6630
6630
|
|
|
6631
6631
|
for (const key in query.groupColumns) {
|
|
6632
|
-
|
|
6632
|
+
// ony remove columns where the alias is also not a column in the result
|
|
6633
|
+
if (query.groupColumns[key] !== key && d[query.groupColumns[key]] && !query.groupColumns[query.groupColumns[key]]){
|
|
6633
6634
|
delete d[query.groupColumns[key]];
|
|
6635
|
+
}
|
|
6634
6636
|
}
|
|
6635
6637
|
query.data.push(d);
|
|
6636
6638
|
}
|
|
@@ -10705,17 +10707,28 @@ yy.Over = class Over {
|
|
|
10705
10707
|
s += '.indexOf(';
|
|
10706
10708
|
s += 'alasql.utils.getValueOf(' + leftJS() + '))>-1)';
|
|
10707
10709
|
} else if (Array.isArray(this.right)) {
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
alasql.sets = {};
|
|
10711
|
-
}
|
|
10712
|
-
const allValues = this.right.map((value) => value.value);
|
|
10713
|
-
const allValuesStr = allValues.join(",");
|
|
10714
|
-
if (!alasql.sets[allValuesStr]) {
|
|
10710
|
+
if (!alasql.options.cache || this.right.filter((value) => value instanceof yy.ParamValue).length > 0) {
|
|
10711
|
+
// When not using cache, or when the array contains parameters, we need to re-create the Set
|
|
10715
10712
|
// leverage JS Set, which is faster for lookups than arrays
|
|
10716
|
-
|
|
10713
|
+
s =
|
|
10714
|
+
'(new Set([' +
|
|
10715
|
+
this.right.map(ref).join(',') +
|
|
10716
|
+
']).has(alasql.utils.getValueOf(' +
|
|
10717
|
+
leftJS() +
|
|
10718
|
+
')))';
|
|
10719
|
+
} else {
|
|
10720
|
+
// Use a cache to not re-create the Set on every identitical query
|
|
10721
|
+
if (!alasql.sets) {
|
|
10722
|
+
alasql.sets = {};
|
|
10723
|
+
}
|
|
10724
|
+
const allValues = this.right.map((value) => value.value);
|
|
10725
|
+
const allValuesStr = allValues.join(",");
|
|
10726
|
+
if (!alasql.sets[allValuesStr]) {
|
|
10727
|
+
// leverage JS Set, which is faster for lookups than arrays
|
|
10728
|
+
alasql.sets[allValuesStr] = new Set(allValues);
|
|
10729
|
+
}
|
|
10730
|
+
s = 'alasql.sets["' + allValuesStr + '"].has(alasql.utils.getValueOf(' + leftJS() + '))';
|
|
10717
10731
|
}
|
|
10718
|
-
s = 'alasql.sets["' + allValuesStr + '"].has(alasql.utils.getValueOf(' + leftJS() + '))';
|
|
10719
10732
|
} else {
|
|
10720
10733
|
s = '(' + rightJS() + '.indexOf(' + leftJS() + ')>-1)';
|
|
10721
10734
|
|
|
@@ -10731,17 +10744,28 @@ yy.Over = class Over {
|
|
|
10731
10744
|
s += '.indexOf(';
|
|
10732
10745
|
s += 'alasql.utils.getValueOf(' + leftJS() + '))<0)';
|
|
10733
10746
|
} else if (Array.isArray(this.right)) {
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
alasql.sets = {};
|
|
10737
|
-
}
|
|
10738
|
-
const allValues = this.right.map((value) => value.value);
|
|
10739
|
-
const allValuesStr = allValues.join(",");
|
|
10740
|
-
if (!alasql.sets[allValuesStr]) {
|
|
10747
|
+
if (!alasql.options.cache || this.right.filter((value) => value instanceof yy.ParamValue).length > 0) {
|
|
10748
|
+
// When not using cache, or when the array contains parameters, we need to re-create the Set
|
|
10741
10749
|
// leverage JS Set, which is faster for lookups than arrays
|
|
10742
|
-
|
|
10750
|
+
s =
|
|
10751
|
+
'(!(new Set([' +
|
|
10752
|
+
this.right.map(ref).join(',') +
|
|
10753
|
+
']).has(alasql.utils.getValueOf(' +
|
|
10754
|
+
leftJS() +
|
|
10755
|
+
'))))';
|
|
10756
|
+
} else {
|
|
10757
|
+
// Use a cache to not re-create the Set on every identitical query
|
|
10758
|
+
if (!alasql.sets) {
|
|
10759
|
+
alasql.sets = {};
|
|
10760
|
+
}
|
|
10761
|
+
const allValues = this.right.map((value) => value.value);
|
|
10762
|
+
const allValuesStr = allValues.join(",");
|
|
10763
|
+
if (!alasql.sets[allValuesStr]) {
|
|
10764
|
+
// leverage JS Set, which is faster for lookups than arrays
|
|
10765
|
+
alasql.sets[allValuesStr] = new Set(allValues);
|
|
10766
|
+
}
|
|
10767
|
+
s = '!alasql.sets["' + allValuesStr + '"].has(alasql.utils.getValueOf(' + leftJS() + '))';
|
|
10743
10768
|
}
|
|
10744
|
-
s = '!alasql.sets["' + allValuesStr + '"].has(alasql.utils.getValueOf(' + leftJS() + '))';
|
|
10745
10769
|
} else {
|
|
10746
10770
|
s = '(' + rightJS() + '.indexOf(';
|
|
10747
10771
|
s += leftJS() + ')==-1)';
|
|
@@ -13019,7 +13043,8 @@ stdfn.OBJECT_ID = function (objid) {
|
|
|
13019
13043
|
};
|
|
13020
13044
|
|
|
13021
13045
|
stdfn.DATE = function (d) {
|
|
13022
|
-
if (!isNaN(d) && d.length === 8)
|
|
13046
|
+
if (!isNaN(d) && d.length === 8)
|
|
13047
|
+
return new Date(+d.substr(0, 4), +d.substr(4, 2) - 1, +d.substr(6, 2));
|
|
13023
13048
|
return newDate(d);
|
|
13024
13049
|
};
|
|
13025
13050
|
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.1
|
|
1
|
+
//! AlaSQL v4.2.1 build: develop-37ffe88b | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.1
|
|
4
|
+
@version 4.2.1
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2023 Andrey Gershun & Mathias Wulff
|
|
@@ -141,8 +141,8 @@ var alasql = function(sql, params, cb, scope) {
|
|
|
141
141
|
Current version of alasql
|
|
142
142
|
@constant {string}
|
|
143
143
|
*/
|
|
144
|
-
alasql.version = '4.1
|
|
145
|
-
alasql.build = 'develop-
|
|
144
|
+
alasql.version = '4.2.1';
|
|
145
|
+
alasql.build = 'develop-37ffe88b';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -3227,7 +3227,7 @@ function returnTrue() {
|
|
|
3227
3227
|
@function
|
|
3228
3228
|
@return {undefined} Always undefined
|
|
3229
3229
|
*/
|
|
3230
|
-
function returnUndefined() {
|
|
3230
|
+
function returnUndefined() {}
|
|
3231
3231
|
|
|
3232
3232
|
/**
|
|
3233
3233
|
Escape string
|
|
@@ -3522,7 +3522,7 @@ var loadFile = (utils.loadFile = function (path, asy, success, error) {
|
|
|
3522
3522
|
} else if (utils.isCordova) {
|
|
3523
3523
|
/* If Cordova */
|
|
3524
3524
|
utils.global.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
|
|
3525
|
-
fileSystem.root.getFile(path, {
|
|
3525
|
+
fileSystem.root.getFile(path, {create: false}, function (fileEntry) {
|
|
3526
3526
|
fileEntry.file(function (file) {
|
|
3527
3527
|
var fileReader = new FileReader();
|
|
3528
3528
|
fileReader.onloadend = function (e) {
|
|
@@ -3711,7 +3711,7 @@ var removeFile = (utils.removeFile = function (path, cb) {
|
|
|
3711
3711
|
utils.global.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
|
|
3712
3712
|
fileSystem.root.getFile(
|
|
3713
3713
|
path,
|
|
3714
|
-
{
|
|
3714
|
+
{create: false},
|
|
3715
3715
|
function (fileEntry) {
|
|
3716
3716
|
fileEntry.remove(cb);
|
|
3717
3717
|
cb && cb(); // jshint ignore:line
|
|
@@ -3779,7 +3779,7 @@ var fileExists = (utils.fileExists = function (path, cb) {
|
|
|
3779
3779
|
utils.global.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
|
|
3780
3780
|
fileSystem.root.getFile(
|
|
3781
3781
|
path,
|
|
3782
|
-
{
|
|
3782
|
+
{create: false},
|
|
3783
3783
|
function (fileEntry) {
|
|
3784
3784
|
cb(true);
|
|
3785
3785
|
},
|
|
@@ -3845,7 +3845,7 @@ var saveFile = (utils.saveFile = function (path, data, cb, opts) {
|
|
|
3845
3845
|
} else if (utils.isCordova) {
|
|
3846
3846
|
utils.global.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
|
|
3847
3847
|
// alasql.utils.removeFile(path,function(){
|
|
3848
|
-
fileSystem.root.getFile(path, {
|
|
3848
|
+
fileSystem.root.getFile(path, {create: true}, function (fileEntry) {
|
|
3849
3849
|
fileEntry.createWriter(function (fileWriter) {
|
|
3850
3850
|
fileWriter.onwriteend = function () {
|
|
3851
3851
|
if (cb) {
|
|
@@ -3866,7 +3866,7 @@ var saveFile = (utils.saveFile = function (path, data, cb, opts) {
|
|
|
3866
3866
|
disableAutoBom: false,
|
|
3867
3867
|
};
|
|
3868
3868
|
alasql.utils.extend(opt, opts);
|
|
3869
|
-
var blob = new Blob([data], {
|
|
3869
|
+
var blob = new Blob([data], {type: 'text/plain;charset=utf-8'});
|
|
3870
3870
|
saveAs(blob, path, opt.disableAutoBom);
|
|
3871
3871
|
if (cb) {
|
|
3872
3872
|
res = cb(res);
|
|
@@ -4543,7 +4543,7 @@ alasql.options = {
|
|
|
4543
4543
|
/** Check for NaN and convert it to undefined */
|
|
4544
4544
|
nan: false,
|
|
4545
4545
|
|
|
4546
|
-
excel: {
|
|
4546
|
+
excel: {cellDates: true},
|
|
4547
4547
|
|
|
4548
4548
|
/** Option for SELECT * FROM a,b */
|
|
4549
4549
|
joinstar: 'overwrite',
|
|
@@ -4634,7 +4634,7 @@ alasql.autoval = function (tablename, colname, getNext, databaseid) {
|
|
|
4634
4634
|
|
|
4635
4635
|
return (
|
|
4636
4636
|
db.tables[tablename].identities[colname].value -
|
|
4637
|
-
|
|
4637
|
+
db.tables[tablename].identities[colname].step || null
|
|
4638
4638
|
);
|
|
4639
4639
|
};
|
|
4640
4640
|
|
|
@@ -6629,8 +6629,10 @@ function queryfn3(query) {
|
|
|
6629
6629
|
var d = query.selectgfn(g, query.params, alasql);
|
|
6630
6630
|
|
|
6631
6631
|
for (const key in query.groupColumns) {
|
|
6632
|
-
|
|
6632
|
+
// ony remove columns where the alias is also not a column in the result
|
|
6633
|
+
if (query.groupColumns[key] !== key && d[query.groupColumns[key]] && !query.groupColumns[query.groupColumns[key]]){
|
|
6633
6634
|
delete d[query.groupColumns[key]];
|
|
6635
|
+
}
|
|
6634
6636
|
}
|
|
6635
6637
|
query.data.push(d);
|
|
6636
6638
|
}
|
|
@@ -10705,17 +10707,28 @@ yy.Over = class Over {
|
|
|
10705
10707
|
s += '.indexOf(';
|
|
10706
10708
|
s += 'alasql.utils.getValueOf(' + leftJS() + '))>-1)';
|
|
10707
10709
|
} else if (Array.isArray(this.right)) {
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
alasql.sets = {};
|
|
10711
|
-
}
|
|
10712
|
-
const allValues = this.right.map((value) => value.value);
|
|
10713
|
-
const allValuesStr = allValues.join(",");
|
|
10714
|
-
if (!alasql.sets[allValuesStr]) {
|
|
10710
|
+
if (!alasql.options.cache || this.right.filter((value) => value instanceof yy.ParamValue).length > 0) {
|
|
10711
|
+
// When not using cache, or when the array contains parameters, we need to re-create the Set
|
|
10715
10712
|
// leverage JS Set, which is faster for lookups than arrays
|
|
10716
|
-
|
|
10713
|
+
s =
|
|
10714
|
+
'(new Set([' +
|
|
10715
|
+
this.right.map(ref).join(',') +
|
|
10716
|
+
']).has(alasql.utils.getValueOf(' +
|
|
10717
|
+
leftJS() +
|
|
10718
|
+
')))';
|
|
10719
|
+
} else {
|
|
10720
|
+
// Use a cache to not re-create the Set on every identitical query
|
|
10721
|
+
if (!alasql.sets) {
|
|
10722
|
+
alasql.sets = {};
|
|
10723
|
+
}
|
|
10724
|
+
const allValues = this.right.map((value) => value.value);
|
|
10725
|
+
const allValuesStr = allValues.join(",");
|
|
10726
|
+
if (!alasql.sets[allValuesStr]) {
|
|
10727
|
+
// leverage JS Set, which is faster for lookups than arrays
|
|
10728
|
+
alasql.sets[allValuesStr] = new Set(allValues);
|
|
10729
|
+
}
|
|
10730
|
+
s = 'alasql.sets["' + allValuesStr + '"].has(alasql.utils.getValueOf(' + leftJS() + '))';
|
|
10717
10731
|
}
|
|
10718
|
-
s = 'alasql.sets["' + allValuesStr + '"].has(alasql.utils.getValueOf(' + leftJS() + '))';
|
|
10719
10732
|
} else {
|
|
10720
10733
|
s = '(' + rightJS() + '.indexOf(' + leftJS() + ')>-1)';
|
|
10721
10734
|
|
|
@@ -10731,17 +10744,28 @@ yy.Over = class Over {
|
|
|
10731
10744
|
s += '.indexOf(';
|
|
10732
10745
|
s += 'alasql.utils.getValueOf(' + leftJS() + '))<0)';
|
|
10733
10746
|
} else if (Array.isArray(this.right)) {
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
alasql.sets = {};
|
|
10737
|
-
}
|
|
10738
|
-
const allValues = this.right.map((value) => value.value);
|
|
10739
|
-
const allValuesStr = allValues.join(",");
|
|
10740
|
-
if (!alasql.sets[allValuesStr]) {
|
|
10747
|
+
if (!alasql.options.cache || this.right.filter((value) => value instanceof yy.ParamValue).length > 0) {
|
|
10748
|
+
// When not using cache, or when the array contains parameters, we need to re-create the Set
|
|
10741
10749
|
// leverage JS Set, which is faster for lookups than arrays
|
|
10742
|
-
|
|
10750
|
+
s =
|
|
10751
|
+
'(!(new Set([' +
|
|
10752
|
+
this.right.map(ref).join(',') +
|
|
10753
|
+
']).has(alasql.utils.getValueOf(' +
|
|
10754
|
+
leftJS() +
|
|
10755
|
+
'))))';
|
|
10756
|
+
} else {
|
|
10757
|
+
// Use a cache to not re-create the Set on every identitical query
|
|
10758
|
+
if (!alasql.sets) {
|
|
10759
|
+
alasql.sets = {};
|
|
10760
|
+
}
|
|
10761
|
+
const allValues = this.right.map((value) => value.value);
|
|
10762
|
+
const allValuesStr = allValues.join(",");
|
|
10763
|
+
if (!alasql.sets[allValuesStr]) {
|
|
10764
|
+
// leverage JS Set, which is faster for lookups than arrays
|
|
10765
|
+
alasql.sets[allValuesStr] = new Set(allValues);
|
|
10766
|
+
}
|
|
10767
|
+
s = '!alasql.sets["' + allValuesStr + '"].has(alasql.utils.getValueOf(' + leftJS() + '))';
|
|
10743
10768
|
}
|
|
10744
|
-
s = '!alasql.sets["' + allValuesStr + '"].has(alasql.utils.getValueOf(' + leftJS() + '))';
|
|
10745
10769
|
} else {
|
|
10746
10770
|
s = '(' + rightJS() + '.indexOf(';
|
|
10747
10771
|
s += leftJS() + ')==-1)';
|
|
@@ -13019,7 +13043,8 @@ stdfn.OBJECT_ID = function (objid) {
|
|
|
13019
13043
|
};
|
|
13020
13044
|
|
|
13021
13045
|
stdfn.DATE = function (d) {
|
|
13022
|
-
if (!isNaN(d) && d.length === 8)
|
|
13046
|
+
if (!isNaN(d) && d.length === 8)
|
|
13047
|
+
return new Date(+d.substr(0, 4), +d.substr(4, 2) - 1, +d.substr(6, 2));
|
|
13023
13048
|
return newDate(d);
|
|
13024
13049
|
};
|
|
13025
13050
|
|