mm_mysql 1.7.0 → 1.7.2

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/config.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "host": "localhost",
3
3
  "port": 3306,
4
4
  "user": "root",
5
- "password": "asd159357",
5
+ "password": "Asd159357",
6
6
  "database": "mm",
7
7
  "multipleStatements": true
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_mysql",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "这是超级美眉mysql帮助函数模块,用于便捷操作mysql,使用await方式,可以避免嵌套函数",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "homepage": "https://github.com/qiuwenwu/mm_mysql#readme",
33
33
  "dependencies": {
34
- "mm_logs": "^1.0.7",
35
- "mysql": "^2.17.1"
34
+ "mm_logs": "^1.1.2",
35
+ "mysql": "^2.18.1"
36
36
  }
37
37
  }
package/sql.js CHANGED
@@ -856,13 +856,13 @@ Sql.prototype.model = function(model) {
856
856
  var n = obj[prop];
857
857
  var cha = value - n;
858
858
  if (cha > 0) {
859
- _this.setSql("`" + _this.key + "`=" + obj[_this.key] + "", "`" + prop + "`=`" +
859
+ _this.setSql("`" + _this.key + "`=" + obj[_this.key], "`" + prop + "`=`" +
860
860
  prop + "` + " + cha);
861
861
  } else if (cha < 0) {
862
- _this.setSql("`" + _this.key + "`=" + obj[_this.key] + "", "`" + prop + "`=`" +
862
+ _this.setSql("`" + _this.key + "`=" + obj[_this.key], "`" + prop + "`=`" +
863
863
  prop + "` - " + (-cha));
864
864
  } else {
865
- _this.setSql("`" + _this.key + "`=" + obj[_this.key] + "", "`" + prop + "`=" +
865
+ _this.setSql("`" + _this.key + "`=" + obj[_this.key], "`" + prop + "`=" +
866
866
  value);
867
867
  }
868
868
  } else {
package/test.js CHANGED
@@ -71,6 +71,10 @@ var tpl = {
71
71
  // 测试模板查询
72
72
  async function test_tpl_get() {
73
73
  var sql = new Mysql();
74
+ sql.setConfig({
75
+ "user": "root",
76
+ "password": "Asd159357"
77
+ });
74
78
  sql.open();
75
79
  db = sql.db();
76
80
  var num = 0;
@@ -85,7 +89,7 @@ async function test_tpl_get() {
85
89
  ret = await db.getCountSql(query_str, "`user_id` desc", "*");
86
90
  console.log('查询结果', ret);
87
91
  console.log('SQL语句', db.sql);
88
-
92
+
89
93
  ret = await db.groupSumSql(query_str, "mc", "gm");
90
94
  console.log('求和查询结果', ret);
91
95
  }
@@ -175,13 +179,13 @@ test_tpl_get();
175
179
  // if (num < 0) {
176
180
  // console.log("SQL:" + db.sql);
177
181
  // }
178
-
182
+
179
183
  // num = await db.field_add("content", 'longtext', '123123', false);
180
184
  // console.log("content结果:" + num);
181
185
  // if (num < 0) {
182
186
  // console.log("SQL:" + db.sql);
183
187
  // }
184
-
188
+
185
189
  // num = await db.field_add("cycle", 'time', null, true);
186
190
  // console.log("cycle结果:" + num);
187
191
  // if (num < 0) {
@@ -632,4 +636,4 @@ test_tpl_get();
632
636
  // console.log(db.sql);
633
637
  // }
634
638
 
635
- // test_model();
639
+ // test_model();