mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 06:28:54 +00:00
fix: Display correct query execution time
This commit is contained in:
1 parent
bacd9c171d
commit
3b55e890a8
3 files changed
+4
-7
No files matched your search
+1
-1
@@ -16,7 +16,7 @@
|
||||
"connection-string-parser": "^1.0.4",
|
||||
"github-version-checker": "^2.2.0",
|
||||
"mysql2": "https://github.com/overextended/node-mysql2.git",
|
||||
"postinstall-postinstall": "^2.1.0"
|
||||
"postinstall-postinstall": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"copy-webpack-plugin": "^9.0.1",
|
||||
|
||||
+2
-5
@@ -5,13 +5,10 @@ import { slowQueryWarning, debug, resourceName } from './config';
|
||||
const execute = async (query, parameters, resource) => {
|
||||
ScheduleResourceTick(resourceName);
|
||||
try {
|
||||
const time = debug ? process.hrtime.bigint() : Date.now();
|
||||
|
||||
[query, parameters] = parseParameters(query, parameters);
|
||||
|
||||
const [result] = await pool.query(query, parameters);
|
||||
|
||||
const executionTime = debug ? Number(process.hrtime.bigint() - time) / 1e6 : Date.now() - time;
|
||||
const [rows, _, executionTime] = await pool.query(query, parameters);
|
||||
|
||||
if (executionTime >= slowQueryWarning || debug)
|
||||
console.log(
|
||||
@@ -19,7 +16,7 @@ const execute = async (query, parameters, resource) => {
|
||||
${query} ${JSON.stringify(parameters)}^0`
|
||||
);
|
||||
|
||||
return result;
|
||||
return rows;
|
||||
} catch (error) {
|
||||
console.log(
|
||||
`^1[ERROR] ${resource} was unable to execute a query!
|
||||
|
||||
@@ -881,7 +881,7 @@ minimist@^1.2.0:
|
||||
|
||||
"mysql2@https://github.com/overextended/node-mysql2.git":
|
||||
version "2.3.0"
|
||||
resolved "https://github.com/overextended/node-mysql2.git#694e1003732f048c91a2ab99f7a7667d88a02549"
|
||||
resolved "https://github.com/overextended/node-mysql2.git#0bd156905d3093d33dddbde10adf1ca8ede18680"
|
||||
dependencies:
|
||||
denque "^2.0.1"
|
||||
generate-function "^2.3.1"
|
||||
|
||||
Reference in new issue
Block a user