alasql 2.5.1 → 2.5.3
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 +1 -1
- package/dist/alasql-worker.js +2 -2
- package/dist/alasql-worker.min.js +1 -1
- package/dist/alasql.fs.js +460 -440
- package/dist/alasql.js +460 -440
- package/dist/alasql.min.js +3 -15
- package/package.json +5 -5
- package/.editorconfig +0 -11
- package/.eslintignore +0 -2
- package/yarn-error.log +0 -4971
package/dist/alasql.fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v2.5.
|
|
1
|
+
//! AlaSQL v2.5.2 build: develop-0e8a5557 | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 2.5.
|
|
4
|
+
@version 2.5.2
|
|
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.
|
|
146
|
-
alasql.build = 'develop-
|
|
145
|
+
alasql.version = '2.5.2';
|
|
146
|
+
alasql.build = 'develop-0e8a5557';
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
149
|
Debug flag
|
|
@@ -5153,15 +5153,19 @@ Table.prototype.indexColumns = function () {
|
|
|
5153
5153
|
*/
|
|
5154
5154
|
|
|
5155
5155
|
// Table class
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5156
|
+
class View {
|
|
5157
|
+
constructor(params) {
|
|
5158
|
+
// Columns
|
|
5159
|
+
this.columns = [];
|
|
5160
|
+
this.xcolumns = {};
|
|
5161
|
+
// Data array
|
|
5162
|
+
this.query = [];
|
|
5162
5163
|
|
|
5163
|
-
|
|
5164
|
-
}
|
|
5164
|
+
Object.assign(this, params);
|
|
5165
|
+
}
|
|
5166
|
+
}
|
|
5167
|
+
|
|
5168
|
+
alasql.View = View;
|
|
5165
5169
|
|
|
5166
5170
|
/*
|
|
5167
5171
|
//
|
|
@@ -5176,25 +5180,32 @@ var View = (alasql.View = function (params) {
|
|
|
5176
5180
|
/**
|
|
5177
5181
|
@class Query Main query class
|
|
5178
5182
|
*/
|
|
5179
|
-
|
|
5180
|
-
|
|
5183
|
+
class Query {
|
|
5184
|
+
constructor(params) {
|
|
5185
|
+
this.alasql = alasql;
|
|
5181
5186
|
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
}
|
|
5187
|
+
// Columns
|
|
5188
|
+
this.columns = [];
|
|
5189
|
+
this.xcolumns = {};
|
|
5190
|
+
this.selectGroup = [];
|
|
5191
|
+
this.groupColumns = {};
|
|
5192
|
+
// Data array
|
|
5193
|
+
Object.assign(this, params);
|
|
5194
|
+
}
|
|
5195
|
+
}
|
|
5190
5196
|
|
|
5191
5197
|
/**
|
|
5192
5198
|
@class Recordset data object
|
|
5193
5199
|
*/
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5200
|
+
class Recordset {
|
|
5201
|
+
constructor(params) {
|
|
5202
|
+
// Data array
|
|
5203
|
+
Object.assign(this, params);
|
|
5204
|
+
}
|
|
5205
|
+
}
|
|
5206
|
+
|
|
5207
|
+
alasql.Recordset = Recordset;
|
|
5208
|
+
alasql.Query = Query;
|
|
5198
5209
|
|
|
5199
5210
|
/*
|
|
5200
5211
|
//
|
|
@@ -7240,388 +7251,420 @@ function swapSources(query, h) {
|
|
|
7240
7251
|
|
|
7241
7252
|
/* global yy */
|
|
7242
7253
|
|
|
7243
|
-
yy.Select =
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
yy.Select.prototype.toString = function () {
|
|
7247
|
-
var s;
|
|
7248
|
-
s = '';
|
|
7249
|
-
if (this.explain) {
|
|
7250
|
-
s += 'EXPLAIN ';
|
|
7251
|
-
}
|
|
7252
|
-
s += 'SELECT ';
|
|
7253
|
-
if (this.modifier) {
|
|
7254
|
-
s += this.modifier + ' ';
|
|
7255
|
-
}
|
|
7256
|
-
if (this.distinct) {
|
|
7257
|
-
s += 'DISTINCT ';
|
|
7254
|
+
yy.Select = class Select {
|
|
7255
|
+
constructor(params) {
|
|
7256
|
+
Object.assign(this, params);
|
|
7258
7257
|
}
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7258
|
+
|
|
7259
|
+
toString() {
|
|
7260
|
+
var s;
|
|
7261
|
+
s = '';
|
|
7262
|
+
if (this.explain) {
|
|
7263
|
+
s += 'EXPLAIN ';
|
|
7263
7264
|
}
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7265
|
+
s += 'SELECT ';
|
|
7266
|
+
if (this.modifier) {
|
|
7267
|
+
s += this.modifier + ' ';
|
|
7268
|
+
}
|
|
7269
|
+
if (this.distinct) {
|
|
7270
|
+
s += 'DISTINCT ';
|
|
7271
|
+
}
|
|
7272
|
+
if (this.top) {
|
|
7273
|
+
s += 'TOP ' + this.top.value + ' ';
|
|
7274
|
+
if (this.percent) {
|
|
7275
|
+
s += 'PERCENT ';
|
|
7271
7276
|
}
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7277
|
+
}
|
|
7278
|
+
s += this.columns
|
|
7279
|
+
.map(function (col) {
|
|
7280
|
+
var s;
|
|
7281
|
+
s = col.toString();
|
|
7282
|
+
if (typeof col.as !== 'undefined') {
|
|
7283
|
+
s += ' AS ' + col.as;
|
|
7284
|
+
}
|
|
7285
|
+
return s;
|
|
7286
|
+
})
|
|
7287
|
+
.join(', ');
|
|
7288
|
+
if (this.from) {
|
|
7289
|
+
s +=
|
|
7290
|
+
' FROM ' +
|
|
7291
|
+
this.from
|
|
7292
|
+
.map(function (f) {
|
|
7293
|
+
var ss;
|
|
7294
|
+
ss = f.toString();
|
|
7295
|
+
if (f.as) {
|
|
7296
|
+
ss += ' AS ' + f.as;
|
|
7297
|
+
}
|
|
7298
|
+
return ss;
|
|
7299
|
+
})
|
|
7300
|
+
.join(',');
|
|
7301
|
+
}
|
|
7302
|
+
if (this.joins) {
|
|
7303
|
+
s += this.joins
|
|
7304
|
+
.map(function (jn) {
|
|
7280
7305
|
var ss;
|
|
7281
|
-
ss =
|
|
7282
|
-
if (
|
|
7283
|
-
ss +=
|
|
7306
|
+
ss = ' ';
|
|
7307
|
+
if (jn.joinmode) {
|
|
7308
|
+
ss += jn.joinmode + ' ';
|
|
7309
|
+
}
|
|
7310
|
+
if (jn.table) {
|
|
7311
|
+
ss += 'JOIN ' + jn.table.toString();
|
|
7312
|
+
} else if (jn.select) {
|
|
7313
|
+
ss += 'JOIN (' + jn.select.toString() + ')';
|
|
7314
|
+
} else if (jn instanceof alasql.yy.Apply) {
|
|
7315
|
+
ss += jn.toString();
|
|
7316
|
+
} else {
|
|
7317
|
+
throw new Error('Wrong type in JOIN mode');
|
|
7318
|
+
}
|
|
7319
|
+
if (jn.as) {
|
|
7320
|
+
ss += ' AS ' + jn.as;
|
|
7321
|
+
}
|
|
7322
|
+
if (jn.using) {
|
|
7323
|
+
ss += ' USING ' + jn.using.toString();
|
|
7324
|
+
}
|
|
7325
|
+
if (jn.on) {
|
|
7326
|
+
ss += ' ON ' + jn.on.toString();
|
|
7284
7327
|
}
|
|
7285
7328
|
return ss;
|
|
7286
7329
|
})
|
|
7287
|
-
.join('
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
s += ' HAVING ' + this.having.toString();
|
|
7333
|
-
}
|
|
7334
|
-
if (this.order && this.order.length > 0) {
|
|
7335
|
-
s +=
|
|
7336
|
-
' ORDER BY ' +
|
|
7337
|
-
this.order
|
|
7338
|
-
.map(function (ord) {
|
|
7339
|
-
return ord.toString();
|
|
7340
|
-
})
|
|
7341
|
-
.join(', ');
|
|
7342
|
-
}
|
|
7343
|
-
if (this.limit) {
|
|
7344
|
-
s += ' LIMIT ' + this.limit.value;
|
|
7345
|
-
}
|
|
7346
|
-
if (this.offset) {
|
|
7347
|
-
s += ' OFFSET ' + this.offset.value;
|
|
7348
|
-
}
|
|
7349
|
-
if (this.union) {
|
|
7350
|
-
s += ' UNION ' + (this.corresponding ? 'CORRESPONDING ' : '') + this.union.toString();
|
|
7351
|
-
}
|
|
7352
|
-
if (this.unionall) {
|
|
7353
|
-
s += ' UNION ALL ' + (this.corresponding ? 'CORRESPONDING ' : '') + this.unionall.toString();
|
|
7354
|
-
}
|
|
7355
|
-
if (this.except) {
|
|
7356
|
-
s += ' EXCEPT ' + (this.corresponding ? 'CORRESPONDING ' : '') + this.except.toString();
|
|
7357
|
-
}
|
|
7358
|
-
if (this.intersect) {
|
|
7359
|
-
s += ' INTERSECT ' + (this.corresponding ? 'CORRESPONDING ' : '') + this.intersect.toString();
|
|
7330
|
+
.join('');
|
|
7331
|
+
}
|
|
7332
|
+
if (this.where) {
|
|
7333
|
+
s += ' WHERE ' + this.where.toString();
|
|
7334
|
+
}
|
|
7335
|
+
if (this.group && this.group.length > 0) {
|
|
7336
|
+
s +=
|
|
7337
|
+
' GROUP BY ' +
|
|
7338
|
+
this.group
|
|
7339
|
+
.map(function (grp) {
|
|
7340
|
+
return grp.toString();
|
|
7341
|
+
})
|
|
7342
|
+
.join(', ');
|
|
7343
|
+
}
|
|
7344
|
+
if (this.having) {
|
|
7345
|
+
s += ' HAVING ' + this.having.toString();
|
|
7346
|
+
}
|
|
7347
|
+
if (this.order && this.order.length > 0) {
|
|
7348
|
+
s +=
|
|
7349
|
+
' ORDER BY ' +
|
|
7350
|
+
this.order
|
|
7351
|
+
.map(function (ord) {
|
|
7352
|
+
return ord.toString();
|
|
7353
|
+
})
|
|
7354
|
+
.join(', ');
|
|
7355
|
+
}
|
|
7356
|
+
if (this.limit) {
|
|
7357
|
+
s += ' LIMIT ' + this.limit.value;
|
|
7358
|
+
}
|
|
7359
|
+
if (this.offset) {
|
|
7360
|
+
s += ' OFFSET ' + this.offset.value;
|
|
7361
|
+
}
|
|
7362
|
+
if (this.union) {
|
|
7363
|
+
s += ' UNION ' + (this.corresponding ? 'CORRESPONDING ' : '') + this.union.toString();
|
|
7364
|
+
}
|
|
7365
|
+
if (this.unionall) {
|
|
7366
|
+
s += ' UNION ALL ' + (this.corresponding ? 'CORRESPONDING ' : '') + this.unionall.toString();
|
|
7367
|
+
}
|
|
7368
|
+
if (this.except) {
|
|
7369
|
+
s += ' EXCEPT ' + (this.corresponding ? 'CORRESPONDING ' : '') + this.except.toString();
|
|
7370
|
+
}
|
|
7371
|
+
if (this.intersect) {
|
|
7372
|
+
s += ' INTERSECT ' + (this.corresponding ? 'CORRESPONDING ' : '') + this.intersect.toString();
|
|
7373
|
+
}
|
|
7374
|
+
return s;
|
|
7360
7375
|
}
|
|
7361
|
-
return s;
|
|
7362
|
-
};
|
|
7363
|
-
|
|
7364
|
-
/**
|
|
7365
|
-
Select statement in expression
|
|
7366
|
-
*/
|
|
7367
|
-
yy.Select.prototype.toJS = function (context) {
|
|
7368
|
-
|
|
7369
|
-
// if(this.expression.reduced) return 'true';
|
|
7370
|
-
// return this.expression.toJS(context, tableid, defcols);
|
|
7371
7376
|
|
|
7372
|
-
|
|
7377
|
+
/**
|
|
7378
|
+
Select statement in expression
|
|
7379
|
+
*/
|
|
7380
|
+
toJS(context) {
|
|
7373
7381
|
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
(this.queriesidx - 1) +
|
|
7377
|
-
'](this.params,null,' +
|
|
7378
|
-
context +
|
|
7379
|
-
'))[0]';
|
|
7382
|
+
// if(this.expression.reduced) return 'true';
|
|
7383
|
+
// return this.expression.toJS(context, tableid, defcols);
|
|
7380
7384
|
|
|
7381
|
-
|
|
7382
|
-
|
|
7385
|
+
// var s = 'this.queriesdata['+(this.queriesidx-1)+'][0]';
|
|
7386
|
+
var s =
|
|
7387
|
+
'alasql.utils.flatArray(this.queriesfn[' +
|
|
7388
|
+
(this.queriesidx - 1) +
|
|
7389
|
+
'](this.params,null,' +
|
|
7390
|
+
context +
|
|
7391
|
+
'))[0]';
|
|
7383
7392
|
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
var db = alasql.databases[databaseid];
|
|
7387
|
-
// Create variable for query
|
|
7388
|
-
var query = new Query();
|
|
7393
|
+
return s;
|
|
7394
|
+
}
|
|
7389
7395
|
|
|
7390
|
-
//
|
|
7391
|
-
|
|
7392
|
-
|
|
7396
|
+
// Compile SELECT statement
|
|
7397
|
+
compile(databaseid, params) {
|
|
7398
|
+
var db = alasql.databases[databaseid];
|
|
7399
|
+
// Create variable for query
|
|
7400
|
+
var query = new Query();
|
|
7393
7401
|
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7402
|
+
// Array with columns to be removed
|
|
7403
|
+
query.removeKeys = [];
|
|
7404
|
+
query.aggrKeys = [];
|
|
7397
7405
|
|
|
7398
|
-
|
|
7406
|
+
query.explain = this.explain; // Explain
|
|
7407
|
+
query.explaination = [];
|
|
7408
|
+
query.explid = 1;
|
|
7399
7409
|
|
|
7400
|
-
|
|
7401
|
-
// 0. Precompile whereexists
|
|
7402
|
-
this.compileWhereExists(query);
|
|
7410
|
+
query.modifier = this.modifier;
|
|
7403
7411
|
|
|
7404
|
-
|
|
7405
|
-
|
|
7412
|
+
query.database = db;
|
|
7413
|
+
// 0. Precompile whereexists
|
|
7414
|
+
this.compileWhereExists(query);
|
|
7406
7415
|
|
|
7407
|
-
|
|
7416
|
+
// 0. Precompile queries for IN, NOT IN, ANY and ALL operators
|
|
7417
|
+
this.compileQueries(query);
|
|
7408
7418
|
|
|
7409
|
-
|
|
7410
|
-
query.fromfn = this.compileFrom(query);
|
|
7419
|
+
query.defcols = this.compileDefCols(query, databaseid);
|
|
7411
7420
|
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
this.compileJoins(query);
|
|
7415
|
-
}
|
|
7421
|
+
// 1. Compile FROM clause
|
|
7422
|
+
query.fromfn = this.compileFrom(query);
|
|
7416
7423
|
|
|
7417
|
-
|
|
7424
|
+
// 2. Compile JOIN clauses
|
|
7425
|
+
if (this.joins) {
|
|
7426
|
+
this.compileJoins(query);
|
|
7427
|
+
}
|
|
7418
7428
|
|
|
7419
|
-
|
|
7420
|
-
|
|
7429
|
+
// todo?: 3. Compile SELECT clause
|
|
7430
|
+
// For ROWNUM()
|
|
7431
|
+
query.rownums = [];
|
|
7421
7432
|
|
|
7422
|
-
|
|
7433
|
+
this.compileSelectGroup0(query);
|
|
7423
7434
|
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7435
|
+
if (this.group || query.selectGroup.length > 0) {
|
|
7436
|
+
query.selectgfns = this.compileSelectGroup1(query);
|
|
7437
|
+
} else {
|
|
7438
|
+
query.selectfns = this.compileSelect1(query, params);
|
|
7439
|
+
}
|
|
7429
7440
|
|
|
7430
|
-
|
|
7431
|
-
|
|
7441
|
+
// Remove columns clause
|
|
7442
|
+
this.compileRemoveColumns(query);
|
|
7432
7443
|
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7444
|
+
// 5. Optimize WHERE and JOINS
|
|
7445
|
+
if (this.where) {
|
|
7446
|
+
this.compileWhereJoins(query);
|
|
7447
|
+
}
|
|
7437
7448
|
|
|
7438
|
-
|
|
7439
|
-
|
|
7449
|
+
// 4. Compile WHERE clause
|
|
7450
|
+
query.wherefn = this.compileWhere(query);
|
|
7440
7451
|
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7452
|
+
// 6. Compile GROUP BY
|
|
7453
|
+
if (this.group || query.selectGroup.length > 0) {
|
|
7454
|
+
query.groupfn = this.compileGroup(query);
|
|
7455
|
+
}
|
|
7445
7456
|
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7457
|
+
// 6. Compile HAVING
|
|
7458
|
+
if (this.having) {
|
|
7459
|
+
query.havingfn = this.compileHaving(query);
|
|
7460
|
+
}
|
|
7450
7461
|
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7462
|
+
// 8. Compile ORDER BY clause
|
|
7463
|
+
if (this.order) {
|
|
7464
|
+
query.orderfn = this.compileOrder(query, params);
|
|
7465
|
+
}
|
|
7455
7466
|
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7467
|
+
if (this.group || query.selectGroup.length > 0) {
|
|
7468
|
+
query.selectgfn = this.compileSelectGroup2(query);
|
|
7469
|
+
} else {
|
|
7470
|
+
query.selectfn = this.compileSelect2(query, params);
|
|
7471
|
+
}
|
|
7461
7472
|
|
|
7462
|
-
|
|
7463
|
-
|
|
7473
|
+
// 7. Compile DISTINCT, LIMIT and OFFSET
|
|
7474
|
+
query.distinct = this.distinct;
|
|
7464
7475
|
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7476
|
+
// 9. Compile PIVOT clause
|
|
7477
|
+
if (this.pivot) query.pivotfn = this.compilePivot(query);
|
|
7478
|
+
if (this.unpivot) query.pivotfn = this.compileUnpivot(query);
|
|
7468
7479
|
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7480
|
+
// 10. Compile TOP/LIMIT/OFFSET/FETCH clause
|
|
7481
|
+
if (this.top) {
|
|
7482
|
+
query.limit = this.top.value;
|
|
7483
|
+
} else if (this.limit) {
|
|
7484
|
+
query.limit = this.limit.value;
|
|
7485
|
+
if (this.offset) {
|
|
7486
|
+
query.offset = this.offset.value;
|
|
7487
|
+
}
|
|
7476
7488
|
}
|
|
7477
|
-
}
|
|
7478
7489
|
|
|
7479
|
-
|
|
7490
|
+
query.percent = this.percent;
|
|
7480
7491
|
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7492
|
+
// 9. Compile ordering function for UNION and UNIONALL
|
|
7493
|
+
query.corresponding = this.corresponding; // If CORRESPONDING flag exists
|
|
7494
|
+
if (this.union) {
|
|
7495
|
+
query.unionfn = this.union.compile(databaseid);
|
|
7496
|
+
if (this.union.order) {
|
|
7497
|
+
query.orderfn = this.union.compileOrder(query, params);
|
|
7498
|
+
} else {
|
|
7499
|
+
query.orderfn = null;
|
|
7500
|
+
}
|
|
7501
|
+
} else if (this.unionall) {
|
|
7502
|
+
query.unionallfn = this.unionall.compile(databaseid);
|
|
7503
|
+
if (this.unionall.order) {
|
|
7504
|
+
query.orderfn = this.unionall.compileOrder(query, params);
|
|
7505
|
+
} else {
|
|
7506
|
+
query.orderfn = null;
|
|
7507
|
+
}
|
|
7508
|
+
} else if (this.except) {
|
|
7509
|
+
query.exceptfn = this.except.compile(databaseid);
|
|
7510
|
+
if (this.except.order) {
|
|
7511
|
+
query.orderfn = this.except.compileOrder(query, params);
|
|
7512
|
+
} else {
|
|
7513
|
+
query.orderfn = null;
|
|
7514
|
+
}
|
|
7515
|
+
} else if (this.intersect) {
|
|
7516
|
+
query.intersectfn = this.intersect.compile(databaseid);
|
|
7517
|
+
if (this.intersect.order) {
|
|
7518
|
+
query.intersectfn = this.intersect.compileOrder(query, params);
|
|
7519
|
+
} else {
|
|
7520
|
+
query.orderfn = null;
|
|
7521
|
+
}
|
|
7510
7522
|
}
|
|
7511
|
-
}
|
|
7512
7523
|
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
+
// SELECT INTO
|
|
7525
|
+
if (this.into) {
|
|
7526
|
+
if (this.into instanceof yy.Table) {
|
|
7527
|
+
//
|
|
7528
|
+
// Save into the table in database
|
|
7529
|
+
//
|
|
7530
|
+
if (
|
|
7531
|
+
alasql.options.autocommit &&
|
|
7532
|
+
alasql.databases[this.into.databaseid || databaseid].engineid
|
|
7533
|
+
) {
|
|
7534
|
+
// For external database when AUTOCOMMIT is ONs
|
|
7535
|
+
query.intoallfns =
|
|
7536
|
+
'return alasql.engines["' +
|
|
7537
|
+
alasql.databases[this.into.databaseid || databaseid].engineid +
|
|
7538
|
+
'"]' +
|
|
7539
|
+
'.intoTable("' +
|
|
7540
|
+
(this.into.databaseid || databaseid) +
|
|
7541
|
+
'","' +
|
|
7542
|
+
this.into.tableid +
|
|
7543
|
+
'",this.data, columns, cb);';
|
|
7544
|
+
} else {
|
|
7545
|
+
// Into AlaSQL tables
|
|
7546
|
+
query.intofns =
|
|
7547
|
+
"alasql.databases['" +
|
|
7548
|
+
(this.into.databaseid || databaseid) +
|
|
7549
|
+
"'].tables" +
|
|
7550
|
+
"['" +
|
|
7551
|
+
this.into.tableid +
|
|
7552
|
+
"'].data.push(r);";
|
|
7553
|
+
}
|
|
7554
|
+
} else if (this.into instanceof yy.VarValue) {
|
|
7555
|
+
//
|
|
7556
|
+
// Save into local variable
|
|
7557
|
+
// SELECT * INTO @VAR1 FROM ?
|
|
7558
|
+
//
|
|
7524
7559
|
query.intoallfns =
|
|
7525
|
-
'
|
|
7526
|
-
|
|
7527
|
-
'"]'
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
"'].data.push(r);";
|
|
7542
|
-
}
|
|
7543
|
-
} else if (this.into instanceof yy.VarValue) {
|
|
7544
|
-
//
|
|
7545
|
-
// Save into local variable
|
|
7546
|
-
// SELECT * INTO @VAR1 FROM ?
|
|
7547
|
-
//
|
|
7548
|
-
query.intoallfns =
|
|
7549
|
-
'alasql.vars["' +
|
|
7550
|
-
this.into.variable +
|
|
7551
|
-
'"]=this.data;res=this.data.length;if(cb)res=cb(res);return res;';
|
|
7552
|
-
} else if (this.into instanceof yy.FuncValue) {
|
|
7553
|
-
//
|
|
7554
|
-
// If this is INTO() function, then call it
|
|
7555
|
-
// with one or two parameters
|
|
7556
|
-
//
|
|
7557
|
-
var qs = 'return alasql.into[' + JSON.stringify(this.into.funcid.toUpperCase()) + '](';
|
|
7558
|
-
if (this.into.args && this.into.args.length > 0) {
|
|
7559
|
-
qs += this.into.args[0].toJS() + ',';
|
|
7560
|
-
if (this.into.args.length > 1) {
|
|
7561
|
-
qs += this.into.args[1].toJS() + ',';
|
|
7560
|
+
'alasql.vars["' +
|
|
7561
|
+
this.into.variable +
|
|
7562
|
+
'"]=this.data;res=this.data.length;if(cb)res=cb(res);return res;';
|
|
7563
|
+
} else if (this.into instanceof yy.FuncValue) {
|
|
7564
|
+
//
|
|
7565
|
+
// If this is INTO() function, then call it
|
|
7566
|
+
// with one or two parameters
|
|
7567
|
+
//
|
|
7568
|
+
var qs = 'return alasql.into[' + JSON.stringify(this.into.funcid.toUpperCase()) + '](';
|
|
7569
|
+
if (this.into.args && this.into.args.length > 0) {
|
|
7570
|
+
qs += this.into.args[0].toJS() + ',';
|
|
7571
|
+
if (this.into.args.length > 1) {
|
|
7572
|
+
qs += this.into.args[1].toJS() + ',';
|
|
7573
|
+
} else {
|
|
7574
|
+
qs += 'undefined,';
|
|
7575
|
+
}
|
|
7562
7576
|
} else {
|
|
7563
|
-
qs += 'undefined,';
|
|
7577
|
+
qs += 'undefined, undefined,';
|
|
7564
7578
|
}
|
|
7565
|
-
|
|
7566
|
-
qs += 'undefined, undefined,';
|
|
7567
|
-
}
|
|
7568
|
-
query.intoallfns = qs + 'this.data,columns,cb)';
|
|
7579
|
+
query.intoallfns = qs + 'this.data,columns,cb)';
|
|
7569
7580
|
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7581
|
+
} else if (this.into instanceof yy.ParamValue) {
|
|
7582
|
+
//
|
|
7583
|
+
// Save data into parameters array
|
|
7584
|
+
// like alasql('SELECT * INTO ? FROM ?',[outdata,srcdata]);
|
|
7585
|
+
//
|
|
7586
|
+
query.intofns = "params['" + this.into.param + "'].push(r)";
|
|
7587
|
+
}
|
|
7577
7588
|
|
|
7578
|
-
|
|
7579
|
-
|
|
7589
|
+
if (query.intofns) {
|
|
7590
|
+
// Create intofn function
|
|
7580
7591
|
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7592
|
+
query.intofn = new Function('r,i,params,alasql', 'var y;' + query.intofns);
|
|
7593
|
+
} else if (query.intoallfns) {
|
|
7594
|
+
// Create intoallfn function
|
|
7584
7595
|
|
|
7585
|
-
|
|
7596
|
+
query.intoallfn = new Function('columns,cb,params,alasql', 'var y;' + query.intoallfns);
|
|
7597
|
+
}
|
|
7586
7598
|
}
|
|
7587
|
-
}
|
|
7588
7599
|
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7600
|
+
// Now, compile all togeather into one function with query object in scope
|
|
7601
|
+
var statement = function (params, cb, oldscope) {
|
|
7602
|
+
query.params = params;
|
|
7603
|
+
// Note the callback function has the data and error reversed due to existing code in promiseExec which has the
|
|
7604
|
+
// err and data swapped. This trickles down into alasql.exec and further. Rather than risk breaking the whole thing,
|
|
7605
|
+
// the (data, err) standard is maintained here.
|
|
7606
|
+
var res1 = queryfn(query, oldscope, function (res, err) {
|
|
7607
|
+
if (err) {
|
|
7608
|
+
return cb(err, null);
|
|
7609
|
+
}
|
|
7610
|
+
if (query.rownums.length > 0) {
|
|
7611
|
+
for (var i = 0, ilen = res.length; i < ilen; i++) {
|
|
7612
|
+
for (var j = 0, jlen = query.rownums.length; j < jlen; j++) {
|
|
7613
|
+
res[i][query.rownums[j]] = i + 1;
|
|
7614
|
+
}
|
|
7603
7615
|
}
|
|
7604
7616
|
}
|
|
7605
|
-
}
|
|
7606
7617
|
|
|
7607
|
-
|
|
7618
|
+
var res2 = modify(query, res);
|
|
7608
7619
|
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7620
|
+
if (cb) {
|
|
7621
|
+
cb(res2);
|
|
7622
|
+
}
|
|
7612
7623
|
|
|
7613
|
-
|
|
7614
|
-
|
|
7624
|
+
return res2;
|
|
7625
|
+
});
|
|
7615
7626
|
|
|
7616
|
-
|
|
7627
|
+
// if(typeof res1 != 'undefined') res1 = modify(query,res1);
|
|
7628
|
+
return res1;
|
|
7629
|
+
};
|
|
7617
7630
|
|
|
7618
|
-
|
|
7619
|
-
};
|
|
7631
|
+
// statement.dbversion = ;
|
|
7620
7632
|
|
|
7621
|
-
|
|
7633
|
+
statement.query = query;
|
|
7634
|
+
return statement;
|
|
7635
|
+
}
|
|
7622
7636
|
|
|
7623
|
-
|
|
7624
|
-
|
|
7637
|
+
execute(databaseid, params, cb) {
|
|
7638
|
+
return this.compile(databaseid)(params, cb);
|
|
7639
|
+
// throw new Error('Insert statement is should be compiled')
|
|
7640
|
+
}
|
|
7641
|
+
|
|
7642
|
+
compileWhereExists(query) {
|
|
7643
|
+
if (!this.exists) return;
|
|
7644
|
+
query.existsfn = this.exists.map(function (ex) {
|
|
7645
|
+
var nq = ex.compile(query.database.databaseid);
|
|
7646
|
+
|
|
7647
|
+
// if(!nq.query.modifier) nq.query.modifier = 'RECORDSET';
|
|
7648
|
+
nq.query.modifier = 'RECORDSET';
|
|
7649
|
+
return nq;
|
|
7650
|
+
});
|
|
7651
|
+
}
|
|
7652
|
+
|
|
7653
|
+
compileQueries(query) {
|
|
7654
|
+
if (!this.queries) return;
|
|
7655
|
+
query.queriesfn = this.queries.map(function (q) {
|
|
7656
|
+
var nq = q.compile(query.database.databaseid);
|
|
7657
|
+
|
|
7658
|
+
// if(!nq.query) nq.query = {};
|
|
7659
|
+
nq.query.modifier = 'RECORDSET';
|
|
7660
|
+
// if(!nq.query.modifier) nq.query.modifier = 'RECORDSET';
|
|
7661
|
+
return nq;
|
|
7662
|
+
});
|
|
7663
|
+
}
|
|
7664
|
+
|
|
7665
|
+
// exec(databaseid) {
|
|
7666
|
+
// throw new Error('Select statement should be precompiled');
|
|
7667
|
+
// }
|
|
7625
7668
|
};
|
|
7626
7669
|
|
|
7627
7670
|
/**
|
|
@@ -7751,11 +7794,6 @@ function modify(query, res) {
|
|
|
7751
7794
|
return res;
|
|
7752
7795
|
}
|
|
7753
7796
|
|
|
7754
|
-
yy.Select.prototype.execute = function (databaseid, params, cb) {
|
|
7755
|
-
return this.compile(databaseid)(params, cb);
|
|
7756
|
-
// throw new Error('Insert statement is should be compiled')
|
|
7757
|
-
};
|
|
7758
|
-
|
|
7759
7797
|
/*
|
|
7760
7798
|
//
|
|
7761
7799
|
// EXISTS and other subqueries functions functions for Alasql.js
|
|
@@ -7764,43 +7802,23 @@ yy.Select.prototype.execute = function (databaseid, params, cb) {
|
|
|
7764
7802
|
//
|
|
7765
7803
|
*/
|
|
7766
7804
|
|
|
7767
|
-
yy.ExistsValue =
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
return 'EXISTS(' + this.value.toString() + ')';
|
|
7772
|
-
};
|
|
7773
|
-
|
|
7774
|
-
yy.ExistsValue.prototype.toType = function () {
|
|
7775
|
-
return 'boolean';
|
|
7776
|
-
};
|
|
7777
|
-
|
|
7778
|
-
yy.ExistsValue.prototype.toJS = function (context, tableid, defcols) {
|
|
7779
|
-
|
|
7780
|
-
return 'this.existsfn[' + this.existsidx + '](params,null,' + context + ').data.length';
|
|
7781
|
-
};
|
|
7805
|
+
yy.ExistsValue = class ExistsValue {
|
|
7806
|
+
constructor(params) {
|
|
7807
|
+
Object.assign(this, params);
|
|
7808
|
+
}
|
|
7782
7809
|
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
var nq = ex.compile(query.database.databaseid);
|
|
7810
|
+
toString() {
|
|
7811
|
+
return 'EXISTS(' + this.value.toString() + ')';
|
|
7812
|
+
}
|
|
7787
7813
|
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
});
|
|
7792
|
-
};
|
|
7814
|
+
toType() {
|
|
7815
|
+
return 'boolean';
|
|
7816
|
+
}
|
|
7793
7817
|
|
|
7794
|
-
|
|
7795
|
-
if (!this.queries) return;
|
|
7796
|
-
query.queriesfn = this.queries.map(function (q) {
|
|
7797
|
-
var nq = q.compile(query.database.databaseid);
|
|
7818
|
+
toJS(context, tableid, defcols) {
|
|
7798
7819
|
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
// if(!nq.query.modifier) nq.query.modifier = 'RECORDSET';
|
|
7802
|
-
return nq;
|
|
7803
|
-
});
|
|
7820
|
+
return 'this.existsfn[' + this.existsidx + '](params,null,' + context + ').data.length';
|
|
7821
|
+
}
|
|
7804
7822
|
};
|
|
7805
7823
|
|
|
7806
7824
|
//
|
|
@@ -8843,25 +8861,27 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8843
8861
|
if ('funcid' in col.expression) {
|
|
8844
8862
|
let colexp1 = colExpIfFunIdExists(col.expression);
|
|
8845
8863
|
return (
|
|
8846
|
-
pre +
|
|
8864
|
+
pre +
|
|
8847
8865
|
`if(typeof g['${colas}'] == 'string' && !isNaN(g['${colas}']) && typeof Number(g['${colas}']) == 'number' &&
|
|
8848
8866
|
typeof ${colexp1} == 'string' && !isNaN(${colexp1}) && typeof Number(${colexp1}) == 'number'){g['${colas}'] = Number(g['${colas}']) + Number(${colexp1})}
|
|
8849
8867
|
else if(typeof g['${colas}'] == 'string' && typeof ${colexp1} == 'string'){g['${colas}'] = 0}
|
|
8850
8868
|
else if(typeof g['${colas}'] == 'string' && typeof ${colexp1} == 'number'){g['${colas}'] = ${colexp1}}
|
|
8851
8869
|
else if(typeof ${colexp1} == 'string' && typeof g['${colas}'] == 'number'){g['${colas}'] = g['${colas}']}
|
|
8852
|
-
else{g['${colas}'] += ${colexp1}||0}`
|
|
8853
|
-
|
|
8870
|
+
else{g['${colas}'] += ${colexp1}||0}` +
|
|
8871
|
+
post
|
|
8854
8872
|
);
|
|
8855
8873
|
}
|
|
8856
|
-
return
|
|
8857
|
-
|
|
8874
|
+
return (
|
|
8875
|
+
pre +
|
|
8876
|
+
`if(typeof g['${colas}'] == 'string' && !isNaN(g['${colas}']) && typeof Number(g['${colas}']) == 'number' &&
|
|
8858
8877
|
typeof ${colexp} == 'string' && !isNaN(${colexp}) && typeof Number(${colexp}) == 'number'){g['${colas}'] = Number(g['${colas}']) + Number(${colexp})}
|
|
8859
8878
|
else if(typeof g['${colas}'] == 'string' && typeof ${colexp} == 'string'){g['${colas}'] = 0}
|
|
8860
8879
|
else if(typeof g['${colas}'] == 'string' && typeof ${colexp} == 'number'){g['${colas}'] = ${colexp}}
|
|
8861
8880
|
else if(typeof ${colexp} == 'string' && typeof g['${colas}'] == 'number'){g['${colas}'] = g['${colas}']}
|
|
8862
|
-
else{g['${colas}'] += ${colexp}||0}`
|
|
8863
|
-
|
|
8864
|
-
|
|
8881
|
+
else{g['${colas}'] += ${colexp}||0}` +
|
|
8882
|
+
post
|
|
8883
|
+
);
|
|
8884
|
+
} else if (col.aggregatorid === 'COUNT') {
|
|
8865
8885
|
|
|
8866
8886
|
if (col.expression.columnid === '*') {
|
|
8867
8887
|
return pre + "g['" + colas + "']++;" + post;
|
|
@@ -10122,15 +10142,18 @@ yy.Select.prototype.compileDefCols = function (query, databaseid) {
|
|
|
10122
10142
|
|
|
10123
10143
|
// SELECT UNION statement
|
|
10124
10144
|
|
|
10125
|
-
yy.Union =
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
return 'UNION';
|
|
10130
|
-
};
|
|
10145
|
+
yy.Union = class Union {
|
|
10146
|
+
constructor(params) {
|
|
10147
|
+
Object.assign(this, params);
|
|
10148
|
+
}
|
|
10131
10149
|
|
|
10132
|
-
|
|
10133
|
-
|
|
10150
|
+
toString() {
|
|
10151
|
+
return 'UNION';
|
|
10152
|
+
}
|
|
10153
|
+
|
|
10154
|
+
compile(tableid) {
|
|
10155
|
+
return null;
|
|
10156
|
+
}
|
|
10134
10157
|
};
|
|
10135
10158
|
|
|
10136
10159
|
/*
|
|
@@ -10141,16 +10164,18 @@ yy.Union.prototype.compile = function (tableid) {
|
|
|
10141
10164
|
//
|
|
10142
10165
|
*/
|
|
10143
10166
|
|
|
10144
|
-
yy.Apply =
|
|
10145
|
-
|
|
10146
|
-
|
|
10167
|
+
yy.Apply = class Apply {
|
|
10168
|
+
constructor(params) {
|
|
10169
|
+
Object.assign(this, params);
|
|
10170
|
+
}
|
|
10147
10171
|
|
|
10148
|
-
|
|
10149
|
-
|
|
10172
|
+
toString() {
|
|
10173
|
+
var s = this.applymode + ' APPLY (' + this.select.toString() + ')';
|
|
10150
10174
|
|
|
10151
|
-
|
|
10175
|
+
if (this.as) s += ' AS ' + this.as;
|
|
10152
10176
|
|
|
10153
|
-
|
|
10177
|
+
return s;
|
|
10178
|
+
}
|
|
10154
10179
|
};
|
|
10155
10180
|
|
|
10156
10181
|
/*
|
|
@@ -10161,20 +10186,23 @@ yy.Apply.prototype.toString = function () {
|
|
|
10161
10186
|
//
|
|
10162
10187
|
*/
|
|
10163
10188
|
|
|
10164
|
-
yy.Over =
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
yy.Over.prototype.toString = function () {
|
|
10168
|
-
var s = 'OVER (';
|
|
10169
|
-
if (this.partition) {
|
|
10170
|
-
s += 'PARTITION BY ' + this.partition.toString();
|
|
10171
|
-
if (this.order) s += ' ';
|
|
10189
|
+
yy.Over = class Over {
|
|
10190
|
+
constructor(params) {
|
|
10191
|
+
Object.assign(this, params);
|
|
10172
10192
|
}
|
|
10173
|
-
|
|
10174
|
-
|
|
10193
|
+
|
|
10194
|
+
toString() {
|
|
10195
|
+
var s = 'OVER (';
|
|
10196
|
+
if (this.partition) {
|
|
10197
|
+
s += 'PARTITION BY ' + this.partition.toString();
|
|
10198
|
+
if (this.order) s += ' ';
|
|
10199
|
+
}
|
|
10200
|
+
if (this.order) {
|
|
10201
|
+
s += 'ORDER BY ' + this.order.toString();
|
|
10202
|
+
}
|
|
10203
|
+
s += ')';
|
|
10204
|
+
return s;
|
|
10175
10205
|
}
|
|
10176
|
-
s += ')';
|
|
10177
|
-
return s;
|
|
10178
10206
|
};
|
|
10179
10207
|
|
|
10180
10208
|
/*
|
|
@@ -10574,21 +10602,9 @@ yy.Over.prototype.toString = function () {
|
|
|
10574
10602
|
this.right instanceof yy.NullValue ||
|
|
10575
10603
|
(this.right.op === 'NOT' && this.right.right instanceof yy.NullValue)
|
|
10576
10604
|
) {
|
|
10577
|
-
s = `(
|
|
10578
|
-
(${leftOperand}==null) // Cant be ===
|
|
10579
|
-
===
|
|
10580
|
-
(${rightOperand}==null) // Cant be ===
|
|
10581
|
-
)`;
|
|
10605
|
+
s = `((${leftOperand} == null) === (${rightOperand} == null))`; // == null cant be ===
|
|
10582
10606
|
} else {
|
|
10583
|
-
s = `(
|
|
10584
|
-
(${leftOperand} == ${rightOperand})
|
|
10585
|
-
||
|
|
10586
|
-
(
|
|
10587
|
-
${leftOperand} < 0
|
|
10588
|
-
&&
|
|
10589
|
-
true == ${rightOperand}
|
|
10590
|
-
)
|
|
10591
|
-
)`;
|
|
10607
|
+
s = `((${leftOperand} == ${rightOperand}) || (${leftOperand} < 0 && true == ${rightOperand}))`;
|
|
10592
10608
|
}
|
|
10593
10609
|
}
|
|
10594
10610
|
|
|
@@ -11165,8 +11181,9 @@ yy.Over.prototype.toString = function () {
|
|
|
11165
11181
|
|
|
11166
11182
|
toType() {
|
|
11167
11183
|
if (
|
|
11168
|
-
['SUM', 'COUNT', 'AVG', 'MIN', 'MAX', 'AGGR', 'VAR', 'STDDEV', 'TOTAL'].indexOf(
|
|
11169
|
-
|
|
11184
|
+
['SUM', 'COUNT', 'AVG', 'MIN', 'MAX', 'AGGR', 'VAR', 'STDDEV', 'TOTAL'].indexOf(
|
|
11185
|
+
this.aggregatorid
|
|
11186
|
+
) > -1
|
|
11170
11187
|
) {
|
|
11171
11188
|
return 'number';
|
|
11172
11189
|
}
|
|
@@ -14418,6 +14435,9 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
14418
14435
|
// INSERT INTO table SELECT
|
|
14419
14436
|
} else if (this.select) {
|
|
14420
14437
|
this.select.modifier = 'RECORDSET';
|
|
14438
|
+
if (this.queries) {
|
|
14439
|
+
this.select.queries = this.queries;
|
|
14440
|
+
}
|
|
14421
14441
|
var selectfn = this.select.compile(databaseid);
|
|
14422
14442
|
if (db.engineid && alasql.engines[db.engineid].intoTable) {
|
|
14423
14443
|
var statement = function (params, cb) {
|