tspace-mysql 1.2.7 → 1.2.9
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/dist/lib/tspace/Model.js +6 -10
- package/package.json +1 -1
package/dist/lib/tspace/Model.js
CHANGED
|
@@ -2123,7 +2123,7 @@ class Model extends AbstractModel_1.AbstractModel {
|
|
|
2123
2123
|
objects = Object.assign(Object.assign({}, objects), { [updatedAt]: this.$utils.timestamp() });
|
|
2124
2124
|
}
|
|
2125
2125
|
const keyValue = Object.entries(objects).map(([column, value]) => {
|
|
2126
|
-
if (typeof value === 'string')
|
|
2126
|
+
if (typeof value === 'string' && !(value.includes(this.$constants('RAW'))))
|
|
2127
2127
|
value = value === null || value === void 0 ? void 0 : value.replace(/'/g, '');
|
|
2128
2128
|
return `${column} = ${value == null || value === 'NULL'
|
|
2129
2129
|
? 'NULL'
|
|
@@ -2148,7 +2148,7 @@ class Model extends AbstractModel_1.AbstractModel {
|
|
|
2148
2148
|
}
|
|
2149
2149
|
const columns = Object.keys(objects).map((column) => `\`${column}\``);
|
|
2150
2150
|
const values = Object.values(objects).map((value) => {
|
|
2151
|
-
if (typeof value === 'string')
|
|
2151
|
+
if (typeof value === 'string' && !(value.includes(this.$constants('RAW'))))
|
|
2152
2152
|
value = value === null || value === void 0 ? void 0 : value.replace(/'/g, '');
|
|
2153
2153
|
return `${value == null || value === 'NULL'
|
|
2154
2154
|
? 'NULL'
|
|
@@ -2189,7 +2189,7 @@ class Model extends AbstractModel_1.AbstractModel {
|
|
|
2189
2189
|
];
|
|
2190
2190
|
}
|
|
2191
2191
|
const v = Object.values(objects).map((value) => {
|
|
2192
|
-
if (typeof value === 'string')
|
|
2192
|
+
if (typeof value === 'string' && !(value.includes(this.$constants('RAW'))))
|
|
2193
2193
|
value = value === null || value === void 0 ? void 0 : value.replace(/'/g, '');
|
|
2194
2194
|
return `${value == null || value === 'NULL'
|
|
2195
2195
|
? '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 (
|
|
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
|
-
|
|
2382
|
-
if (!result)
|
|
2383
|
-
return null;
|
|
2379
|
+
return null;
|
|
2384
2380
|
});
|
|
2385
2381
|
}
|
|
2386
2382
|
_assertError(condition = true, message = 'error') {
|