tspace-mysql 1.2.8 → 1.3.0

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.
@@ -2330,7 +2330,7 @@ class Model extends AbstractModel_1.AbstractModel {
2330
2330
  }
2331
2331
  case true: {
2332
2332
  const result = yield this.actionStatement({
2333
- sql: new Model().copyModel(this, { update: true }).toString()
2333
+ sql: new Model().copyModel(this, { update: true, where: true }).toString()
2334
2334
  });
2335
2335
  if (this.$state.get('VOID'))
2336
2336
  return null;
@@ -2357,12 +2357,10 @@ class Model extends AbstractModel_1.AbstractModel {
2357
2357
  return __awaiter(this, void 0, void 0, function* () {
2358
2358
  this._assertError(!this.$state.get('WHERE') && !ignoreWhere, "can't update [update] without where condition");
2359
2359
  const sql = this._buildQueryModel();
2360
+ const [result] = yield this.actionStatement({ sql, returnId: true });
2360
2361
  if (this.$state.get('VOID'))
2361
2362
  return null;
2362
- if (!this.$state.get('VOID')) {
2363
- const [result] = yield this.actionStatement({ sql, returnId: true });
2364
- if (!result)
2365
- return null;
2363
+ if (result) {
2366
2364
  let data = yield this.queryStatement([
2367
2365
  `${this.$state.get('SELECT')}`,
2368
2366
  `${this.$state.get('FROM')}`,
@@ -2378,9 +2376,7 @@ class Model extends AbstractModel_1.AbstractModel {
2378
2376
  this.$state.set('RESULT', data);
2379
2377
  return data;
2380
2378
  }
2381
- const [result] = yield this.actionStatement({ sql, returnId: true });
2382
- if (!result)
2383
- return null;
2379
+ return null;
2384
2380
  });
2385
2381
  }
2386
2382
  _assertError(condition = true, message = 'error') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tspace-mysql",
3
- "version": "1.2.8",
3
+ "version": "1.3.0",
4
4
  "description": "mysql query builder object relational mapping",
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.ts",