badmfck-api-server 2.3.7 → 2.3.9
Sign up to get free protection for your applications and to get access to all the features.
@@ -156,12 +156,11 @@ class MysqlService extends BaseService_1.BaseService {
|
|
156
156
|
console.log("Begin transaction with id ", tid);
|
157
157
|
try {
|
158
158
|
await conn.query("START TRANSACTION");
|
159
|
-
const res = await conn.query("SET autocommit=0");
|
160
159
|
if (this.debug)
|
161
|
-
console.log("Transaction started
|
160
|
+
console.log("Transaction started");
|
162
161
|
}
|
163
162
|
catch (e) {
|
164
|
-
this.rollbackTransaction({ id: tid, conn: conn, timestamp: Date.now(), queries: [{ sql: "
|
163
|
+
this.rollbackTransaction({ id: tid, conn: conn, timestamp: Date.now(), queries: [{ sql: "START TRANSACTION", status: "error" }] });
|
165
164
|
return this.createMysqlQueryError(e);
|
166
165
|
}
|
167
166
|
this.transactions.push({
|
@@ -256,7 +255,7 @@ class MysqlService extends BaseService_1.BaseService {
|
|
256
255
|
};
|
257
256
|
let income = [];
|
258
257
|
try {
|
259
|
-
await conn.query("START TRANSACTION
|
258
|
+
await conn.query("START TRANSACTION");
|
260
259
|
}
|
261
260
|
catch (e) {
|
262
261
|
const err = this.createMysqlQueryError(e);
|
@@ -288,7 +287,7 @@ class MysqlService extends BaseService_1.BaseService {
|
|
288
287
|
}
|
289
288
|
async commit(trx) {
|
290
289
|
try {
|
291
|
-
await trx.conn.
|
290
|
+
await trx.conn.commit();
|
292
291
|
trx.conn.removeAllListeners();
|
293
292
|
trx.conn.release();
|
294
293
|
}
|
@@ -302,7 +301,8 @@ class MysqlService extends BaseService_1.BaseService {
|
|
302
301
|
let err = null;
|
303
302
|
try {
|
304
303
|
console.log("Rollback started", trx.conn);
|
305
|
-
await trx.conn.
|
304
|
+
await trx.conn.rollback();
|
305
|
+
await trx.conn.commit();
|
306
306
|
trx.conn.removeAllListeners();
|
307
307
|
trx.conn.release();
|
308
308
|
if (!donNotRemove)
|
@@ -457,8 +457,18 @@ class MysqlService extends BaseService_1.BaseService {
|
|
457
457
|
return obj;
|
458
458
|
const fields = [];
|
459
459
|
for (let i in obj) {
|
460
|
-
if (typeof obj[i] === "object") {
|
461
|
-
|
460
|
+
if (obj[i] && typeof obj[i] === "object") {
|
461
|
+
let mo = obj[i];
|
462
|
+
if (!mo) {
|
463
|
+
mo = {
|
464
|
+
name: i,
|
465
|
+
value: null,
|
466
|
+
system: false,
|
467
|
+
ignoreInInsert: false,
|
468
|
+
ignoreInUpdate: false,
|
469
|
+
useInReplace: false
|
470
|
+
};
|
471
|
+
}
|
462
472
|
fields.push({
|
463
473
|
name: i,
|
464
474
|
value: mo.value,
|