baja-lite 1.0.5 → 1.0.7

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/es/sql.js CHANGED
@@ -22,6 +22,8 @@ import { C2P, C2P2, P2C } from './object';
22
22
  import { format } from 'sql-formatter';
23
23
  import HTML from 'html-parse-stringify';
24
24
  import { convert } from './convert-xml';
25
+ import { ArrayList } from './list';
26
+ import LGet from 'lodash.get';
25
27
  // #region 常量
26
28
  const _daoDBName = Symbol('dbName');
27
29
  const _tableName = Symbol('tableName');
@@ -47,6 +49,8 @@ const _inTransaction = Symbol('inTransaction');
47
49
  const _daoDB = Symbol('daoDB');
48
50
  const _sqliteRemoteName = Symbol('sqliteRemoteName');
49
51
  const _SqlOption = Symbol('SqlOption');
52
+ const _resultMap = Symbol('resultMap');
53
+ const _resultMap_SQLID = Symbol('resultMap_SQLID');
50
54
  export const _Hump = Symbol('Hump');
51
55
  export const _GlobalSqlOption = Symbol('GlobalSqlOption');
52
56
  export const _EventBus = Symbol('EventBus');
@@ -58,6 +62,7 @@ export const logger = process.env['NODE_ENV'] !== 'production' ? pino({
58
62
  target: 'pino-pretty'
59
63
  }
60
64
  }) : pino({ name: 'sql' });
65
+ globalThis[_resultMap_SQLID] = {};
61
66
  // #endregion
62
67
  // #region 可选配置
63
68
  export var DBType;
@@ -69,6 +74,15 @@ export var DBType;
69
74
  DBType[DBType["Redis"] = 4] = "Redis";
70
75
  DBType[DBType["RedisLock"] = 5] = "RedisLock";
71
76
  })(DBType || (DBType = {}));
77
+ ;
78
+ export var MapperIfUndefined;
79
+ (function (MapperIfUndefined) {
80
+ MapperIfUndefined[MapperIfUndefined["Null"] = 0] = "Null";
81
+ MapperIfUndefined[MapperIfUndefined["Skip"] = 1] = "Skip";
82
+ MapperIfUndefined[MapperIfUndefined["Zero"] = 2] = "Zero";
83
+ MapperIfUndefined[MapperIfUndefined["EmptyString"] = 3] = "EmptyString";
84
+ })(MapperIfUndefined || (MapperIfUndefined = {}));
85
+ ;
72
86
  export var SyncMode;
73
87
  (function (SyncMode) {
74
88
  /** 同步执行 */
@@ -145,17 +159,29 @@ export var TemplateResult;
145
159
  TemplateResult[TemplateResult["NotSureOne"] = 1] = "NotSureOne";
146
160
  /** 返回多条记录 */
147
161
  TemplateResult[TemplateResult["Many"] = 2] = "Many";
162
+ /** 返回多条记录并封装ArrayList */
163
+ TemplateResult[TemplateResult["ManyList"] = 3] = "ManyList";
148
164
  /** 仅查询记录数量 */
149
- TemplateResult[TemplateResult["Count"] = 3] = "Count";
165
+ TemplateResult[TemplateResult["Count"] = 4] = "Count";
150
166
  })(TemplateResult || (TemplateResult = {}));
151
167
  export var SelectResult;
152
168
  (function (SelectResult) {
153
- SelectResult[SelectResult["One_Row_One_Column_Assert"] = 0] = "One_Row_One_Column_Assert";
154
- SelectResult[SelectResult["One_Row_One_Column_NotSure"] = 1] = "One_Row_One_Column_NotSure";
155
- SelectResult[SelectResult["One_Row_Many_Column_Assert"] = 2] = "One_Row_Many_Column_Assert";
156
- SelectResult[SelectResult["One_Row_Many_Column_NotSure"] = 3] = "One_Row_Many_Column_NotSure";
157
- SelectResult[SelectResult["Many_Row_One_Column"] = 4] = "Many_Row_One_Column";
158
- SelectResult[SelectResult["Many_Row_Many_Column"] = 5] = "Many_Row_Many_Column";
169
+ /** 一行一列 确定非空 */
170
+ SelectResult[SelectResult["R_C_Assert"] = 0] = "R_C_Assert";
171
+ /** 一行一列 可能空 */
172
+ SelectResult[SelectResult["R_C_NotSure"] = 1] = "R_C_NotSure";
173
+ /** 一行多列 确定非空 */
174
+ SelectResult[SelectResult["R_CS_Assert"] = 2] = "R_CS_Assert";
175
+ /** 一行多列 可能空 */
176
+ SelectResult[SelectResult["R_CS_NotSure"] = 3] = "R_CS_NotSure";
177
+ /** 多行一列 */
178
+ SelectResult[SelectResult["RS_C"] = 4] = "RS_C";
179
+ /** 多行一列并封装ArrayList */
180
+ SelectResult[SelectResult["RS_C_List"] = 5] = "RS_C_List";
181
+ /** 多行多列 */
182
+ SelectResult[SelectResult["RS_CS"] = 6] = "RS_CS";
183
+ /** 多行多列并封装ArrayList */
184
+ SelectResult[SelectResult["RS_CS_List"] = 7] = "RS_CS_List";
159
185
  })(SelectResult || (SelectResult = {}));
160
186
  export var SqlType;
