pg-mvc-service 2.0.20 → 2.0.22

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.
@@ -374,46 +374,12 @@ class WhereExpression {
374
374
  * @returns SQL statement
375
375
  */
376
376
  static makeSqlReplaceHalfToFull(columnNameOrValue) {
377
- const num = {
378
- '': '0', '1': '1', '2': '2', '3': '3', '4': '4',
379
- '': '5', '6': '6', '7': '7', '8': '8', '9': '9'
377
+ let objs = {
378
+ '0123456789': '0123456789',
379
+ 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンヴガギグゲゴザジズゼゾダヂヅデドバビブベボパピプペポァィゥェォャュョッー、。・「」゛゜': 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンヴガギグゲゴザジズゼゾダヂヅデドハハビブベボパピプペポァィゥェォャュョッー、。・「」 ',
380
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
381
+ 'abcdefghijklmnopqrstuvwxyz': 'abcdefghijklmnopqrstuvwxyz'
380
382
  };
381
- const kana = {
382
- 'ア': 'ア', 'イ': 'イ', 'ウ': 'ウ', 'エ': 'エ', 'オ': 'オ',
383
- 'カ': 'カ', 'キ': 'キ', 'ク': 'ク', 'ケ': 'ケ', 'コ': 'コ',
384
- 'サ': 'サ', 'シ': 'シ', 'ス': 'ス', 'セ': 'セ', 'ソ': 'ソ',
385
- 'タ': 'タ', 'チ': 'チ', 'ツ': 'ツ', 'テ': 'テ', 'ト': 'ト',
386
- 'ナ': 'ナ', 'ニ': 'ニ', 'ヌ': 'ヌ', 'ネ': 'ネ', 'ノ': 'ノ',
387
- 'ハ': 'ハ', 'ヒ': 'ヒ', 'フ': 'フ', 'ヘ': 'ヘ', 'ホ': 'ホ',
388
- 'マ': 'マ', 'ミ': 'ミ', 'ム': 'ム', 'メ': 'メ', 'モ': 'モ',
389
- 'ヤ': 'ヤ', 'ユ': 'ユ', 'ヨ': 'ヨ',
390
- 'ラ': 'ラ', 'リ': 'リ', 'ル': 'ル', 'レ': 'レ', 'ロ': 'ロ',
391
- 'ワ': 'ワ', 'ヲ': 'ヲ', 'ン': 'ン',
392
- 'ヴ': 'ヴ',
393
- 'ガ': 'ガ', 'ギ': 'ギ', 'グ': 'グ', 'ゲ': 'ゲ', 'ゴ': 'ゴ',
394
- 'ザ': 'ザ', 'ジ': 'ジ', 'ズ': 'ズ', 'ゼ': 'ゼ', 'ゾ': 'ゾ',
395
- 'ダ': 'ダ', 'ヂ': 'ヂ', 'ヅ': 'ヅ', 'デ': 'デ', 'ド': 'ド',
396
- 'バ': 'ハ', 'ビ': 'ビ', 'ブ': 'ブ', 'ベ': 'ベ', 'ボ': 'ボ',
397
- 'パ': 'パ', 'ピ': 'ピ', 'プ': 'プ', 'ペ': 'ペ', 'ポ': 'ポ',
398
- 'ァ': 'ァ', 'ィ': 'ィ', 'ゥ': 'ゥ', 'ェ': 'ェ', 'ォ': 'ォ',
399
- 'ャ': 'ャ', 'ュ': 'ュ', 'ョ': 'ョ',
400
- 'ッ': 'ッ',
401
- 'ー': 'ー', '、': '、', '。': '。', '・': '・', '「': '「', '」': '」', '゛': ' ゙', '゜': ' ゚'
402
- };
403
- const alpha = {
404
- 'A': 'A', 'B': 'B', 'C': 'C', 'D': 'D', 'E': 'E', 'F': 'F', 'G': 'G',
405
- 'H': 'H', 'I': 'I', 'J': 'J', 'K': 'K', 'L': 'L', 'M': 'M', 'N': 'N',
406
- 'O': 'O', 'P': 'P', 'Q': 'Q', 'R': 'R', 'S': 'S', 'T': 'T', 'U': 'U',
407
- 'V': 'V', 'W': 'W', 'X': 'X', 'Y': 'Y', 'Z': 'Z',
408
- 'a': 'a', 'b': 'b', 'c': 'c', 'd': 'd', 'e': 'e', 'f': 'f', 'g': 'g',
409
- 'h': 'h', 'i': 'i', 'j': 'j', 'k': 'k', 'l': 'l', 'm': 'm', 'n': 'n',
410
- 'o': 'o', 'p': 'p', 'q': 'q', 'r': 'r', 's': 's', 't': 't', 'u': 'u',
411
- 'v': 'v', 'w': 'w', 'x': 'x', 'y': 'y', 'z': 'z',
412
- };
413
- let objs = {};
414
- Object.assign(objs, num);
415
- Object.assign(objs, kana);
416
- Object.assign(objs, alpha);
417
383
  let sql = columnNameOrValue;
418
384
  Object.keys(objs).forEach(key => sql = `TRANSLATE(${sql} ,'${key}','${objs[key]}')`);
419
385
  return sql;
@@ -315,12 +315,14 @@ class TableModel {
315
315
  }
316
316
  this.Limit = pageCount;
317
317
  this.Offset = (currentPage - 1) * pageCount;
318
+ const tempWhereExpression = [...this.whereExpressions];
319
+ const tempJoinConditions = [...this.joinConditions];
318
320
  let sql = ` SELECT ${this.selectExpressions.join(",")} ${this.createSqlFromJoinWhereSortLimit}`;
319
- let tempVars = [...this.vars]; // 後のthis.createSqlFromJoinWhereでvarの追加をしてしまうので、上の時点でvarを決定する
320
- this.vars = []; // ここで初期化しないと、次のクエリで途中の連番になる
321
+ const data = yield this.executeQuery(sql, this.vars);
322
+ this.whereExpressions = tempWhereExpression;
323
+ this.joinConditions = tempJoinConditions;
321
324
  let countSql = ` SELECT COUNT(*) as "count" ${this.createSqlFromJoinWhere}`;
322
- const data = yield this.executeQuery(sql, tempVars);
323
- const countData = yield this.executeQuery(countSql, tempVars);
325
+ const countData = yield this.executeQuery(countSql, this.vars);
324
326
  const totalCount = Number(countData.rows[0].count);
325
327
  const lastPage = Math.ceil(Number(countData.rows[0].count) / pageCount);
326
328
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-mvc-service",
3
- "version": "2.0.20",
3
+ "version": "2.0.22",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/n-daira/npm-pack_mvc-service#readme",
6
6
  "bugs": {
@@ -406,50 +406,13 @@ export default class WhereExpression {
406
406
  * @returns SQL statement
407
407
  */
408
408
  private static makeSqlReplaceHalfToFull(columnNameOrValue: string) {
409
- const num = {
410
- '' : '0', '1' : '1', '2' : '2', '3' : '3', '4' : '4',
411
- '' : '5', '6' : '6', '7' : '7', '8' : '8', '9' : '9'
409
+ let objs: { [key: string]: string } = {
410
+ '0123456789': '0123456789',
411
+ 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンヴガギグゲゴザジズゼゾダヂヅデドバビブベボパピプペポァィゥェォャュョッー、。・「」゛゜': 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンヴガギグゲゴザジズゼゾダヂヅデドハハビブベボパピプペポァィゥェォャュョッー、。・「」 ',
412
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
413
+ 'abcdefghijklmnopqrstuvwxyz': 'abcdefghijklmnopqrstuvwxyz'
412
414
  };
413
415
 
414
- const kana = {
415
- 'ア' : 'ア', 'イ' : 'イ', 'ウ' : 'ウ', 'エ' : 'エ', 'オ' : 'オ',
416
- 'カ' : 'カ', 'キ' : 'キ', 'ク' : 'ク', 'ケ' : 'ケ', 'コ' : 'コ',
417
- 'サ' : 'サ', 'シ' : 'シ', 'ス' : 'ス', 'セ' : 'セ', 'ソ' : 'ソ',
418
- 'タ' : 'タ', 'チ' : 'チ', 'ツ' : 'ツ', 'テ' : 'テ', 'ト' : 'ト',
419
- 'ナ' : 'ナ', 'ニ' : 'ニ', 'ヌ' : 'ヌ', 'ネ' : 'ネ', 'ノ' : 'ノ',
420
- 'ハ' : 'ハ', 'ヒ' : 'ヒ', 'フ' : 'フ', 'ヘ' : 'ヘ', 'ホ' : 'ホ',
421
- 'マ' : 'マ', 'ミ' : 'ミ', 'ム' : 'ム', 'メ' : 'メ', 'モ' : 'モ',
422
- 'ヤ' : 'ヤ', 'ユ' : 'ユ', 'ヨ' : 'ヨ',
423
- 'ラ' : 'ラ', 'リ' : 'リ', 'ル' : 'ル', 'レ' : 'レ', 'ロ' : 'ロ',
424
- 'ワ' : 'ワ', 'ヲ' : 'ヲ', 'ン' : 'ン',
425
- 'ヴ' : 'ヴ',
426
- 'ガ' : 'ガ', 'ギ' : 'ギ', 'グ' : 'グ', 'ゲ' : 'ゲ', 'ゴ' : 'ゴ',
427
- 'ザ' : 'ザ', 'ジ' : 'ジ', 'ズ' : 'ズ', 'ゼ' : 'ゼ', 'ゾ' : 'ゾ',
428
- 'ダ' : 'ダ', 'ヂ' : 'ヂ', 'ヅ' : 'ヅ', 'デ' : 'デ', 'ド' : 'ド',
429
- 'バ' : 'ハ', 'ビ' : 'ビ', 'ブ' : 'ブ', 'ベ' : 'ベ', 'ボ' : 'ボ',
430
- 'パ' : 'パ', 'ピ' : 'ピ', 'プ' : 'プ', 'ペ' : 'ペ', 'ポ' : 'ポ',
431
- 'ァ' : 'ァ', 'ィ' : 'ィ', 'ゥ' : 'ゥ', 'ェ' : 'ェ', 'ォ' : 'ォ',
432
- 'ャ' : 'ャ', 'ュ' : 'ュ', 'ョ' : 'ョ',
433
- 'ッ' : 'ッ',
434
- 'ー' : 'ー', '、' : '、', '。' : '。', '・' : '・', '「' : '「', '」' : '」', '゛' : ' ゙', '゜' : ' ゚'
435
- };
436
-
437
- const alpha = {
438
- 'A' : 'A', 'B' : 'B', 'C' : 'C', 'D' : 'D', 'E' : 'E', 'F' : 'F', 'G' : 'G',
439
- 'H' : 'H', 'I' : 'I', 'J' : 'J', 'K' : 'K', 'L' : 'L', 'M' : 'M', 'N' : 'N',
440
- 'O' : 'O', 'P' : 'P', 'Q' : 'Q', 'R' : 'R', 'S' : 'S', 'T' : 'T', 'U' : 'U',
441
- 'V' : 'V', 'W' : 'W', 'X' : 'X', 'Y' : 'Y', 'Z' : 'Z',
442
- 'a' : 'a', 'b' : 'b', 'c' : 'c', 'd' : 'd', 'e' : 'e', 'f' : 'f', 'g' : 'g',
443
- 'h' : 'h', 'i' : 'i', 'j' : 'j', 'k' : 'k', 'l' : 'l', 'm' : 'm', 'n' : 'n',
444
- 'o' : 'o', 'p' : 'p', 'q' : 'q', 'r' : 'r', 's' : 's', 't' : 't', 'u' : 'u',
445
- 'v' : 'v', 'w' : 'w', 'x' : 'x', 'y' : 'y', 'z' : 'z',
446
- };
447
-
448
- let objs: { [key: string]: string } = {};
449
- Object.assign(objs, num);
450
- Object.assign(objs, kana);
451
- Object.assign(objs, alpha);
452
-
453
416
  let sql = columnNameOrValue;
454
417
  Object.keys(objs).forEach(key => sql = `TRANSLATE(${sql} ,'${key}','${objs[key]}')`);
455
418
 
@@ -370,15 +370,19 @@ export class TableModel {
370
370
  this.Limit = pageCount;
371
371
  this.Offset = (currentPage - 1) * pageCount;
372
372
 
373
+
374
+ const tempWhereExpression = [...this.whereExpressions];
375
+ const tempJoinConditions = [...this.joinConditions];
376
+
373
377
  let sql = ` SELECT ${this.selectExpressions.join(",")} ${this.createSqlFromJoinWhereSortLimit}`;
374
- let tempVars = [...this.vars]; // 後のthis.createSqlFromJoinWhereでvarの追加をしてしまうので、上の時点でvarを決定する
375
- this.vars = []; // ここで初期化しないと、次のクエリで途中の連番になる
378
+ const data = await this.executeQuery(sql, this.vars);
376
379
 
380
+
381
+ this.whereExpressions = tempWhereExpression;
382
+ this.joinConditions = tempJoinConditions;
377
383
  let countSql = ` SELECT COUNT(*) as "count" ${this.createSqlFromJoinWhere}`;
378
-
379
- const data = await this.executeQuery(sql, tempVars);
380
384
 
381
- const countData = await this.executeQuery(countSql, tempVars);
385
+ const countData = await this.executeQuery(countSql, this.vars);
382
386
 
383
387
  const totalCount = Number(countData.rows[0].count);
384
388
  const lastPage = Math.ceil(Number(countData.rows[0].count) / pageCount);