pqb 0.15.0 → 0.15.1
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 +22 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7062,7 +7062,7 @@ const then = async (q, adapter, trx, beforeHooks, afterHooks, afterCommitHooks,
|
|
|
7062
7062
|
error.cause = localError;
|
|
7063
7063
|
}
|
|
7064
7064
|
}
|
|
7065
|
-
if (query.log && sql
|
|
7065
|
+
if (query.log && sql) {
|
|
7066
7066
|
query.log.onError(error, sql, logData);
|
|
7067
7067
|
}
|
|
7068
7068
|
return reject == null ? void 0 : reject(error);
|
|
@@ -8910,21 +8910,35 @@ class Db {
|
|
|
8910
8910
|
return performQuery(this, args, "arrays");
|
|
8911
8911
|
}
|
|
8912
8912
|
}
|
|
8913
|
-
const performQuery = (q2, args, method) => {
|
|
8913
|
+
const performQuery = async (q2, args, method) => {
|
|
8914
8914
|
const trx = q2.internal.transactionStorage.getStore();
|
|
8915
|
-
let
|
|
8915
|
+
let sql;
|
|
8916
8916
|
if (typeof args[0].raw === "string") {
|
|
8917
|
-
|
|
8917
|
+
sql = { text: args[0].raw, values: args[0].values };
|
|
8918
8918
|
} else {
|
|
8919
8919
|
const values = [];
|
|
8920
|
-
|
|
8920
|
+
sql = {
|
|
8921
8921
|
text: templateLiteralToSQL(args, values),
|
|
8922
8922
|
values
|
|
8923
8923
|
};
|
|
8924
8924
|
}
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
)
|
|
8925
|
+
const { log } = q2.q;
|
|
8926
|
+
let logData;
|
|
8927
|
+
if (log)
|
|
8928
|
+
logData = log.beforeQuery(sql);
|
|
8929
|
+
try {
|
|
8930
|
+
const result = await ((trx == null ? void 0 : trx.adapter) || q2.adapter)[method](
|
|
8931
|
+
sql
|
|
8932
|
+
);
|
|
8933
|
+
if (log)
|
|
8934
|
+
log.afterQuery(sql, logData);
|
|
8935
|
+
return result;
|
|
8936
|
+
} catch (err) {
|
|
8937
|
+
if (log) {
|
|
8938
|
+
log.onError(err, sql, logData);
|
|
8939
|
+
}
|
|
8940
|
+
throw err;
|
|
8941
|
+
}
|
|
8928
8942
|
};
|
|
8929
8943
|
orchidCore.applyMixins(Db, [QueryMethods]);
|
|
8930
8944
|
Db.prototype.constructor = Db;
|