mm_sqlite 1.1.7 → 1.1.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/sql.js +11 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_sqlite",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "高性能SQLite数据库操作模块,提供与mm_mysql完全兼容的API接口,支持异步操作、事务处理和批量操作",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/sql.js CHANGED
@@ -466,18 +466,18 @@ Sql.prototype.toWhere = function (obj, like) {
466
466
  val = val.trim("'");
467
467
  }
468
468
  val = escape(val);
469
- if (k.endWith('_min')) {
469
+ if (k.endsWith('_min')) {
470
470
  where += " and " + escapeId(k.replace('_min', '')) + " >= " + val;
471
- } else if (k.endWith('_max')) {
471
+ } else if (k.endsWith('_max')) {
472
472
  where += " and " + escapeId(k.replace('_max', '')) + " <= " + val;
473
- } else if (k.endWith('_not')) {
473
+ } else if (k.endsWith('_not')) {
474
474
  where += " and " + escapeId(k.replace('_not', '')) + " != " + val;
475
- } else if (k.endWith('_has')) {
475
+ } else if (k.endsWith('_has')) {
476
476
  var vals = val.trim("'").split(',').map((o) => {
477
477
  return "'" + o + "'"
478
478
  });
479
479
  where += " and " + escapeId(k.replace('_has', '')) + " in (" + vals.join(',') + ")";
480
- } else if (k.endWith('_like')) {
480
+ } else if (k.endsWith('_like')) {
481
481
  where += " and " + escapeId(k.replace('_like', '')) + " LIKE '%" + val.trim("'") + "%'";
482
482
  } else if (typeof (val) === "string" && !/^[0-9]+$/.test(val)) {
483
483
  where += " and " + escapeId(k) + " LIKE '%" + val.trim("'") + "%'"
@@ -492,13 +492,13 @@ Sql.prototype.toWhere = function (obj, like) {
492
492
  val = val.trim("'");
493
493
  }
494
494
  val = escape(val);
495
- if (k.endWith('_min')) {
495
+ if (k.endsWith('_min')) {
496
496
  where += " and " + escapeId(k.replace('_min', '')) + " >= " + val;
497
- } else if (k.endWith('_max')) {
497
+ } else if (k.endsWith('_max')) {
498
498
  where += " and " + escapeId(k.replace('_max', '')) + " <= " + val;
499
- } else if (k.endWith('_not')) {
499
+ } else if (k.endsWith('_not')) {
500
500
  where += " and " + escapeId(k.replace('_not', '')) + " != " + val;
501
- } else if (k.endWith('_has')) {
501
+ } else if (k.endsWith('_has')) {
502
502
  var vals = val.trim("'").split(',').map((o) => {
503
503
  return "'" + o + "'"
504
504
  });
@@ -529,10 +529,10 @@ Sql.prototype.toSet = function (obj) {
529
529
  }
530
530
  val = escape(val);
531
531
 
532
- if (k.endWith('_add')) {
532
+ if (k.endsWith('_add')) {
533
533
  var k2 = escapeId(k.replace('_add', ''));
534
534
  set += "," + k2 + " = " + k2 + " + " + val;
535
- } else if (k.endWith('_del')) {
535
+ } else if (k.endsWith('_del')) {
536
536
  var k3 = escapeId(k.replace('_del', ''));
537
537
  set += "," + k3 + " = " + k3 + " - " + val;
538
538
  } else {