diff --git a/src/main/libs/clients/MySQLClient.js b/src/main/libs/clients/MySQLClient.js index 2ef8ce6f..be5b4f37 100644 --- a/src/main/libs/clients/MySQLClient.js +++ b/src/main/libs/clients/MySQLClient.js @@ -1206,10 +1206,13 @@ export class MySQLClient extends AntaresCore { for (const query of queries) { if (!query) continue; + const timeStart = new Date(); + let timeStop; let keysArr = []; - const { rows, report, fields, keys } = await new Promise((resolve, reject) => { + const { rows, report, fields, keys, duration } = await new Promise((resolve, reject) => { this._connection.query({ sql: query, nestTables }, async (err, response, fields) => { + timeStop = new Date(); const queryResult = response; if (err) @@ -1277,6 +1280,7 @@ export class MySQLClient extends AntaresCore { } resolve({ + duration: timeStop - timeStart, rows: Array.isArray(queryResult) ? queryResult.some(el => Array.isArray(el)) ? [] : queryResult : false, report: !Array.isArray(queryResult) ? queryResult : false, fields: remappedFields, @@ -1286,7 +1290,7 @@ export class MySQLClient extends AntaresCore { }); }); - resultsArr.push({ rows, report, fields, keys }); + resultsArr.push({ rows, report, fields, keys, duration }); } return resultsArr.length === 1 ? resultsArr[0] : resultsArr; diff --git a/src/renderer/components/WorkspaceQueryTab.vue b/src/renderer/components/WorkspaceQueryTab.vue index 404b6c3b..80dc7120 100644 --- a/src/renderer/components/WorkspaceQueryTab.vue +++ b/src/renderer/components/WorkspaceQueryTab.vue @@ -26,6 +26,13 @@
+
+ {{ durationsCount / 1000 }}s +
{{ $t('word.results') }}: {{ resultsCount.toLocaleString() }}
@@ -84,6 +91,7 @@ export default { isQuering: false, results: [], resultsCount: 0, + durationsCount: 0, affectedCount: 0, editorHeight: 200 }; @@ -143,6 +151,7 @@ export default { if (status === 'success') { this.results = Array.isArray(response) ? response : [response]; this.resultsCount += this.results.reduce((acc, curr) => acc + (curr.rows ? curr.rows.length : 0), 0); + this.durationsCount += this.results.reduce((acc, curr) => acc + curr.duration, 0); this.affectedCount += this.results.reduce((acc, curr) => acc + (curr.report ? curr.report.affectedRows : 0), 0); } else @@ -161,6 +170,7 @@ export default { clearTabData () { this.results = []; this.resultsCount = 0; + this.durationsCount = 0; this.affectedCount = 0; }, resize (e) { diff --git a/src/renderer/components/WorkspaceTableTab.vue b/src/renderer/components/WorkspaceTableTab.vue index fda09f7e..d1be581e 100644 --- a/src/renderer/components/WorkspaceTableTab.vue +++ b/src/renderer/components/WorkspaceTableTab.vue @@ -64,6 +64,13 @@
+
+ {{ results[0].duration / 1000 }}s +
{{ $t('word.results') }}: {{ results[0].rows.length.toLocaleString() }}
diff --git a/src/renderer/i18n/en-US.js b/src/renderer/i18n/en-US.js index b4401f65..cd06be2f 100644 --- a/src/renderer/i18n/en-US.js +++ b/src/renderer/i18n/en-US.js @@ -190,7 +190,8 @@ module.exports = { tableFiller: 'Table Filler', fakeDataLanguage: 'Fake data language', searchForElements: 'Search for elements', - selectAll: 'Select all' + selectAll: 'Select all', + queryDuration: 'Query duration' }, faker: { address: 'Address',