pqb 0.41.3 → 0.41.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.
- package/dist/index.js +9 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3404,20 +3404,18 @@ class Transaction {
|
|
|
3404
3404
|
sql.text = `BEGIN${options.level ? ` ISOLATION LEVEL ${options.level}` : ""}${options.readOnly !== void 0 ? ` READ ${options.readOnly ? "ONLY" : "WRITE"}` : ""}${options.deferrable !== void 0 ? ` ${options.deferrable ? "" : "NOT "}DEFERRABLE` : ""}`;
|
|
3405
3405
|
if (log)
|
|
3406
3406
|
logData = log.beforeQuery(sql);
|
|
3407
|
-
|
|
3408
|
-
const result = await this.q.adapter.transaction(sql, callback);
|
|
3409
|
-
if (log)
|
|
3410
|
-
log.afterQuery(commitSql$1, logData);
|
|
3411
|
-
await runAfterCommit(
|
|
3412
|
-
trx.afterCommit,
|
|
3413
|
-
result
|
|
3414
|
-
);
|
|
3415
|
-
return result;
|
|
3416
|
-
} catch (err) {
|
|
3407
|
+
const result = await this.q.adapter.transaction(sql, callback).catch((err) => {
|
|
3417
3408
|
if (log)
|
|
3418
3409
|
log.afterQuery(rollbackSql$1, logData);
|
|
3419
3410
|
throw err;
|
|
3420
|
-
}
|
|
3411
|
+
});
|
|
3412
|
+
if (log)
|
|
3413
|
+
log.afterQuery(commitSql$1, logData);
|
|
3414
|
+
await runAfterCommit(
|
|
3415
|
+
trx.afterCommit,
|
|
3416
|
+
result
|
|
3417
|
+
);
|
|
3418
|
+
return result;
|
|
3421
3419
|
} else {
|
|
3422
3420
|
try {
|
|
3423
3421
|
sql.text = `SAVEPOINT "${transactionId}"`;
|