mm_mysql 2.4.3 → 2.4.4

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 (3) hide show
  1. package/index.js +2 -3
  2. package/package.json +1 -1
  3. package/sql.js +2 -2
package/index.js CHANGED
@@ -124,8 +124,6 @@ Mysql.prototype.open = async function () {
124
124
  // 测试连接池连接
125
125
  let conn = await this._pool.getConnection();
126
126
  conn.release();
127
-
128
- this.log('info', '数据库连接池创建成功');
129
127
  return true;
130
128
  } catch (error) {
131
129
  this.log('error', '数据库连接池创建失败', error);
@@ -195,6 +193,7 @@ Mysql.prototype.run = async function (sql, params = []) {
195
193
  let [rows] = await conn.query(sql, params);
196
194
  ret = rows;
197
195
  } catch (err) {
196
+ console.error('SQL执行失败', err);
198
197
  this.sql = err.sql;
199
198
  this.error = {
200
199
  code: err.errno,
@@ -233,7 +232,7 @@ Mysql.prototype.exec = async function (sql, params = []) {
233
232
  let [result] = await conn.execute(sql, params);
234
233
  ret = result.insertId || result.affectedRows || result.changedRows || 1;
235
234
  } catch (error) {
236
- this.log('error', 'SQL执行失败', error);
235
+ console.error('SQL执行失败', error);
237
236
  this.sql = error.sql;
238
237
  this.error = {
239
238
  code: error.errno,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_mysql",
3
- "version": "2.4.3",
3
+ "version": "2.4.4",
4
4
  "description": "这是超级美眉mysql帮助函数模块,用于便捷操作mysql,使用await方式,可以避免嵌套函数",
5
5
  "main": "index.js",
6
6
  "dependencies": {
package/sql.js CHANGED
@@ -434,7 +434,7 @@ Sql.prototype.toWhere = function (obj, like) {
434
434
  } else {
435
435
  where = this._buildExactWhere(obj);
436
436
  }
437
- return where.replace(' and ', '');
437
+ return where.replace(/^ and /, '');
438
438
  };
439
439
 
440
440
  Sql.prototype._buildLikeWhere = function (obj) {
@@ -517,7 +517,7 @@ Sql.prototype.toSet = function (obj) {
517
517
  }
518
518
  }
519
519
 
520
- return set.replace(',', '');
520
+ return set.replace(/^,/, '');
521
521
  };
522
522
 
523
523
  /**