alasql 4.5.2 → 4.6.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.fs.js +93 -38
- package/dist/alasql.js +93 -38
- package/dist/alasql.min.js +151 -98
- package/package.json +4 -4
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.5.
|
|
1
|
+
//! AlaSQL v4.5.2 build: develop-1e5fefa4 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.5.
|
|
4
|
+
@version 4.5.2
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2024 Andrey Gershun & Mathias Wulff
|
package/dist/alasql.fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.5.
|
|
1
|
+
//! AlaSQL v4.5.2 build: develop-1e5fefa4 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.5.
|
|
4
|
+
@version 4.5.2
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2024 Andrey Gershun & Mathias Wulff
|
|
@@ -141,8 +141,8 @@ SOFTWARE.
|
|
|
141
141
|
Current version of alasql
|
|
142
142
|
@constant {string}
|
|
143
143
|
*/
|
|
144
|
-
alasql.version = '4.5.
|
|
145
|
-
alasql.build = 'develop-
|
|
144
|
+
alasql.version = '4.5.2';
|
|
145
|
+
alasql.build = 'develop-1e5fefa4';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -8426,18 +8426,18 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8426
8426
|
if ('funcid' in col.expression) {
|
|
8427
8427
|
let colexp1 = colExpIfFunIdExists(col.expression);
|
|
8428
8428
|
|
|
8429
|
-
return `'${colas}': (typeof ${colexp1} == 'number' ? ${colexp} : typeof ${colexp1} == 'object' ?
|
|
8429
|
+
return `'${colas}': (typeof ${colexp1} == 'number' || typeof ${colexp1} == 'bigint' ? ${colexp} : typeof ${colexp1} == 'object' ?
|
|
8430
8430
|
typeof Number(${colexp1}) == 'number' && ${colexp1}!== null? ${colexp} : null : null),`;
|
|
8431
8431
|
}
|
|
8432
|
-
return `'${colas}': (typeof ${colexp} == 'number' ? ${colexp} : typeof ${colexp} == 'object' ?
|
|
8432
|
+
return `'${colas}': (typeof ${colexp} == 'number' || typeof ${colexp} == 'bigint' ? ${colexp} : typeof ${colexp} == 'object' ?
|
|
8433
8433
|
typeof Number(${colexp}) == 'number' && ${colexp}!== null? ${colexp} : null : null),`;
|
|
8434
8434
|
} else if (col.aggregatorid === 'MAX') {
|
|
8435
8435
|
if ('funcid' in col.expression) {
|
|
8436
8436
|
let colexp1 = colExpIfFunIdExists(col.expression);
|
|
8437
|
-
return `'${colas}' : (typeof ${colexp1} == 'number' ? ${colexp} : typeof ${colexp1} == 'object' ?
|
|
8437
|
+
return `'${colas}' : (typeof ${colexp1} == 'number' || typeof ${colexp1} == 'bigint' ? ${colexp} : typeof ${colexp1} == 'object' ?
|
|
8438
8438
|
typeof Number(${colexp1}) == 'number' ? ${colexp} : null : null),`;
|
|
8439
8439
|
}
|
|
8440
|
-
return `'${colas}' : (typeof ${colexp} == 'number' ? ${colexp} : typeof ${colexp} == 'object' ?
|
|
8440
|
+
return `'${colas}' : (typeof ${colexp} == 'number' || typeof ${colexp} == 'bigint' ? ${colexp} : typeof ${colexp} == 'object' ?
|
|
8441
8441
|
typeof Number(${colexp}) == 'number' ? ${colexp} : null : null),`;
|
|
8442
8442
|
} else if (col.aggregatorid === 'ARRAY') {
|
|
8443
8443
|
return `'${colas}':[${colexp}],`;
|
|
@@ -8492,10 +8492,13 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8492
8492
|
{
|
|
8493
8493
|
const __g_colas = g['${colas}'];
|
|
8494
8494
|
const __typeof_colexp1 = typeof ${colexp1};
|
|
8495
|
+
const __colexp1 = ${colexp1};
|
|
8495
8496
|
|
|
8496
8497
|
if (__g_colas == null && ${colexp1} == null) {
|
|
8497
8498
|
g['${colas}'] = null;
|
|
8498
|
-
} else if (
|
|
8499
|
+
} else if (typeof __g_colas === 'bigint' || typeof __colexp1 === 'bigint') {
|
|
8500
|
+
g['${colas}'] = BigInt(__g_colas) + BigInt(__colexp);
|
|
8501
|
+
} else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp1 !== 'object' && __typeof_colexp1 !== 'number') ||
|
|
8499
8502
|
(__g_colas == null || (typeof __g_colas !== 'number' && typeof __g_colas !== 'object')) && (${colexp1} == null || (__typeof_colexp1 !== 'number' && __typeof_colexp1 !== 'object'))) {
|
|
8500
8503
|
g['${colas}'] = null;
|
|
8501
8504
|
} else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp1 == 'number') ||
|
|
@@ -8517,10 +8520,13 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8517
8520
|
{
|
|
8518
8521
|
const __g_colas = g['${colas}'];
|
|
8519
8522
|
const __typeof_colexp = typeof ${colexp};
|
|
8523
|
+
const __colexp = ${colexp};
|
|
8520
8524
|
|
|
8521
8525
|
if (__g_colas == null && ${colexp} == null) {
|
|
8522
8526
|
g['${colas}'] = null;
|
|
8523
|
-
} else if (
|
|
8527
|
+
} else if (typeof __g_colas === 'bigint' || typeof __colexp === 'bigint') {
|
|
8528
|
+
g['${colas}'] = BigInt(__g_colas) + BigInt(__colexp);
|
|
8529
|
+
} else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp !== 'object' && __typeof_colexp !== 'number') ||
|
|
8524
8530
|
(__g_colas == null || (typeof __g_colas !== 'number' && typeof __g_colas !== 'object')) && (${colexp} == null || (__typeof_colexp !== 'number' && __typeof_colexp !== 'object'))) {
|
|
8525
8531
|
g['${colas}'] = null;
|
|
8526
8532
|
} else if (typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp == 'number') {
|
|
@@ -8550,7 +8556,9 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8550
8556
|
if (__typeof_g_colas == 'string' && !isNaN(__g_colas) && typeof Number(__g_colas) == 'number' &&
|
|
8551
8557
|
__typeof_colexp1 == 'string' && !isNaN(__colexp1) && typeof Number(__colexp1) == 'number') {
|
|
8552
8558
|
g['${colas}'] = Number(__g_colas) + Number(__colexp1);
|
|
8553
|
-
} else if (__typeof_g_colas
|
|
8559
|
+
} else if (__typeof_g_colas === 'bigint' || __typeof_colexp1 === 'bigint') {
|
|
8560
|
+
g['${colas}'] = BigInt(__g_colas || 0) + BigInt(__colexp1 || 0);
|
|
8561
|
+
} else if (__typeof_g_colas == 'string' && __typeof_colexp1 == 'string') {
|
|
8554
8562
|
g['${colas}'] = 0;
|
|
8555
8563
|
} else if (__typeof_g_colas == 'string' && __typeof_colexp1 == 'number') {
|
|
8556
8564
|
g['${colas}'] = __colexp1;
|
|
@@ -8574,7 +8582,9 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8574
8582
|
if (__typeof_g_colas === 'string' && !isNaN(__g_colas) && typeof Number(__g_colas) === 'number' &&
|
|
8575
8583
|
__typeof_colexp === 'string' && !isNaN(__colexp) && typeof Number(__colexp) === 'number') {
|
|
8576
8584
|
g['${colas}'] = Number(__g_colas) + Number(__colexp);
|
|
8577
|
-
} else if (__typeof_g_colas === '
|
|
8585
|
+
} else if (__typeof_g_colas === 'bigint' || __typeof_colexp === 'bigint') {
|
|
8586
|
+
g['${colas}'] = BigInt(__g_colas || 0) + BigInt(__colexp || 0);
|
|
8587
|
+
} else if (__typeof_g_colas === 'string' && __typeof_colexp === 'string') {
|
|
8578
8588
|
g['${colas}'] = 0;
|
|
8579
8589
|
} else if (__typeof_g_colas === 'string' && __typeof_colexp === 'number') {
|
|
8580
8590
|
g['${colas}'] = __colexp;
|
|
@@ -8605,23 +8615,41 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8605
8615
|
let colexp1 = colExpIfFunIdExists(col.expression);
|
|
8606
8616
|
return (
|
|
8607
8617
|
pre +
|
|
8608
|
-
`if((g['${colas}'] == null && ${colexp1}!== null) ? y = ${colexp} :
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8618
|
+
`if ((g['${colas}'] == null && ${colexp1} !== null) ? y = ${colexp} :
|
|
8619
|
+
(g['${colas}'] !== null && ${colexp1} == null) ? y = g['${colas}'] :
|
|
8620
|
+
((y = ${colexp}) < g['${colas}'])) {
|
|
8621
|
+
if (typeof y == 'number' || typeof y == 'bigint') {
|
|
8622
|
+
g['${colas}'] = y;
|
|
8623
|
+
} else if (typeof y == 'object' && y instanceof Date) {
|
|
8624
|
+
g['${colas}'] = y;
|
|
8625
|
+
} else if (typeof y == 'object' && typeof Number(y) == 'number') {
|
|
8626
|
+
g['${colas}'] = Number(y);
|
|
8627
|
+
}
|
|
8628
|
+
} else if (g['${colas}'] !== null && typeof g['${colas}'] == 'object' && y instanceof Date) {
|
|
8629
|
+
g['${colas}'] = g['${colas}'];
|
|
8630
|
+
} else if (g['${colas}'] !== null && typeof g['${colas}'] == 'object') {
|
|
8631
|
+
g['${colas}'] = Number(g['${colas}']);
|
|
8632
|
+
}` +
|
|
8614
8633
|
post
|
|
8615
8634
|
);
|
|
8616
8635
|
}
|
|
8617
8636
|
return (
|
|
8618
8637
|
pre +
|
|
8619
|
-
`if((g['${colas}'] == null && ${colexp}!== null) ? y = ${colexp} :
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8638
|
+
`if((g['${colas}'] == null && ${colexp}!== null) ? y = ${colexp} :
|
|
8639
|
+
(g['${colas}']!== null && ${colexp} == null) ? y = g['${colas}'] :
|
|
8640
|
+
((y=${colexp}) < g['${colas}'])) {
|
|
8641
|
+
if(typeof y == 'number' || typeof y == 'bigint') {
|
|
8642
|
+
g['${colas}'] = y;
|
|
8643
|
+
} else if(typeof y == 'object' && y instanceof Date) {
|
|
8644
|
+
g['${colas}'] = y;
|
|
8645
|
+
} else if(typeof y == 'object' && typeof Number(y) == 'number') {
|
|
8646
|
+
g['${colas}'] = Number(y);
|
|
8647
|
+
}
|
|
8648
|
+
} else if(g['${colas}']!== null && typeof g['${colas}'] == 'object' && y instanceof Date) {
|
|
8649
|
+
g['${colas}'] = g['${colas}'];
|
|
8650
|
+
} else if(g['${colas}']!== null && typeof g['${colas}'] == 'object') {
|
|
8651
|
+
g['${colas}'] = Number(g['${colas}']);
|
|
8652
|
+
}` +
|
|
8625
8653
|
post
|
|
8626
8654
|
);
|
|
8627
8655
|
} else if (col.aggregatorid === 'MAX') {
|
|
@@ -8630,23 +8658,41 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8630
8658
|
|
|
8631
8659
|
return (
|
|
8632
8660
|
pre +
|
|
8633
|
-
`if((g['${colas}'] == null && ${colexp1}!== null) ? y = ${colexp} :
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8661
|
+
`if ((g['${colas}'] == null && ${colexp1} !== null) ? y = ${colexp} :
|
|
8662
|
+
(g['${colas}'] !== null && ${colexp1} == null) ? y = g['${colas}'] :
|
|
8663
|
+
((y = ${colexp}) > g['${colas}'])) {
|
|
8664
|
+
if (typeof y == 'number' || typeof y == 'bigint') {
|
|
8665
|
+
g['${colas}'] = y;
|
|
8666
|
+
} else if (typeof y == 'object' && y instanceof Date) {
|
|
8667
|
+
g['${colas}'] = y;
|
|
8668
|
+
} else if (typeof y == 'object' && typeof Number(y) == 'number') {
|
|
8669
|
+
g['${colas}'] = Number(y);
|
|
8670
|
+
}
|
|
8671
|
+
} else if (g['${colas}'] !== null && typeof g['${colas}'] == 'object' && y instanceof Date) {
|
|
8672
|
+
g['${colas}'] = g['${colas}'];
|
|
8673
|
+
} else if (g['${colas}'] !== null && typeof g['${colas}'] == 'object') {
|
|
8674
|
+
g['${colas}'] = Number(g['${colas}']);
|
|
8675
|
+
}` +
|
|
8639
8676
|
post
|
|
8640
8677
|
);
|
|
8641
8678
|
}
|
|
8642
8679
|
return (
|
|
8643
8680
|
pre +
|
|
8644
|
-
`if((g['${colas}'] == null && ${colexp}!== null) ? y = ${colexp} :
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8681
|
+
`if((g['${colas}'] == null && ${colexp}!== null) ? y = ${colexp} :
|
|
8682
|
+
(g['${colas}']!== null && ${colexp} == null) ? y = g['${colas}'] :
|
|
8683
|
+
((y=${colexp}) > g['${colas}'])) {
|
|
8684
|
+
if(typeof y == 'number' || typeof y == 'bigint') {
|
|
8685
|
+
g['${colas}'] = y;
|
|
8686
|
+
} else if(typeof y == 'object' && y instanceof Date) {
|
|
8687
|
+
g['${colas}'] = y;
|
|
8688
|
+
} else if(typeof y == 'object' && typeof Number(y) == 'number') {
|
|
8689
|
+
g['${colas}'] = Number(y);
|
|
8690
|
+
}
|
|
8691
|
+
} else if(g['${colas}']!== null && typeof g['${colas}'] == 'object' && y instanceof Date) {
|
|
8692
|
+
g['${colas}'] = g['${colas}'];
|
|
8693
|
+
} else if(g['${colas}']!== null && typeof g['${colas}'] == 'object') {
|
|
8694
|
+
g['${colas}'] = Number(g['${colas}']);
|
|
8695
|
+
}` +
|
|
8650
8696
|
post
|
|
8651
8697
|
);
|
|
8652
8698
|
} else if (col.aggregatorid === 'FIRST') {
|
|
@@ -8655,9 +8701,16 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8655
8701
|
return `${pre}g['${colas}']=${colexp};${post}`;
|
|
8656
8702
|
} else if (col.aggregatorid === 'AVG') {
|
|
8657
8703
|
return `${pre}
|
|
8658
|
-
|
|
8704
|
+
y= (${colexp});
|
|
8659
8705
|
g['_COUNT_${colas}'] += (typeof y == "undefined" || y === null) ? 0 : 1;
|
|
8660
|
-
g['${colas}']
|
|
8706
|
+
if (typeof g['_SUM_${colas}'] === 'bigint' || typeof y === 'bigint') {
|
|
8707
|
+
g['_SUM_${colas}'] = BigInt(g['_SUM_${colas}']);
|
|
8708
|
+
g['_SUM_${colas}'] += BigInt(y || 0);
|
|
8709
|
+
g['${colas}'] = BigInt(g['_SUM_${colas}']) / BigInt(g['_COUNT_${colas}']);
|
|
8710
|
+
} else {
|
|
8711
|
+
g['_SUM_${colas}'] += (y || 0);
|
|
8712
|
+
g['${colas}'] = g['_SUM_${colas}'] / g['_COUNT_${colas}'];
|
|
8713
|
+
}
|
|
8661
8714
|
${post}`;
|
|
8662
8715
|
} else if (col.aggregatorid === 'AGGR') {
|
|
8663
8716
|
return `${pre}
|
|
@@ -11419,6 +11472,7 @@ yy.Json.prototype.toString = function () {
|
|
|
11419
11472
|
const JSONtoString = (alasql.utils.JSONtoString = function (obj) {
|
|
11420
11473
|
if (typeof obj === 'string') return `"${obj}"`;
|
|
11421
11474
|
if (typeof obj === 'number' || typeof obj === 'boolean') return String(obj);
|
|
11475
|
+
if (typeof obj === 'bigint') return `${obj.toString()}n`;
|
|
11422
11476
|
|
|
11423
11477
|
if (Array.isArray(obj)) {
|
|
11424
11478
|
return `[${obj.map(b => JSONtoString(b)).join(',')}]`;
|
|
@@ -11448,6 +11502,7 @@ function JSONtoJS(obj, context, tableid, defcols) {
|
|
|
11448
11502
|
if (typeof obj == 'string') s = '"' + obj + '"';
|
|
11449
11503
|
else if (typeof obj == 'number') s = '(' + obj + ')';
|
|
11450
11504
|
else if (typeof obj == 'boolean') s = obj;
|
|
11505
|
+
else if (typeof obj === 'bigint') s = obj.toString() + 'n';
|
|
11451
11506
|
else if (typeof obj === 'object') {
|
|
11452
11507
|
if (Array.isArray(obj)) {
|
|
11453
11508
|
s += `[${obj.map(b => JSONtoJS(b, context, tableid, defcols)).join(',')}]`;
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.5.
|
|
1
|
+
//! AlaSQL v4.5.2 build: develop-1e5fefa4 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.5.
|
|
4
|
+
@version 4.5.2
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2024 Andrey Gershun & Mathias Wulff
|
|
@@ -141,8 +141,8 @@ SOFTWARE.
|
|
|
141
141
|
Current version of alasql
|
|
142
142
|
@constant {string}
|
|
143
143
|
*/
|
|
144
|
-
alasql.version = '4.5.
|
|
145
|
-
alasql.build = 'develop-
|
|
144
|
+
alasql.version = '4.5.2';
|
|
145
|
+
alasql.build = 'develop-1e5fefa4';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -8426,18 +8426,18 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8426
8426
|
if ('funcid' in col.expression) {
|
|
8427
8427
|
let colexp1 = colExpIfFunIdExists(col.expression);
|
|
8428
8428
|
|
|
8429
|
-
return `'${colas}': (typeof ${colexp1} == 'number' ? ${colexp} : typeof ${colexp1} == 'object' ?
|
|
8429
|
+
return `'${colas}': (typeof ${colexp1} == 'number' || typeof ${colexp1} == 'bigint' ? ${colexp} : typeof ${colexp1} == 'object' ?
|
|
8430
8430
|
typeof Number(${colexp1}) == 'number' && ${colexp1}!== null? ${colexp} : null : null),`;
|
|
8431
8431
|
}
|
|
8432
|
-
return `'${colas}': (typeof ${colexp} == 'number' ? ${colexp} : typeof ${colexp} == 'object' ?
|
|
8432
|
+
return `'${colas}': (typeof ${colexp} == 'number' || typeof ${colexp} == 'bigint' ? ${colexp} : typeof ${colexp} == 'object' ?
|
|
8433
8433
|
typeof Number(${colexp}) == 'number' && ${colexp}!== null? ${colexp} : null : null),`;
|
|
8434
8434
|
} else if (col.aggregatorid === 'MAX') {
|
|
8435
8435
|
if ('funcid' in col.expression) {
|
|
8436
8436
|
let colexp1 = colExpIfFunIdExists(col.expression);
|
|
8437
|
-
return `'${colas}' : (typeof ${colexp1} == 'number' ? ${colexp} : typeof ${colexp1} == 'object' ?
|
|
8437
|
+
return `'${colas}' : (typeof ${colexp1} == 'number' || typeof ${colexp1} == 'bigint' ? ${colexp} : typeof ${colexp1} == 'object' ?
|
|
8438
8438
|
typeof Number(${colexp1}) == 'number' ? ${colexp} : null : null),`;
|
|
8439
8439
|
}
|
|
8440
|
-
return `'${colas}' : (typeof ${colexp} == 'number' ? ${colexp} : typeof ${colexp} == 'object' ?
|
|
8440
|
+
return `'${colas}' : (typeof ${colexp} == 'number' || typeof ${colexp} == 'bigint' ? ${colexp} : typeof ${colexp} == 'object' ?
|
|
8441
8441
|
typeof Number(${colexp}) == 'number' ? ${colexp} : null : null),`;
|
|
8442
8442
|
} else if (col.aggregatorid === 'ARRAY') {
|
|
8443
8443
|
return `'${colas}':[${colexp}],`;
|
|
@@ -8492,10 +8492,13 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8492
8492
|
{
|
|
8493
8493
|
const __g_colas = g['${colas}'];
|
|
8494
8494
|
const __typeof_colexp1 = typeof ${colexp1};
|
|
8495
|
+
const __colexp1 = ${colexp1};
|
|
8495
8496
|
|
|
8496
8497
|
if (__g_colas == null && ${colexp1} == null) {
|
|
8497
8498
|
g['${colas}'] = null;
|
|
8498
|
-
} else if (
|
|
8499
|
+
} else if (typeof __g_colas === 'bigint' || typeof __colexp1 === 'bigint') {
|
|
8500
|
+
g['${colas}'] = BigInt(__g_colas) + BigInt(__colexp);
|
|
8501
|
+
} else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp1 !== 'object' && __typeof_colexp1 !== 'number') ||
|
|
8499
8502
|
(__g_colas == null || (typeof __g_colas !== 'number' && typeof __g_colas !== 'object')) && (${colexp1} == null || (__typeof_colexp1 !== 'number' && __typeof_colexp1 !== 'object'))) {
|
|
8500
8503
|
g['${colas}'] = null;
|
|
8501
8504
|
} else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp1 == 'number') ||
|
|
@@ -8517,10 +8520,13 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8517
8520
|
{
|
|
8518
8521
|
const __g_colas = g['${colas}'];
|
|
8519
8522
|
const __typeof_colexp = typeof ${colexp};
|
|
8523
|
+
const __colexp = ${colexp};
|
|
8520
8524
|
|
|
8521
8525
|
if (__g_colas == null && ${colexp} == null) {
|
|
8522
8526
|
g['${colas}'] = null;
|
|
8523
|
-
} else if (
|
|
8527
|
+
} else if (typeof __g_colas === 'bigint' || typeof __colexp === 'bigint') {
|
|
8528
|
+
g['${colas}'] = BigInt(__g_colas) + BigInt(__colexp);
|
|
8529
|
+
} else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp !== 'object' && __typeof_colexp !== 'number') ||
|
|
8524
8530
|
(__g_colas == null || (typeof __g_colas !== 'number' && typeof __g_colas !== 'object')) && (${colexp} == null || (__typeof_colexp !== 'number' && __typeof_colexp !== 'object'))) {
|
|
8525
8531
|
g['${colas}'] = null;
|
|
8526
8532
|
} else if (typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp == 'number') {
|
|
@@ -8550,7 +8556,9 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8550
8556
|
if (__typeof_g_colas == 'string' && !isNaN(__g_colas) && typeof Number(__g_colas) == 'number' &&
|
|
8551
8557
|
__typeof_colexp1 == 'string' && !isNaN(__colexp1) && typeof Number(__colexp1) == 'number') {
|
|
8552
8558
|
g['${colas}'] = Number(__g_colas) + Number(__colexp1);
|
|
8553
|
-
} else if (__typeof_g_colas
|
|
8559
|
+
} else if (__typeof_g_colas === 'bigint' || __typeof_colexp1 === 'bigint') {
|
|
8560
|
+
g['${colas}'] = BigInt(__g_colas || 0) + BigInt(__colexp1 || 0);
|
|
8561
|
+
} else if (__typeof_g_colas == 'string' && __typeof_colexp1 == 'string') {
|
|
8554
8562
|
g['${colas}'] = 0;
|
|
8555
8563
|
} else if (__typeof_g_colas == 'string' && __typeof_colexp1 == 'number') {
|
|
8556
8564
|
g['${colas}'] = __colexp1;
|
|
@@ -8574,7 +8582,9 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8574
8582
|
if (__typeof_g_colas === 'string' && !isNaN(__g_colas) && typeof Number(__g_colas) === 'number' &&
|
|
8575
8583
|
__typeof_colexp === 'string' && !isNaN(__colexp) && typeof Number(__colexp) === 'number') {
|
|
8576
8584
|
g['${colas}'] = Number(__g_colas) + Number(__colexp);
|
|
8577
|
-
} else if (__typeof_g_colas === '
|
|
8585
|
+
} else if (__typeof_g_colas === 'bigint' || __typeof_colexp === 'bigint') {
|
|
8586
|
+
g['${colas}'] = BigInt(__g_colas || 0) + BigInt(__colexp || 0);
|
|
8587
|
+
} else if (__typeof_g_colas === 'string' && __typeof_colexp === 'string') {
|
|
8578
8588
|
g['${colas}'] = 0;
|
|
8579
8589
|
} else if (__typeof_g_colas === 'string' && __typeof_colexp === 'number') {
|
|
8580
8590
|
g['${colas}'] = __colexp;
|
|
@@ -8605,23 +8615,41 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8605
8615
|
let colexp1 = colExpIfFunIdExists(col.expression);
|
|
8606
8616
|
return (
|
|
8607
8617
|
pre +
|
|
8608
|
-
`if((g['${colas}'] == null && ${colexp1}!== null) ? y = ${colexp} :
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8618
|
+
`if ((g['${colas}'] == null && ${colexp1} !== null) ? y = ${colexp} :
|
|
8619
|
+
(g['${colas}'] !== null && ${colexp1} == null) ? y = g['${colas}'] :
|
|
8620
|
+
((y = ${colexp}) < g['${colas}'])) {
|
|
8621
|
+
if (typeof y == 'number' || typeof y == 'bigint') {
|
|
8622
|
+
g['${colas}'] = y;
|
|
8623
|
+
} else if (typeof y == 'object' && y instanceof Date) {
|
|
8624
|
+
g['${colas}'] = y;
|
|
8625
|
+
} else if (typeof y == 'object' && typeof Number(y) == 'number') {
|
|
8626
|
+
g['${colas}'] = Number(y);
|
|
8627
|
+
}
|
|
8628
|
+
} else if (g['${colas}'] !== null && typeof g['${colas}'] == 'object' && y instanceof Date) {
|
|
8629
|
+
g['${colas}'] = g['${colas}'];
|
|
8630
|
+
} else if (g['${colas}'] !== null && typeof g['${colas}'] == 'object') {
|
|
8631
|
+
g['${colas}'] = Number(g['${colas}']);
|
|
8632
|
+
}` +
|
|
8614
8633
|
post
|
|
8615
8634
|
);
|
|
8616
8635
|
}
|
|
8617
8636
|
return (
|
|
8618
8637
|
pre +
|
|
8619
|
-
`if((g['${colas}'] == null && ${colexp}!== null) ? y = ${colexp} :
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8638
|
+
`if((g['${colas}'] == null && ${colexp}!== null) ? y = ${colexp} :
|
|
8639
|
+
(g['${colas}']!== null && ${colexp} == null) ? y = g['${colas}'] :
|
|
8640
|
+
((y=${colexp}) < g['${colas}'])) {
|
|
8641
|
+
if(typeof y == 'number' || typeof y == 'bigint') {
|
|
8642
|
+
g['${colas}'] = y;
|
|
8643
|
+
} else if(typeof y == 'object' && y instanceof Date) {
|
|
8644
|
+
g['${colas}'] = y;
|
|
8645
|
+
} else if(typeof y == 'object' && typeof Number(y) == 'number') {
|
|
8646
|
+
g['${colas}'] = Number(y);
|
|
8647
|
+
}
|
|
8648
|
+
} else if(g['${colas}']!== null && typeof g['${colas}'] == 'object' && y instanceof Date) {
|
|
8649
|
+
g['${colas}'] = g['${colas}'];
|
|
8650
|
+
} else if(g['${colas}']!== null && typeof g['${colas}'] == 'object') {
|
|
8651
|
+
g['${colas}'] = Number(g['${colas}']);
|
|
8652
|
+
}` +
|
|
8625
8653
|
post
|
|
8626
8654
|
);
|
|
8627
8655
|
} else if (col.aggregatorid === 'MAX') {
|
|
@@ -8630,23 +8658,41 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8630
8658
|
|
|
8631
8659
|
return (
|
|
8632
8660
|
pre +
|
|
8633
|
-
`if((g['${colas}'] == null && ${colexp1}!== null) ? y = ${colexp} :
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8661
|
+
`if ((g['${colas}'] == null && ${colexp1} !== null) ? y = ${colexp} :
|
|
8662
|
+
(g['${colas}'] !== null && ${colexp1} == null) ? y = g['${colas}'] :
|
|
8663
|
+
((y = ${colexp}) > g['${colas}'])) {
|
|
8664
|
+
if (typeof y == 'number' || typeof y == 'bigint') {
|
|
8665
|
+
g['${colas}'] = y;
|
|
8666
|
+
} else if (typeof y == 'object' && y instanceof Date) {
|
|
8667
|
+
g['${colas}'] = y;
|
|
8668
|
+
} else if (typeof y == 'object' && typeof Number(y) == 'number') {
|
|
8669
|
+
g['${colas}'] = Number(y);
|
|
8670
|
+
}
|
|
8671
|
+
} else if (g['${colas}'] !== null && typeof g['${colas}'] == 'object' && y instanceof Date) {
|
|
8672
|
+
g['${colas}'] = g['${colas}'];
|
|
8673
|
+
} else if (g['${colas}'] !== null && typeof g['${colas}'] == 'object') {
|
|
8674
|
+
g['${colas}'] = Number(g['${colas}']);
|
|
8675
|
+
}` +
|
|
8639
8676
|
post
|
|
8640
8677
|
);
|
|
8641
8678
|
}
|
|
8642
8679
|
return (
|
|
8643
8680
|
pre +
|
|
8644
|
-
`if((g['${colas}'] == null && ${colexp}!== null) ? y = ${colexp} :
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8681
|
+
`if((g['${colas}'] == null && ${colexp}!== null) ? y = ${colexp} :
|
|
8682
|
+
(g['${colas}']!== null && ${colexp} == null) ? y = g['${colas}'] :
|
|
8683
|
+
((y=${colexp}) > g['${colas}'])) {
|
|
8684
|
+
if(typeof y == 'number' || typeof y == 'bigint') {
|
|
8685
|
+
g['${colas}'] = y;
|
|
8686
|
+
} else if(typeof y == 'object' && y instanceof Date) {
|
|
8687
|
+
g['${colas}'] = y;
|
|
8688
|
+
} else if(typeof y == 'object' && typeof Number(y) == 'number') {
|
|
8689
|
+
g['${colas}'] = Number(y);
|
|
8690
|
+
}
|
|
8691
|
+
} else if(g['${colas}']!== null && typeof g['${colas}'] == 'object' && y instanceof Date) {
|
|
8692
|
+
g['${colas}'] = g['${colas}'];
|
|
8693
|
+
} else if(g['${colas}']!== null && typeof g['${colas}'] == 'object') {
|
|
8694
|
+
g['${colas}'] = Number(g['${colas}']);
|
|
8695
|
+
}` +
|
|
8650
8696
|
post
|
|
8651
8697
|
);
|
|
8652
8698
|
} else if (col.aggregatorid === 'FIRST') {
|
|
@@ -8655,9 +8701,16 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8655
8701
|
return `${pre}g['${colas}']=${colexp};${post}`;
|
|
8656
8702
|
} else if (col.aggregatorid === 'AVG') {
|
|
8657
8703
|
return `${pre}
|
|
8658
|
-
|
|
8704
|
+
y= (${colexp});
|
|
8659
8705
|
g['_COUNT_${colas}'] += (typeof y == "undefined" || y === null) ? 0 : 1;
|
|
8660
|
-
g['${colas}']
|
|
8706
|
+
if (typeof g['_SUM_${colas}'] === 'bigint' || typeof y === 'bigint') {
|
|
8707
|
+
g['_SUM_${colas}'] = BigInt(g['_SUM_${colas}']);
|
|
8708
|
+
g['_SUM_${colas}'] += BigInt(y || 0);
|
|
8709
|
+
g['${colas}'] = BigInt(g['_SUM_${colas}']) / BigInt(g['_COUNT_${colas}']);
|
|
8710
|
+
} else {
|
|
8711
|
+
g['_SUM_${colas}'] += (y || 0);
|
|
8712
|
+
g['${colas}'] = g['_SUM_${colas}'] / g['_COUNT_${colas}'];
|
|
8713
|
+
}
|
|
8661
8714
|
${post}`;
|
|
8662
8715
|
} else if (col.aggregatorid === 'AGGR') {
|
|
8663
8716
|
return `${pre}
|
|
@@ -11419,6 +11472,7 @@ yy.Json.prototype.toString = function () {
|
|
|
11419
11472
|
const JSONtoString = (alasql.utils.JSONtoString = function (obj) {
|
|
11420
11473
|
if (typeof obj === 'string') return `"${obj}"`;
|
|
11421
11474
|
if (typeof obj === 'number' || typeof obj === 'boolean') return String(obj);
|
|
11475
|
+
if (typeof obj === 'bigint') return `${obj.toString()}n`;
|
|
11422
11476
|
|
|
11423
11477
|
if (Array.isArray(obj)) {
|
|
11424
11478
|
return `[${obj.map(b => JSONtoString(b)).join(',')}]`;
|
|
@@ -11448,6 +11502,7 @@ function JSONtoJS(obj, context, tableid, defcols) {
|
|
|
11448
11502
|
if (typeof obj == 'string') s = '"' + obj + '"';
|
|
11449
11503
|
else if (typeof obj == 'number') s = '(' + obj + ')';
|
|
11450
11504
|
else if (typeof obj == 'boolean') s = obj;
|
|
11505
|
+
else if (typeof obj === 'bigint') s = obj.toString() + 'n';
|
|
11451
11506
|
else if (typeof obj === 'object') {
|
|
11452
11507
|
if (Array.isArray(obj)) {
|
|
11453
11508
|
s += `[${obj.map(b => JSONtoJS(b, context, tableid, defcols)).join(',')}]`;
|