161
187
  (function (SqlType) {
@@ -1201,26 +1227,73 @@ function replaceCdata(rawText) {
1201
1227
  }
1202
1228
  return rawText;
1203
1229
  }
1230
+ function _flatData(result, i, length, keys, V) {
1231
+ var _d;
1232
+ const key = keys[i];
1233
+ if (i < length) {
1234
+ result[_d = key] ?? (result[_d] = {});
1235
+ i++;
1236
+ _flatData(result[key], i, length, keys, V);
1237
+ }
1238
+ else {
1239
+ result[key] = V;
1240
+ }
1241
+ }
1242
+ /**
1243
+ * ifUndefined默认是MapperIfUndefined.Skip
1244
+ */
1245
+ export function flatData(options) {
1246
+ if (typeof options.mapper === 'string') {
1247
+ const name = options.mapper;
1248
+ options.mapper = globalThis[_resultMap][name];
1249
+ Throw.if(!options.mapper, `not found mapper!${name}`);
1250
+ }
1251
+ options.mapperIfUndefined ?? (options.mapperIfUndefined = MapperIfUndefined.Skip);
1252
+ options.mapper = options.mapper;
1253
+ const result = {};
1254
+ for (const [columnName, keys, def] of options.mapper) {
1255
+ let V = options.data[columnName];
1256
+ if (V === undefined) {
1257
+ if (options.mapperIfUndefined === MapperIfUndefined.Null) {
1258
+ V = null;
1259
+ }
1260
+ else if (options.mapperIfUndefined === MapperIfUndefined.Zero) {
1261
+ V = 0;
1262
+ }
1263
+ else if (options.mapperIfUndefined === MapperIfUndefined.EmptyString) {
1264
+ V = '';
1265
+ }
1266
+ else if (def !== undefined) {
1267
+ V = def;
1268
+ }
1269
+ else {
1270
+ continue;
1271
+ }
1272
+ }
1273
+ _flatData(result, 0, keys.length - 1, keys, V);
1274
+ }
1275
+ return result;
1276
+ }
1204
1277
  export class SqlCache {
1205
1278
  constructor() {
1206
1279
  this.sqlMap = {};
1207
1280
  this.sqlFNMap = {};
1208
1281
  }
1209
- async init(options) {
1210
- if (options.sqlMap) {
1211
- this.sqlMap = options.sqlMap;
1212
- }
1213
- const queryTypes = ['sql', 'select', 'insert', 'update', 'delete'];
1214
- if (options.sqlDir) {
1215
- const sqlFis = globalThis[_fs].readdirSync(options.sqlDir);
1216
- for (const modeName of sqlFis) {
1217
- logger.debug(`sql: ${modeName} start explain!`);
1282
+ async _read(jsMode, sqlDir, queryTypes, rootName) {
1283
+ const sqlFis = globalThis[_fs].readdirSync(sqlDir);
1284
+ for (const modeName of sqlFis) {
1285
+ const file = globalThis[_path].join(sqlDir, modeName);
1286
+ const stat = globalThis[_fs].statSync(file);
1287
+ if (stat.isDirectory()) {
1288
+ await this._read(jsMode, file, queryTypes, modeName);
1289
+ }
1290
+ else {
1218
1291
  const extname = globalThis[_path].extname(modeName);
1219
1292
  const name = globalThis[_path].basename(modeName, extname);
1220
- const file = globalThis[_path].join(options.sqlDir, modeName);
1221
1293
  let ct = 0;
1222
1294
  if (extname === '.mu') {
1223
- const parser = new MUParser(name, globalThis[_fs].readFileSync(file, { encoding: 'utf-8' }).toString());
1295
+ logger.debug(`sql: ${file} start explain!`);
1296
+ const parser = new MUParser(rootName || name, globalThis[_fs].readFileSync(file, { encoding: 'utf-8' }).toString());
1224
1297
  let source = parser.next();
1225
1298
  while (source != null) {
1226
1299
  ct++;
@@ -1228,36 +1301,88 @@ export class SqlCache {
1228
1301
  logger.debug(`sql: ${source[0]} found!`);
1229
1302
  source = parser.next();
1230
1303
  }
1304
+ logger.debug(`sql: ${file} explain over[${ct}]!`);
1231
1305
  }
1232
- else if (extname === '.js') {
1233
- const obj = (await import(globalThis[_path].join(options.sqlDir, modeName))).default;
1306
+ else if (jsMode === true && extname === '.js') {
1307
+ logger.debug(`sql: ${file} start explain!`);
1308
+ const obj = (await import(globalThis[_path].join(sqlDir, modeName))).default;
1234
1309
  for (const [key, fn] of Object.entries(obj)) {
1235
1310
  ct++;
1236
- this.sqlMap[`${name}.${String(key)}`] = fn;
1311
+ this.sqlMap[`${rootName || name}.${String(key)}`] = fn;
1237
1312
  }
1313
+ logger.debug(`sql: ${file} explain over[${ct}]!`);
1238
1314
  }
1239
1315
  else if (extname === '.xml') {
1316
+ logger.debug(`sql: ${file} start explain!`);
1240
1317
  const root = HTML.parse(replaceCdata(globalThis[_fs].readFileSync(file, { encoding: 'utf-8' }).toString()))[0];
1241
1318
  if (root) {
1242
1319
  const mappers = root.children;
1243
1320
  for (const mapper of mappers) {
1244
- console.log(mapper);
1245
1321
  if (mapper.type === 'tag' && mapper.name === 'mapper') {
1246
1322
  for (const am of mapper.children) {
1247
1323
  if (am.type === 'tag') {
1248
- Throw.if(!queryTypes.includes(am.name), `${name}错误,${am.name}不支持!`);
1324
+ Throw.if(!queryTypes.includes(am.name), `${rootName} ${name}错误,${am.name}不支持!`);
1249
1325
  am.id = am.attrs['id'];
1250
- Throw.if(!am.id, `${name}错误,没有为此块设置id:${am}`);
1251
- this.sqlMap[`${name}.${am.id}`] = am.children;
1326
+ Throw.if(!am.id, `${rootName} ${name}错误,没有为此块设置id:${am}`);
1327
+ if (am.name === 'resultMap') {
1328
+ ct++;
1329
+ globalThis[_resultMap] ?? (globalThis[_resultMap] = {});
1330
+ const keys = [];
1331
+ this.readResultMap(am.children, keys, []);
1332
+ globalThis[_resultMap][am.id] = keys;
1333
+ logger.debug(`sql_resultMap: ${am.id} found!`);
1334
+ }
1335
+ else {
1336
+ this.sqlMap[`${rootName || name}.${am.id}`] = am.children;
1337
+ if (am.attrs['resultMap']) {
1338
+ globalThis[_resultMap_SQLID][`${rootName || name}.${am.id}`] = am.attrs['resultMap'];
1339
+ logger.debug(`sql: autoMapper: ${rootName || name}.${am.id}-${am.attrs['resultMap']}`);
1340
+ }
1341
+ logger.debug(`sql: ${rootName || name}.${am.id} found!`);
1342
+ ct++;
1343
+ }
1252
1344
  }
1253
1345
  }
1254
1346
  }
1255
1347
  }
1256
1348
  }
1349
+ logger.debug(`sql: ${file} explain over[${ct}]!`);
1257
1350
  }
1258
- logger.debug(`sql: ${modeName} explain over[${ct}]!`);
1259
1351
  }
1260
1352
  }
1353
+ }
1354
+ /**
1355
+ *
1356
+ * ```
1357
+ // 第一个元素=列名,第二个元素是属性路径,
1358
+ [
1359
+ ['dit_id', ['id']], // 列名ditid,对应属性id
1360
+ ['event_id', ['eventMainInfo', 'id']] // 列名event_id对应属性eventMainInfo.id
1361
+ ]
1362
+ * ```
1363
+ * @param am
1364
+ * @param keys
1365
+ */
1366
+ readResultMap(ams, keys, key) {
1367
+ for (const am of ams) {
1368
+ if (am.type === 'tag') {
1369
+ if (am.name === 'result' || am.name === 'id') {
1370
+ keys.push([am.attrs['column'], [...key, am.attrs['property']]]);
1371
+ }
1372
+ else {
1373
+ this.readResultMap(am.children, keys, [...key, am.attrs['property']]);
1374
+ }
1375
+ }
1376
+ }
1377
+ }
1378
+ async init(options) {
1379
+ if (options.sqlMap) {
1380
+ this.sqlMap = options.sqlMap;
1381
+ }
1382
+ const queryTypes = ['sql', 'select', 'insert', 'update', 'delete', 'resultMap'];
1383
+ if (options.sqlDir) {
1384
+ await this._read(options.jsMode === true, options.sqlDir, queryTypes, '');
1385
+ }
1261
1386
  if (options.sqlFNMap) {
1262
1387
  this.sqlFNMap = options.sqlFNMap;
1263
1388
  }
@@ -1272,6 +1397,21 @@ export class SqlCache {
1272
1397
  }
1273
1398
  }
1274
1399
  }
1400
+ if (options.sqlMapperMap) {
1401
+ globalThis[_resultMap] = options.sqlFNMap;
1402
+ }
1403
+ if (options.sqlMapperDir) {
1404
+ const sqlFis = globalThis[_fs].readdirSync(options.sqlDir);
1405
+ globalThis[_resultMap] ?? (globalThis[_resultMap] = {});
1406
+ for (const modeName of sqlFis) {
1407
+ const extname = globalThis[_path].extname(modeName);
1408
+ const name = globalThis[_path].basename(modeName, extname);
1409
+ const file = globalThis[_path].join(options.sqlDir, modeName);
1410
+ if (extname === 'json') {
1411
+ globalThis[_resultMap][name] = JSON.parse(globalThis[_fs].readFileSync(file, { encoding: 'utf-8' }).toString());
1412
+ }
1413
+ }
1414
+ }
1275
1415
  }
1276
1416
  load(sqlids, options) {
1277
1417
  let sqlSource;
@@ -1283,19 +1423,21 @@ export class SqlCache {
1283
1423
  }
1284
1424
  const matchSqlid = sqlids.map(i => i.split('.')[0]);
1285
1425
  Throw.if(!sqlSource, `指定的语句${sqlids.join('|')}不存在!`);
1426
+ const buildParam = new Build(options.isCount === true, options.isSum === true, options);
1286
1427
  if (typeof sqlSource === 'function') {
1287
1428
  const _sql = sqlSource(options);
1288
- const buildParam = new Build(options.isCount === true, options.isSum === true, options);
1289
1429
  const sql = mustache.render(_sql, buildParam, this.sqlFNMap);
1290
1430
  return format(sql);
1291
1431
  }
1292
1432
  else if (typeof sqlSource === 'string') {
1293
- const buildParam = new Build(options.isCount === true, options.isSum === true, options);
1294
1433
  const sql = mustache.render(sqlSource, buildParam, this.sqlFNMap);
1295
1434
  return format(sql);
1296
1435
  }
1297
1436
  else if (typeof sqlSource === 'object') {
1298
- const sql = convert(sqlSource, options, matchSqlid, this.sqlMap);
1437
+ const _sql = convert(sqlSource, options, matchSqlid, this.sqlMap);
1438
+ console.log(_sql);
1439
+ const sql = mustache.render(_sql, buildParam, this.sqlFNMap);
1440
+ console.log(sql);
1299
1441
  return format(sql);
1300
1442
  }
1301
1443
  return '';
@@ -2338,9 +2480,10 @@ export class SqlService {
2338
2480
  )`;
2339
2481
  }).join(' OR ');
2340
2482
  if (this[_stateFileName] !== undefined && option.forceDelete !== true) {
2483
+ params.unshift(this[_deleteState]);
2341
2484
  sqls.push({
2342
2485
  sql: format(`
2343
- UPDATE ${tableNameESC} SET ${this[_fields][this[_stateFileName]]?.C2()} = ${Sqlstring.escape(this[_deleteState])}
2486
+ UPDATE ${tableNameESC} SET ${this[_fields][this[_stateFileName]]?.C2()} = ?
2344
2487
  WHERE ${whereSql};
2345
2488
  `), params
2346
2489
  });
@@ -2359,7 +2502,8 @@ export class SqlService {
2359
2502
  if (this[_stateFileName] !== undefined && option.forceDelete !== true) {
2360
2503
  sqls.push({
2361
2504
  sql: format(`UPDATE ${tableNameESC} a INNER JOIN ${tableTempESC} b ON ${delWhere.map(K => `a.${this[_fields][K]?.C2()} = b.${this[_fields][K]?.C2()}`).join(' AND ')}
2362
- SET a.${this[_fields][this[_stateFileName]]?.C2()} = ${Sqlstring.escape(this[_deleteState])};`)
2505
+ SET a.${this[_fields][this[_stateFileName]]?.C2()} = ?;`),
2506
+ params: [this[_deleteState]]
2363
2507
  });
2364
2508
  }
2365
2509
  else {
@@ -2374,8 +2518,9 @@ export class SqlService {
2374
2518
  const columnNames = iterare(delWhere).map(K => this[_fields][K]?.C2()).join(',');
2375
2519
  if (this[_stateFileName] !== undefined && option.forceDelete !== true) {
2376
2520
  sqls.push({
2377
- sql: format(`UPDATE ${tableNameESC} SET ${this[_fields][this[_stateFileName]]?.C2()} = ${Sqlstring.escape(this[_deleteState])}
2378
- WHERE (${columnNames}) IN (SELECT ${columnNames} FROM ${tableTempESC});`)
2521
+ sql: format(`UPDATE ${tableNameESC} SET ${this[_fields][this[_stateFileName]]?.C2()} = ?
2522
+ WHERE (${columnNames}) IN (SELECT ${columnNames} FROM ${tableTempESC});`),
2523
+ params: [this[_deleteState]]
2379
2524
  });
2380
2525
  }
2381
2526
  else {
@@ -2442,6 +2587,9 @@ export class SqlService {
2442
2587
  case TemplateResult.Count: {
2443
2588
  return result[0].ct;
2444
2589
  }
2590
+ case TemplateResult.ManyList: {
2591
+ return new ArrayList(result[0]);
2592
+ }
2445
2593
  }
2446
2594
  }
2447
2595
  template(option) {
@@ -2518,153 +2666,135 @@ export class SqlService {
2518
2666
  });
2519
2667
  }
2520
2668
  }
2521
- _select(templateResult, result, def, errorMsg, multiple, hump) {
2522
- if (multiple === true) {
2523
- switch (templateResult) {
2524
- case SelectResult.One_Row_One_Column_NotSure: {
2525
- try {
2526
- return result.map((r) => Object.values(r)[0]);
2527
- }
2528
- catch (error) {
2529
- }
2669
+ _select(templateResult, result, def, errorMsg, hump, mapper, mapperIfUndefined) {
2670
+ switch (templateResult) {
2671
+ case SelectResult.R_C_NotSure: {
2672
+ try {
2673
+ return Object.values(result[0])[0];
2530
2674
  }
2531
- case SelectResult.One_Row_One_Column_Assert: {
2532
- try {
2533
- return iterare(result).map((r) => Object.values(r)[0]).filter((r) => r !== null).toArray();
2534
- }
2535
- catch (error) {
2536
- }
2675
+ catch (error) {
2676
+ return def;
2537
2677
  }
2538
- case SelectResult.One_Row_Many_Column_NotSure: {
2539
- try {
2540
- if (hump === true || (hump === undefined && globalThis[_Hump] === true)) {
2541
- return result.map((r) => C2P2(r[0]));
2542
- }
2543
- return result.map((r) => r[0]);
2544
- }
2545
- catch (error) {
2546
- }
2678
+ }
2679
+ case SelectResult.R_C_Assert: {
2680
+ try {
2681
+ return Object.values(result[0])[0];
2547
2682
  }
2548
- case SelectResult.One_Row_Many_Column_Assert: {
2549
- try {
2550
- if (hump === true || (hump === undefined && globalThis[_Hump] === true)) {
2551
- return iterare(result).map((r) => C2P2(r[0])).filter((r) => r !== null).toArray();
2552
- }
2553
- return iterare(result).map((r) => r[0]).filter((r) => r !== null).toArray();
2554
- }
2555
- catch (error) {
2556
- }
2683
+ catch (error) {
2684
+ if (def !== undefined)
2685
+ return def;
2686
+ Throw.now(errorMsg ?? 'not found data!');
2557
2687
  }
2558
- case SelectResult.Many_Row_One_Column: {
2559
- try {
2560
- return result.map((rx) => rx.map((r) => Object.values(r)[0]));
2561
- }
2562
- catch (error) {
2563
- }
2688
+ }
2689
+ case SelectResult.R_CS_NotSure: {
2690
+ if (mapper) {
2691
+ return flatData({ data: result[0], mapper, mapperIfUndefined });
2564
2692
  }
2565
- case SelectResult.Many_Row_Many_Column: {
2566
- if (hump === true || (hump === undefined && globalThis[_Hump] === true)) {
2567
- return iterare(result).map((r) => r.map((rr) => C2P2(rr))).toArray();
2568
- }
2569
- else {
2570
- return result;
2571
- }
2693
+ else if (hump === true || (hump === undefined && globalThis[_Hump] === true)) {
2694
+ return C2P2(result[0]) ?? null;
2695
+ }
2696
+ else {
2697
+ return result[0] ?? null;
2572
2698
  }
2573
2699
  }
2574
- }
2575
- else {
2576
- switch (templateResult) {
2577
- case SelectResult.One_Row_One_Column_NotSure: {
2578
- try {
2579
- return Object.values(result[0])[0];
2580
- }
2581
- catch (error) {
2582
- return def;
2583
- }
2700
+ case SelectResult.R_CS_Assert: {
2701
+ const data = result[0];
2702
+ Throw.if(data === null || data === undefined, errorMsg ?? 'not found data!');
2703
+ if (mapper) {
2704
+ return flatData({ data, mapper, mapperIfUndefined });
2584
2705
  }
2585
- case SelectResult.One_Row_One_Column_Assert: {
2586
- try {
2587
- return Object.values(result[0])[0];
2588
- }
2589
- catch (error) {
2590
- if (def !== undefined)
2591
- return def;
2592
- Throw.now(errorMsg ?? 'not found data!');
2593
- }
2706
+ else if (hump === true || (hump === undefined && globalThis[_Hump] === true)) {
2707
+ return C2P2(data) ?? null;
2594
2708
  }
2595
- case SelectResult.One_Row_Many_Column_NotSure: {
2596
- if (hump === true || (hump === undefined && globalThis[_Hump] === true)) {
2597
- return C2P2(result[0]) ?? null;
2598
- }
2599
- else {
2600
- return result[0] ?? null;
2601
- }
2709
+ else {
2710
+ return data ?? null;
2602
2711
  }
2603
- case SelectResult.One_Row_Many_Column_Assert: {
2604
- const data = result[0];
2605
- Throw.if(data === null || data === undefined, errorMsg ?? 'not found data!');
2606
- if (hump === true || (hump === undefined && globalThis[_Hump] === true)) {
2607
- return C2P2(data) ?? null;
2608
- }
2609
- else {
2610
- return data ?? null;
2611
- }
2712
+ }
2713
+ case SelectResult.RS_C: {
2714
+ try {
2715
+ return result.map((r) => Object.values(r)[0]);
2612
2716
  }
2613
- case SelectResult.Many_Row_One_Column: {
2614
- try {
2615
- return result.map((r) => Object.values(r)[0]);
2616
- }
2617
- catch (error) {
2618
- return def;
2619
- }
2717
+ catch (error) {
2718
+ return result;
2620
2719
  }
2621
- case SelectResult.Many_Row_Many_Column: {
2622
- if (hump === true || (hump === undefined && globalThis[_Hump] === true)) {
2623
- return iterare(result).map((r) => C2P2(r)).toArray();
2624
- }
2625
- else {
2626
- return result;
2627
- }
2720
+ }
2721
+ case SelectResult.RS_CS: {
2722
+ if (mapper) {
2723
+ return iterare(result).map((data) => flatData({ data, mapper, mapperIfUndefined })).toArray();
2724
+ }
2725
+ else if (hump === true || (hump === undefined && globalThis[_Hump] === true)) {
2726
+ return iterare(result).map((r) => C2P2(r)).toArray();
2727
+ }
2728
+ else {
2729
+ return result;
2730
+ }
2731
+ }
2732
+ case SelectResult.RS_C_List: {
2733
+ try {
2734
+ return new ArrayList(result.map((r) => Object.values(r)[0]));
2735
+ }
2736
+ catch (error) {
2737
+ return new ArrayList();
2738
+ }
2739
+ }
2740
+ case SelectResult.RS_CS_List: {
2741
+ if (mapper) {
2742
+ return new ArrayList(iterare(result).map((data) => flatData({ data, mapper, mapperIfUndefined })).toArray());
2743
+ }
2744
+ else if (hump === true || (hump === undefined && globalThis[_Hump] === true)) {
2745
+ return new ArrayList(iterare(result).map((r) => C2P2(r)).toArray());
2746
+ }
2747
+ else {
2748
+ return new ArrayList();
2628
2749
  }
2629
2750
  }
2630
2751
  }
2631
2752
  }
2632
2753
  select(option) {
2633
2754
  Throw.if(!option.sqlId && !option.sql, 'not found sql!');
2634
- option.selectResult ?? (option.selectResult = SelectResult.Many_Row_Many_Column);
2755
+ option.selectResult ?? (option.selectResult = SelectResult.RS_CS);
2635
2756
  option.defValue ?? (option.defValue = null);
2757
+ if (option.sqlId && globalThis[_resultMap_SQLID][option.sqlId] && !option.mapper) {
2758
+ option.mapper = globalThis[_resultMap_SQLID][option.sqlId];
2759
+ }
2636
2760
  const _params = Object.assign({}, option.context, option.params);
2637
2761
  option.sql ?? (option.sql = globalThis[_sqlCache].load(this._matchSqlid(option.sqlId), { ctx: option.context, isCount: option.isCount, ..._params }));
2638
2762
  const params = [];
2639
- const sql = option.sql?.replace(/\:(\w+)/g, (txt, key) => {
2640
- if (_params.hasOwnProperty(key)) {
2641
- const V = _params[key];
2642
- params.push(V);
2643
- return Sqlstring.escape(_params[key]);
2763
+ const sql = option.sql?.replace(/\:([A-Za-z0-9._]+)/g, (txt, key) => {
2764
+ let V = LGet(_params, key);
2765
+ if (V) {
2766
+ if (V !== undefined) {
2767
+ params.push(V);
2768
+ }
2769
+ return '?';
2644
2770
  }
2645
2771
  const _key = C2P(key);
2646
- if (_params.hasOwnProperty(_key)) {
2647
- const V = _params[_key];
2648
- params.push(V);
2649
- return Sqlstring.escape(_params[_key]);
2772
+ V = LGet(_params, _key);
2773
+ if (V) {
2774
+ if (V !== undefined) {
2775
+ params.push(V);
2776
+ }
2777
+ return '?';
2650
2778
  }
2651
2779
  const __key = P2C(key);
2652
- if (_params.hasOwnProperty(__key)) {
2653
- const V = _params[__key];
2654
- params.push(V);
2655
- return Sqlstring.escape(_params[__key]);
2780
+ V = LGet(_params, __key);
2781
+ if (V) {
2782
+ if (V !== undefined) {
2783
+ params.push(V);
2784
+ }
2785
+ return '?';
2656
2786
  }
2657
2787
  return txt;
2658
2788
  });
2659
2789
  if (option.sync === SyncMode.Sync) {
2660
2790
  const result = option.conn.query(SyncMode.Sync, sql, params);
2661
- return this._select(option.selectResult, result, option.defValue, option.errorMsg, option.multiple, option.hump);
2791
+ return this._select(option.selectResult, result, option.defValue, option.errorMsg, option.hump, option.mapper, option.mapperIfUndefined);
2662
2792
  }
2663
2793
  else {
2664
2794
  return new Promise(async (resolve, reject) => {
2665
2795
  try {
2666
2796
  const result = await option.conn.query(SyncMode.Async, sql, params);
2667
- resolve(this._select(option.selectResult, result, option.defValue, option.errorMsg, option.multiple));
2797
+ resolve(this._select(option.selectResult, result, option.defValue, option.errorMsg, option.hump, option.mapper, option.mapperIfUndefined));
2668
2798
  }
2669
2799
  catch (error) {
2670
2800
  reject(error);
@@ -2678,22 +2808,28 @@ export class SqlService {
2678
2808
  option.sql ?? (option.sql = globalThis[_sqlCache].load(this._matchSqlid(option.sqlId), { ctx: option.context, ..._params }));
2679
2809
  const params = [];
2680
2810
  const sql = option.sql?.replace(/\:(\w+)/g, (txt, key) => {
2681
- if (_params.hasOwnProperty(key)) {
2682
- const V = _params[key];
2683
- params.push(V);
2684
- return Sqlstring.escape(_params[key]);
2811
+ let V = LGet(_params, key);
2812
+ if (V) {
2813
+ if (V !== undefined) {
2814
+ params.push(V);
2815
+ }
2816
+ return '?';
2685
2817
  }
2686
2818
  const _key = C2P(key);
2687
- if (_params.hasOwnProperty(_key)) {
2688
- const V = _params[_key];
2689
- params.push(V);
2690
- return Sqlstring.escape(_params[_key]);
2819
+ V = LGet(_params, _key);
2820
+ if (V) {
2821
+ if (V !== undefined) {
2822
+ params.push(V);
2823
+ }
2824
+ return '?';
2691
2825
  }
2692
2826
  const __key = P2C(key);
2693
- if (_params.hasOwnProperty(__key)) {
2694
- const V = _params[__key];
2695
- params.push(V);
2696
- return Sqlstring.escape(_params[__key]);
2827
+ V = LGet(_params, __key);
2828
+ if (V) {
2829
+ if (V !== undefined) {
2830
+ params.push(V);
2831
+ }
2832
+ return '?';
2697
2833
  }
2698
2834
  return txt;
2699
2835
  });
@@ -2774,7 +2910,7 @@ export class SqlService {
2774
2910
  ...option,
2775
2911
  sql: sqlCount,
2776
2912
  sync: SyncMode.Sync,
2777
- selectResult: SelectResult.One_Row_One_Column_Assert
2913
+ selectResult: SelectResult.R_C_Assert
2778
2914
  });
2779
2915
  result.size = calc(result.total)
2780
2916
  .add(option.pageSize - 1)
@@ -2787,7 +2923,7 @@ export class SqlService {
2787
2923
  ...option,
2788
2924
  sql: sqlSum,
2789
2925
  sync: SyncMode.Sync,
2790
- selectResult: SelectResult.One_Row_Many_Column_Assert
2926
+ selectResult: SelectResult.R_CS_Assert
2791
2927
  });
2792
2928
  }
2793
2929
  if (sql) {
@@ -2795,7 +2931,7 @@ export class SqlService {
2795
2931
  ...option,
2796
2932
  sql,
2797
2933
  sync: SyncMode.Sync,
2798
- selectResult: SelectResult.Many_Row_Many_Column
2934
+ selectResult: SelectResult.RS_CS
2799
2935
  });
2800
2936
  }
2801
2937
  return result;
@@ -2808,7 +2944,7 @@ export class SqlService {
2808
2944
  ...option,
2809
2945
  sql: sqlCount,
2810
2946
  sync: SyncMode.Async,
2811
- selectResult: SelectResult.One_Row_One_Column_Assert
2947
+ selectResult: SelectResult.R_C_Assert
2812
2948
  });
2813
2949
  result.size = calc(result.total)
2814
2950
  .add(option.pageSize - 1)
@@ -2821,7 +2957,7 @@ export class SqlService {
2821
2957
  ...option,
2822
2958
  sql: sqlSum,
2823
2959
  sync: SyncMode.Async,
2824
- selectResult: SelectResult.One_Row_Many_Column_Assert
2960
+ selectResult: SelectResult.R_CS_Assert
2825
2961
  });
2826
2962
  }
2827
2963
  if (sql) {
@@ -2829,7 +2965,7 @@ export class SqlService {
2829
2965
  ...option,
2830
2966
  sql,
2831
2967
  sync: SyncMode.Async,
2832
- selectResult: SelectResult.Many_Row_Many_Column
2968
+ selectResult: SelectResult.RS_CS
2833
2969
  });
2834
2970
  }
2835
2971
  resolve(result);
@@ -3071,8 +3207,9 @@ class StreamQuery {
3071
3207
  this.if_proceed = condition;
3072
3208
  return this;
3073
3209
  }
3074
- eq(key, value, { name } = {}) { return this._(key, value, '=', { name }); }
3075
- eqT(t, { name } = {}) {
3210
+ eq(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._(key, value, '=', { paramName, skipEmptyString, breakExcuteIfSkip }); }
3211
+ eqT(t, { name: paramName = '', breakExcuteIfSkip = false } = {}) {
3212
+ let exe = false;
3076
3213
  if (t) {
3077
3214
  t = this._service[_transformer](t, {
3078
3215
  skipNull: true,
@@ -3081,8 +3218,8 @@ class StreamQuery {
3081
3218
  });
3082
3219
  const keys = Object.keys(t);
3083
3220
  if (keys.length > 0) {
3084
- if (name && this._paramKeys[name]) {
3085
- for (const [key, pname] of Object.entries(this._paramKeys[name])) {
3221
+ if (paramName && this._paramKeys[paramName]) {
3222
+ for (const [key, pname] of Object.entries(this._paramKeys[paramName])) {
3086
3223
  this._param[pname] = t[key];
3087
3224
  }
3088
3225
  }
@@ -3092,75 +3229,79 @@ class StreamQuery {
3092
3229
  const pkey = `p${this._prefix}${this._index++}`;
3093
3230
  this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} = :${pkey} `);
3094
3231
  this._param[pkey] = value;
3095
- if (name) {
3232
+ if (paramName) {
3096
3233
  paramKeys[key] = pkey;
3097
3234
  }
3098
3235
  }
3099
- if (name) {
3100
- this._paramKeys[name] = paramKeys;
3236
+ if (paramName) {
3237
+ this._paramKeys[paramName] = paramKeys;
3101
3238
  }
3102
3239
  }
3240
+ exe = true;
3103
3241
  }
3104
3242
  }
3243
+ if (breakExcuteIfSkip === true && exe === false) {
3244
+ this.if_exec = false;
3245
+ }
3105
3246
  return this;
3106
3247
  }
3107
- notEq(key, value, { name } = {}) { return this._(key, value, '<>', { name }); }
3248
+ notEq(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._(key, value, '<>', { paramName, skipEmptyString, breakExcuteIfSkip }); }
3108
3249
  eqWith(key1, key2) { return this._key(key1, key2, '='); }
3109
3250
  notEqWith(key1, key2) { return this._key(key1, key2, '<>'); }
3110
- regexp(key, regexp, { name } = {}) { return this._(key, regexp, 'REGEXP', { name }); }
3111
- notRegexp(key, regexp, { name } = {}) { return this._(key, regexp, 'REGEXP', { name, not: 'NOT' }); }
3251
+ regexp(key, regexp, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._(key, regexp, 'REGEXP', { paramName, skipEmptyString: true, breakExcuteIfSkip }); }
3252
+ notRegexp(key, regexp, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._(key, regexp, 'REGEXP', { paramName, skipEmptyString: true, not: 'NOT', breakExcuteIfSkip }); }
3112
3253
  /** (key1 << 8) + key2 = value */
3113
- shiftEq(key1, key2, value, { name } = {}) { return this._shift(key1, key2, value, '=', { name }); }
3254
+ shiftEq(key1, key2, value, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._shift(key1, key2, value, '=', { paramName, breakExcuteIfSkip }); }
3114
3255
  /** (key1 << 8) + key2 <> value */
3115
- shiftNotEq(key1, key2, value, { name } = {}) { return this._shift(key1, key2, value, '<>', { name }); }
3116
- grate(key, value, { name } = {}) { return this._(key, value, '>', { name }); }
3117
- grateEq(key, value, { name } = {}) { return this._(key, value, '>=', { name }); }
3256
+ shiftNotEq(key1, key2, value, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._shift(key1, key2, value, '<>', { paramName, breakExcuteIfSkip }); }
3257
+ grate(key, value, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._(key, value, '>', { paramName, skipEmptyString: true, breakExcuteIfSkip }); }
3258
+ grateEq(key, value, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._(key, value, '>=', { paramName, skipEmptyString: true, breakExcuteIfSkip }); }
3118
3259
  grateWith(key1, key2) { return this._key(key1, key2, '>'); }
3119
3260
  grateEqWith(key1, key2) { return this._key(key1, key2, '>='); }
3120
- less(key, value, { name } = {}) { return this._(key, value, '<', { name }); }
3121
- lessEq(key, value, { name } = {}) { return this._(key, value, '<=', { name }); }
3261
+ less(key, value, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._(key, value, '<', { paramName, skipEmptyString: true, breakExcuteIfSkip }); }
3262
+ lessEq(key, value, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._(key, value, '<=', { paramName, skipEmptyString: true, breakExcuteIfSkip }); }
3122
3263
  lessWith(key1, key2) { return this._key(key1, key2, '<'); }
3123
3264
  lessEqWith(key1, key2) { return this._key(key1, key2, '<='); }
3124
- like(key, value, { name, force } = {}) { return this._like(key, value, { name, left: '%', right: '%', force }); }
3125
- notLike(key, value, { name, force } = {}) { return this._like(key, value, { name, left: '%', right: '%', not: 'NOT', force }); }
3126
- leftLike(key, value, { name, force } = {}) { return this._like(key, value, { name, left: '%', force }); }
3127
- notLeftLike(key, value, { name, force } = {}) { return this._like(key, value, { name, left: '%', not: 'NOT', force }); }
3128
- rightLike(key, value, { name, force } = {}) { return this._like(key, value, { name, right: '%', force }); }
3129
- notRightLike(key, value, { name, force } = {}) { return this._like(key, value, { name, right: '%', not: 'NOT', force }); }
3130
- PreciseLike(key, value, { name, force } = {}) { return this._like(key, value, { name, force }); }
3131
- notPreciseLike(key, value, { name, force } = {}) { return this._like(key, value, { name, not: 'NOT', force }); }
3132
- glob(key, value, { name, force } = {}) { return this._like(key, value, { name, left: '%', right: '%', force, op: 'GLOB' }); }
3133
- notGlob(key, value, { name, force } = {}) { return this._like(key, value, { name, left: '%', right: '%', not: 'NOT', force, op: 'GLOB' }); }
3134
- leftGlob(key, value, { name, force } = {}) { return this._like(key, value, { name, left: '%', force, op: 'GLOB' }); }
3135
- notLeftGlob(key, value, { name, force } = {}) { return this._like(key, value, { name, left: '%', not: 'NOT', force, op: 'GLOB' }); }
3136
- rightGlob(key, value, { name, force } = {}) { return this._like(key, value, { name, right: '%', force, op: 'GLOB' }); }
3137
- notRightGlob(key, value, { name, force } = {}) { return this._like(key, value, { name, right: '%', not: 'NOT', force, op: 'GLOB' }); }
3138
- PreciseGlob(key, value, { name, force } = {}) { return this._like(key, value, { name, force, op: 'GLOB' }); }
3139
- notPreciseGlob(key, value, { name, force } = {}) { return this._like(key, value, { name, not: 'NOT', force, op: 'GLOB' }); }
3140
- in(key, value, { name, force } = {}) { return this._in(key, value, { name, force }); }
3141
- notIn(key, value, { name, force } = {}) { return this._in(key, value, { name, not: 'NOT', force }); }
3265
+ like(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, left: '%', right: '%', breakExcuteIfSkip }); }
3266
+ notLike(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, left: '%', right: '%', not: 'NOT', breakExcuteIfSkip }); }
3267
+ leftLike(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, left: '%', breakExcuteIfSkip }); }
3268
+ notLeftLike(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, left: '%', not: 'NOT', breakExcuteIfSkip }); }
3269
+ rightLike(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, right: '%', breakExcuteIfSkip }); }
3270
+ notRightLike(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, right: '%', not: 'NOT', breakExcuteIfSkip }); }
3271
+ PreciseLike(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, breakExcuteIfSkip }); }
3272
+ notPreciseLike(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfSkip }); }
3273
+ glob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, left: '%', right: '%', breakExcuteIfSkip, op: 'GLOB' }); }
3274
+ notGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, left: '%', right: '%', not: 'NOT', breakExcuteIfSkip, op: 'GLOB' }); }
3275
+ leftGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, left: '%', breakExcuteIfSkip, op: 'GLOB' }); }
3276
+ notLeftGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, left: '%', not: 'NOT', breakExcuteIfSkip, op: 'GLOB' }); }
3277
+ rightGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, right: '%', breakExcuteIfSkip, op: 'GLOB' }); }
3278
+ notRightGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, right: '%', not: 'NOT', breakExcuteIfSkip, op: 'GLOB' }); }
3279
+ PreciseGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, breakExcuteIfSkip, op: 'GLOB' }); }
3280
+ notPreciseGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfSkip, op: 'GLOB' }); }
3281
+ in(key, value, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._in(key, value, { paramName, breakExcuteIfSkip }); }
3282
+ notIn(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._in(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfSkip }); }
3142
3283
  isNULL(key) { return this._null(key); }
3143
3284
  isNotNULL(key) { return this._null(key, 'NOT'); }
3144
- between(key, value1, value2, { name } = {}) { return this._between(key, value1, value2, { name }); }
3145
- notBetween(key, value1, value2, { name } = {}) { return this._between(key, value1, value2, { name, not: 'NOT' }); }
3146
- pow(key, value, { name } = {}) { return this._pow(key, value, { name }); }
3147
- notPow(key, value, { name } = {}) { return this._pow(key, value, { name, not: 'NOT' }); }
3148
- powWith(key, values, { name } = {}) { return this._pow(key, add(...values.map(value => Math.pow(2, +value))), { name }); }
3149
- notPowWith(key, values, { name } = {}) { return this._pow(key, add(...values.map(value => Math.pow(2, +value))), { name, not: 'NOT' }); }
3285
+ between(key, value1, value2, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._between(key, value1, value2, { paramName, skipEmptyString, breakExcuteIfSkip }); }
3286
+ notBetween(key, value1, value2, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._between(key, value1, value2, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfSkip }); }
3287
+ pow(key, value, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._pow(key, value, { paramName, breakExcuteIfSkip }); }
3288
+ notPow(key, value, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._pow(key, value, { paramName, not: 'NOT', breakExcuteIfSkip }); }
3289
+ powWith(key, values, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._pow(key, add(...values.map(value => Math.pow(2, +value))), { paramName, breakExcuteIfSkip }); }
3290
+ notPowWith(key, values, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._pow(key, add(...values.map(value => Math.pow(2, +value))), { paramName, not: 'NOT', breakExcuteIfSkip }); }
3150
3291
  /** MATCH(key1, key2, key3) AGAINST (value) */
3151
- match(value, keys, { name } = {}) { return this._match(value, keys, { name }); }
3292
+ match(value, keys, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._match(value, keys, { paramName, skipEmptyString, breakExcuteIfSkip }); }
3152
3293
  /** NOT MATCH(key1, key2, key3) AGAINST (value) */
3153
- notMatch(value, keys, { name } = {}) { return this._match(value, keys, { name, not: 'NOT' }); }
3294
+ notMatch(value, keys, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._match(value, keys, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfSkip }); }
3154
3295
  /** MATCH(key1, key2, key3) AGAINST (value) IN BOOLEAN MODE*/
3155
- matchBoolean(value, keys, { name } = {}) { return this._match(value, keys, { name, append: 'IN BOOLEAN MODE' }); }
3296
+ matchBoolean(value, keys, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._match(value, keys, { paramName, skipEmptyString, breakExcuteIfSkip, append: 'IN BOOLEAN MODE' }); }
3156
3297
  /** NOT MATCH(key1, key2, key3) AGAINST (value) IN BOOLEAN MODE */
3157
- notMatchBoolean(value, keys, { name } = {}) { return this._match(value, keys, { name, not: 'NOT', append: 'IN BOOLEAN MODE' }); }
3298
+ notMatchBoolean(value, keys, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._match(value, keys, { paramName, skipEmptyString, breakExcuteIfSkip, not: 'NOT', append: 'IN BOOLEAN MODE' }); }
3158
3299
  /** MATCH(key1, key2, key3) AGAINST (value) WITH QUERY EXPANSION*/
3159
- matchQuery(value, keys, { name } = {}) { return this._match(value, keys, { name, append: 'WITH QUERY EXPANSION' }); }
3300
+ matchQuery(value, keys, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._match(value, keys, { paramName, skipEmptyString, breakExcuteIfSkip, append: 'WITH QUERY EXPANSION' }); }
3160
3301
  /** NOT MATCH(key1, key2, key3) AGAINST (value) WITH QUERY EXPANSION*/
3161
- notMatchQuery(value, keys, { name } = {}) { return this._match(value, keys, { name, not: 'NOT', append: 'WITH QUERY EXPANSION' }); }
3162
- includes(key, value, { name } = {}) { return this._includes(key, value, { name }); }
3163
- notIncludes(key, value, { name } = {}) { return this._includes(key, value, { name, not: 'NOT' }); }
3302
+ notMatchQuery(value, keys, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._match(value, keys, { paramName, skipEmptyString, breakExcuteIfSkip, not: 'NOT', append: 'WITH QUERY EXPANSION' }); }
3303
+ includes(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._includes(key, value, { paramName, skipEmptyString, breakExcuteIfSkip }); }
3304
+ notIncludes(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._includes(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfSkip }); }
3164
3305
  and(fn) {
3165
3306
  if (fn instanceof StreamQuery) {
3166
3307
  this._andQuerys.push(fn);
@@ -3227,7 +3368,7 @@ class StreamQuery {
3227
3368
  excuteSelect(option) {
3228
3369
  option ?? (option = {});
3229
3370
  option.sync ?? (option.sync = SyncMode.Async);
3230
- option.selectResult ?? (option.selectResult = SelectResult.Many_Row_Many_Column);
3371
+ option.selectResult ?? (option.selectResult = SelectResult.RS_CS);
3231
3372
  const { where, params } = this._where();
3232
3373
  let sql = `
3233
3374
  SELECT
@@ -3235,6 +3376,8 @@ class StreamQuery {
3235
3376
  FROM ${this._table}
3236
3377
  ${where ? ' WHERE ' : ''}
3237
3378
  ${where}
3379
+ ${this._groups.length > 0 ? `GROUP BY ${this._groups.join(',')} ` : ''}
3380
+ ${this._orders.length > 0 ? `ORDER BY ${this._orders.join(',')} ` : ''}
3238
3381
  `;
3239
3382
  if (this._startRow && this._pageSize) {
3240
3383
  sql += `LIMIT ${this._startRow}, ${this._pageSize}`;
@@ -3244,25 +3387,113 @@ class StreamQuery {
3244
3387
  }
3245
3388
  if (option.sync === SyncMode.Async) {
3246
3389
  switch (option.selectResult) {
3247
- case SelectResult.Many_Row_Many_Column: return this._service.select({ sync: SyncMode.Async, selectResult: SelectResult.Many_Row_Many_Column, errorMsg: option.errorMsg, sql, params });
3248
- case SelectResult.Many_Row_One_Column: return this._service.select({ sync: SyncMode.Async, selectResult: SelectResult.Many_Row_One_Column, errorMsg: option.errorMsg, sql, params });
3249
- case SelectResult.One_Row_Many_Column_Assert: return this._service.select({ sync: SyncMode.Async, selectResult: SelectResult.One_Row_Many_Column_Assert, errorMsg: option.errorMsg, sql, params });
3250
- case SelectResult.One_Row_One_Column_Assert: return this._service.select({ sync: SyncMode.Async, selectResult: SelectResult.One_Row_One_Column_Assert, errorMsg: option.errorMsg, sql, params });
3251
- case SelectResult.One_Row_Many_Column_NotSure: return this._service.select({ sync: SyncMode.Async, selectResult: SelectResult.One_Row_Many_Column_NotSure, errorMsg: option.errorMsg, sql, params });
3252
- case SelectResult.One_Row_One_Column_NotSure: return this._service.select({ sync: SyncMode.Async, selectResult: SelectResult.One_Row_One_Column_NotSure, errorMsg: option.errorMsg, sql, params });
3390
+ case SelectResult.RS_CS: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.RS_CS, sql, params });
3391
+ case SelectResult.RS_C: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.RS_C, sql, params });
3392
+ case SelectResult.RS_CS_List: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.RS_CS_List, sql, params });
3393
+ case SelectResult.RS_C_List: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.RS_C_List, sql, params });
3394
+ case SelectResult.R_CS_Assert: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.R_CS_Assert, sql, params });
3395
+ case SelectResult.R_C_Assert: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.R_C_Assert, sql, params });
3396
+ case SelectResult.R_CS_NotSure: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.R_CS_NotSure, sql, params });
3397
+ case SelectResult.R_C_NotSure: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.R_C_NotSure, sql, params });
3253
3398
  }
3254
3399
  }
3255
3400
  else {
3256
3401
  switch (option.selectResult) {
3257
- case SelectResult.Many_Row_Many_Column: return this._service.select({ sync: SyncMode.Sync, selectResult: SelectResult.Many_Row_Many_Column, errorMsg: option.errorMsg, sql, params });
3258
- case SelectResult.Many_Row_One_Column: return this._service.select({ sync: SyncMode.Sync, selectResult: SelectResult.Many_Row_One_Column, errorMsg: option.errorMsg, sql, params });
3259
- case SelectResult.One_Row_Many_Column_Assert: return this._service.select({ sync: SyncMode.Sync, selectResult: SelectResult.One_Row_Many_Column_Assert, errorMsg: option.errorMsg, sql, params });
3260
- case SelectResult.One_Row_One_Column_Assert: return this._service.select({ sync: SyncMode.Sync, selectResult: SelectResult.One_Row_One_Column_Assert, errorMsg: option.errorMsg, sql, params });
3261
- case SelectResult.One_Row_Many_Column_NotSure: return this._service.select({ sync: SyncMode.Sync, selectResult: SelectResult.One_Row_Many_Column_NotSure, errorMsg: option.errorMsg, sql, params });
3262
- case SelectResult.One_Row_One_Column_NotSure: return this._service.select({ sync: SyncMode.Sync, selectResult: SelectResult.One_Row_One_Column_NotSure, errorMsg: option.errorMsg, sql, params });
3402
+ case SelectResult.RS_CS: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.RS_CS, sql, params });
3403
+ case SelectResult.RS_C: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.RS_C, sql, params });
3404
+ case SelectResult.RS_CS_List: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.RS_CS_List, sql, params });
3405
+ case SelectResult.RS_C_List: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.RS_C_List, sql, params });
3406
+ case SelectResult.R_CS_Assert: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.R_CS_Assert, sql, params });
3407
+ case SelectResult.R_C_Assert: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.R_C_Assert, sql, params });
3408
+ case SelectResult.R_CS_NotSure: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.R_CS_NotSure, sql, params });
3409
+ case SelectResult.R_C_NotSure: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.R_C_NotSure, sql, params });
3263
3410
  }
3264
3411
  }
3265
3412
  }
3413
+ excutePage(option) {
3414
+ option ?? (option = {});
3415
+ option.sync ?? (option.sync = SyncMode.Async);
3416
+ const { where, params } = this._where();
3417
+ const result = {
3418
+ records: [],
3419
+ size: 0,
3420
+ total: 0
3421
+ };
3422
+ let sql = `
3423
+ SELECT
3424
+ ${this._distinct ? 'DISTINCT' : ''} ${this._columns && this._columns.length > 0 ? this._columns.join(',') : this[_columns].map(key => this[_fields][String(key)]?.C3()).join(',')}
3425
+ FROM ${this._table}
3426
+ ${where ? ' WHERE ' : ''}
3427
+ ${where}
3428
+ ${this._groups.length > 0 ? `GROUP BY ${this._groups.join(',')} ` : ''}
3429
+ ${this._orders.length > 0 ? `ORDER BY ${this._orders.join(',')} ` : ''}
3430
+ `;
3431
+ if (this._startRow && this._pageSize) {
3432
+ sql += `LIMIT ${this._startRow}, ${this._pageSize}`;
3433
+ }
3434
+ else if (this._startRow) {
3435
+ sql += `LIMIT ${this._startRow}`;
3436
+ }
3437
+ const sqlCount = `
3438
+ SELECT COUNT(1)
3439
+ FROM ${this._table}
3440
+ ${where ? ' WHERE ' : ''}
3441
+ ${where}
3442
+ ${this._groups.length > 0 ? `GROUP BY ${this._groups.join(',')} ` : ''}
3443
+ ${this._orders.length > 0 ? `ORDER BY ${this._orders.join(',')} ` : ''}
3444
+ `;
3445
+ if (option.sync === SyncMode.Sync) {
3446
+ result.total = this._service.select({
3447
+ ...option,
3448
+ params,
3449
+ sql: sqlCount,
3450
+ sync: SyncMode.Sync,
3451
+ selectResult: SelectResult.R_C_Assert
3452
+ });
3453
+ result.size = calc(result.total)
3454
+ .add(this._pageSize - 1)
3455
+ .div(this._pageSize)
3456
+ .round(0, 2)
3457
+ .over();
3458
+ result.records = this._service.select({
3459
+ ...option,
3460
+ params,
3461
+ sql,
3462
+ sync: SyncMode.Sync,
3463
+ selectResult: SelectResult.RS_CS
3464
+ });
3465
+ return result;
3466
+ }
3467
+ else {
3468
+ return new Promise(async (resolve, reject) => {
3469
+ try {
3470
+ result.total = await this._service.select({
3471
+ ...option,
3472
+ params,
3473
+ sql: sqlCount,
3474
+ sync: SyncMode.Async,
3475
+ selectResult: SelectResult.R_C_Assert
3476
+ });
3477
+ result.size = calc(result.total)
3478
+ .add(this._pageSize - 1)
3479
+ .div(this._pageSize)
3480
+ .round(0, 2)
3481
+ .over();
3482
+ result.records = await this._service.select({
3483
+ ...option,
3484
+ params,
3485
+ sql,
3486
+ sync: SyncMode.Async,
3487
+ selectResult: SelectResult.RS_CS
3488
+ });
3489
+ resolve(result);
3490
+ }
3491
+ catch (error) {
3492
+ reject(error);
3493
+ }
3494
+ });
3495
+ }
3496
+ }
3266
3497
  excuteUpdate(option) {
3267
3498
  option ?? (option = {});
3268
3499
  option.sync ?? (option.sync = SyncMode.Async);
@@ -3326,16 +3557,25 @@ class StreamQuery {
3326
3557
  }
3327
3558
  return { where: wheres.join(' '), params: this._param };
3328
3559
  }
3329
- _(key, value, op, { not = '', name = '' } = {}) {
3330
- if (name !== undefined && this._paramKeys.hasOwnProperty(name)) {
3331
- this._param[this._paramKeys[name]] = value;
3560
+ _(key, value, op, { not = '', paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) {
3561
+ if (value === null
3562
+ || value === undefined
3563
+ || (emptyString(`${value ?? ''}`) && skipEmptyString === true)) {
3564
+ if (breakExcuteIfSkip === true) {
3565
+ this.if_exec = false;
3566
+ }
3567
+ return this;
3568
+ }
3569
+ if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
3570
+ this._param[this._paramKeys[paramName]] = value;
3332
3571
  }
3333
3572
  else {
3573
+ paramName;
3334
3574
  const pkey = `p${this._prefix}${this._index++}`;
3335
3575
  this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} ${not} ${op} :${pkey} `);
3336
3576
  this._param[pkey] = value;
3337
- if (name) {
3338
- this._paramKeys[name] = pkey;
3577
+ if (paramName) {
3578
+ this._paramKeys[paramName] = pkey;
3339
3579
  }
3340
3580
  }
3341
3581
  return this;
@@ -3348,112 +3588,158 @@ class StreamQuery {
3348
3588
  this._wheres.push(`AND ${this[_fields][String(key1)]?.C2()} ${not} ${op} ${this[_fields][String(key2)]?.C2()} `);
3349
3589
  return this;
3350
3590
  }
3351
- _between(key, value1, value2, { not = '', name = '' } = {}) {
3352
- if (name && this._paramKeys[name]) {
3353
- this._param[this._paramKeys[name][0]] = value1;
3354
- this._param[this._paramKeys[name][1]] = value2;
3591
+ _between(key, value1, value2, { not = '', paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) {
3592
+ if (value1 === null
3593
+ || value1 === undefined
3594
+ || (emptyString(`${value1 ?? ''}`) && skipEmptyString === true)
3595
+ || value2 === null
3596
+ || value2 === undefined
3597
+ || (emptyString(`${value2 ?? ''}`) && skipEmptyString === true)) {
3598
+ if (breakExcuteIfSkip === true) {
3599
+ this.if_exec = false;
3600
+ }
3601
+ return this;
3602
+ }
3603
+ if (paramName && this._paramKeys[paramName]) {
3604
+ this._param[this._paramKeys[paramName][0]] = value1;
3605
+ this._param[this._paramKeys[paramName][1]] = value2;
3355
3606
  }
3356
3607
  else {
3357
3608
  const [pkey1, pkey2] = [`p${this._prefix}${this._index++}`, `p${this._prefix}${this._index++}`];
3358
3609
  this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} ${not} BETWEEN :${pkey1} AND :${pkey2}`);
3359
3610
  this._param[pkey1] = value1;
3360
3611
  this._param[pkey2] = value2;
3361
- if (name) {
3362
- this._paramKeys[name] = [pkey1, pkey2];
3612
+ if (paramName) {
3613
+ this._paramKeys[paramName] = [pkey1, pkey2];
3363
3614
  }
3364
3615
  }
3365
3616
  return this;
3366
3617
  }
3367
- _in(key, value, { not = '', name = '', force = false } = {}) {
3618
+ _in(key, value, { not = '', paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) {
3368
3619
  if (value && value.length > 0) {
3369
- if (name !== undefined && this._paramKeys.hasOwnProperty(name)) {
3370
- this._param[this._paramKeys[name]] = value;
3620
+ if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
3621
+ this._param[this._paramKeys[paramName]] = value;
3371
3622
  }
3372
3623
  else {
3373
3624
  const pkey = `p${this._prefix}${this._index++}`;
3374
3625
  this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} ${not} IN (:${pkey}) `);
3375
3626
  this._param[pkey] = value;
3376
- if (name) {
3377
- this._paramKeys[name] = pkey;
3627
+ if (paramName) {
3628
+ this._paramKeys[paramName] = pkey;
3378
3629
  }
3379
3630
  }
3380
3631
  }
3381
- else if (force !== true) {
3632
+ else if (breakExcuteIfSkip !== true) {
3382
3633
  this.if_exec = false;
3383
3634
  }
3384
3635
  return this;
3385
3636
  }
3386
- _shift(key1, key2, value, op, { not = '', name = '' } = {}) {
3387
- if (name !== undefined && this._paramKeys.hasOwnProperty(name)) {
3388
- this._param[this._paramKeys[name]] = value;
3637
+ _shift(key1, key2, value, op, { not = '', paramName = '', breakExcuteIfSkip = false } = {}) {
3638
+ if (value === null
3639
+ || value === undefined
3640
+ || emptyString(`${value ?? ''}`)) {
3641
+ if (breakExcuteIfSkip === true) {
3642
+ this.if_exec = false;
3643
+ }
3644
+ return this;
3645
+ }
3646
+ if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
3647
+ this._param[this._paramKeys[paramName]] = value;
3389
3648
  }
3390
3649
  else {
3391
3650
  const pkey = `p${this._prefix}${this._index++}`;
3392
3651
  this._wheres.push(`AND (${this[_fields][String(key1)]?.C2()} << 8) + ${this[_fields][String(key2)]?.C2()} ${not} ${op} :${pkey} `);
3393
3652
  this._param[pkey] = value;
3394
- if (name) {
3395
- this._paramKeys[name] = pkey;
3653
+ if (paramName) {
3654
+ this._paramKeys[paramName] = pkey;
3396
3655
  }
3397
3656
  }
3398
3657
  return this;
3399
3658
  }
3400
- _match(value, keys, { name, not, append } = {}) {
3401
- if (name !== undefined && this._paramKeys.hasOwnProperty(name)) {
3402
- this._param[this._paramKeys[name]] = value;
3659
+ _match(value, keys, { paramName = '', not = '', append = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) {
3660
+ if (value === null
3661
+ || value === undefined
3662
+ || emptyString(`${value ?? ''}`)) {
3663
+ if (breakExcuteIfSkip === true) {
3664
+ this.if_exec = false;
3665
+ }
3666
+ return this;
3667
+ }
3668
+ if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
3669
+ this._param[this._paramKeys[paramName]] = value;
3403
3670
  }
3404
3671
  else {
3405
3672
  const pkey = `p${this._prefix}${this._index++}`;
3406
- this._wheres.push(`AND MATCH(${keys.map(key => this[_fields][String(key)]?.C2()).join(',')}) AGAINST (:${pkey} ${append ?? ''})`);
3673
+ this._wheres.push(`AND ${not} MATCH(${keys.map(key => this[_fields][String(key)]?.C2()).join(',')}) AGAINST (:${pkey} ${append ?? ''})`);
3407
3674
  this._param[pkey] = value;
3408
- if (name) {
3409
- this._paramKeys[name] = pkey;
3675
+ if (paramName) {
3676
+ this._paramKeys[paramName] = pkey;
3410
3677
  }
3411
3678
  }
3412
3679
  return this;
3413
3680
  }
3414
- _pow(key, value, { name } = {}) {
3415
- if (name !== undefined && this._paramKeys.hasOwnProperty(name)) {
3416
- this._param[this._paramKeys[name]] = value;
3681
+ _pow(key, value, { not = '', paramName = '', breakExcuteIfSkip = false } = {}) {
3682
+ if (value === null
3683
+ || value === undefined
3684
+ || emptyString(`${value ?? ''}`)) {
3685
+ if (breakExcuteIfSkip === true) {
3686
+ this.if_exec = false;
3687
+ }
3688
+ return this;
3689
+ }
3690
+ if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
3691
+ this._param[this._paramKeys[paramName]] = value;
3417
3692
  }
3418
3693
  else {
3419
3694
  const pkey = `p${this._prefix}${this._index++}`;
3420
- this._wheres.push(`AND NOT POW(2, ${this[_fields][String(key)]?.C2()}) & :${pkey}`);
3695
+ this._wheres.push(`AND ${not} POW(2, ${this[_fields][String(key)]?.C2()}) & :${pkey}`);
3421
3696
  this._param[pkey] = value;
3422
- if (name) {
3423
- this._paramKeys[name] = pkey;
3697
+ if (paramName) {
3698
+ this._paramKeys[paramName] = pkey;
3424
3699
  }
3425
3700
  }
3426
3701
  return this;
3427
3702
  }
3428
- _like(key, value, { not = '', left = '', right = '', name = '', op = 'LIKE', force = false } = {}) {
3429
- if (value !== null && value !== undefined && value !== '') {
3430
- if (name !== undefined && this._paramKeys.hasOwnProperty(name)) {
3431
- this._param[this._paramKeys[name]] = value;
3432
- }
3433
- else {
3434
- const pkey = `p${this._prefix}${this._index++}`;
3435
- this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} ${not} ${op} CONCAT('${left}', :${pkey}, '${right}') `);
3436
- this._param[pkey] = value;
3437
- if (name) {
3438
- this._paramKeys[name] = pkey;
3439
- }
3703
+ _like(key, value, { not = '', left = '', right = '', paramName = '', op = 'LIKE', skipEmptyString = true, breakExcuteIfSkip = false } = {}) {
3704
+ if (value === null
3705
+ || value === undefined
3706
+ || (emptyString(`${value ?? ''}`) && skipEmptyString === true)) {
3707
+ if (breakExcuteIfSkip === true) {
3708
+ this.if_exec = false;
3440
3709
  }
3710
+ return this;
3441
3711
  }
3442
- else if (force !== true) {
3443
- this.if_exec = false;
3712
+ if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
3713
+ this._param[this._paramKeys[paramName]] = value;
3714
+ }
3715
+ else {
3716
+ const pkey = `p${this._prefix}${this._index++}`;
3717
+ this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} ${not} ${op} CONCAT('${left}', :${pkey}, '${right}') `);
3718
+ this._param[pkey] = value;
3719
+ if (paramName) {
3720
+ this._paramKeys[paramName] = pkey;
3721
+ }
3444
3722
  }
3445
3723
  return this;
3446
3724
  }
3447
- _includes(key, value, { not = '', name = '' } = {}) {
3448
- if (name !== undefined && this._paramKeys.hasOwnProperty(name)) {
3449
- this._param[this._paramKeys[name]] = value;
3725
+ _includes(key, value, { not = '', paramName = '', skipEmptyString = true, breakExcuteIfSkip = true } = {}) {
3726
+ if (value === null
3727
+ || value === undefined
3728
+ || (emptyString(`${value ?? ''}`) && skipEmptyString === true)) {
3729
+ if (breakExcuteIfSkip === true) {
3730
+ this.if_exec = false;
3731
+ }
3732
+ return this;
3733
+ }
3734
+ if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
3735
+ this._param[this._paramKeys[paramName]] = value;
3450
3736
  }
3451
3737
  else {
3452
3738
  const pkey = `p${this._prefix}${this._index++}`;
3453
- this._wheres.push(`AND LOCATE(${this[_fields][String(key)]?.C2()}, :${pkey}) ${not ? '=' : ''} 0`);
3739
+ this._wheres.push(`AND LOCATE(${this[_fields][String(key)]?.C2()}, :${pkey}) ${not ? '=' : '>'} 0`);
3454
3740
  this._param[pkey] = value;
3455
- if (name) {
3456
- this._paramKeys[name] = pkey;
3741
+ if (paramName) {
3742
+ this._paramKeys[paramName] = pkey;
3457
3743
  }
3458
3744
  }
3459
3745
  return this;
@@ -3927,6 +4213,12 @@ __decorate([
3927
4213
  __metadata("design:paramtypes", [Object]),
3928
4214
  __metadata("design:returntype", Object)
3929
4215
  ], StreamQuery.prototype, "excuteSelect", null);
4216
+ __decorate([
4217
+ IF_EXEC(null),
4218
+ __metadata("design:type", Function),
4219
+ __metadata("design:paramtypes", [Object]),
4220
+ __metadata("design:returntype", Object)
4221
+ ], StreamQuery.prototype, "excutePage", null);
3930
4222
  __decorate([
3931
4223
  IF_EXEC(0),
3932
4224
  __metadata("design:type", Function),