diff --git a/src/main/libs/AntaresConnector.js b/src/main/libs/AntaresConnector.js
index b4ba58c6..e1fdf26d 100644
--- a/src/main/libs/AntaresConnector.js
+++ b/src/main/libs/AntaresConnector.js
@@ -285,15 +285,20 @@ export class AntaresConnector {
switch (this._client) { // TODO: uniform fields with every client type, needed table name and fields array
case 'maria':
case 'mysql': {
- const { rows, fields } = await new Promise((resolve, reject) => {
- this._connection.query(sql, (err, rows, fields) => {
+ const { rows, report, fields } = await new Promise((resolve, reject) => {
+ this._connection.query(sql, (err, response, fields) => {
if (err)
reject(err);
- else
- resolve({ rows, fields });
+ else {
+ resolve({
+ rows: Array.isArray(response) ? response : false,
+ report: !Array.isArray(response) ? response : false,
+ fields
+ });
+ }
});
});
- return { rows, fields };
+ return { rows, report, fields };
}
case 'mssql': {
const results = await this._connection.request().query(sql);
diff --git a/src/renderer/components/TheSettingBar.vue b/src/renderer/components/TheSettingBar.vue
index 4712c1cf..0ac329d6 100644
--- a/src/renderer/components/TheSettingBar.vue
+++ b/src/renderer/components/TheSettingBar.vue
@@ -201,6 +201,7 @@ export default {
max-width: 320px;
pointer-events: none;
text-overflow: ellipsis;
+ overflow: hidden;
transition: opacity 0.2s;
}
diff --git a/src/renderer/components/WorkspaceQueryTab.vue b/src/renderer/components/WorkspaceQueryTab.vue
index 02c80710..d215d43b 100644
--- a/src/renderer/components/WorkspaceQueryTab.vue
+++ b/src/renderer/components/WorkspaceQueryTab.vue
@@ -18,6 +18,9 @@
{{ $t('word.results') }}: {{ results.rows.length }}
+
+ {{ $t('message.affectedRows') }}: {{ results.report.affectedRows }}
+
{{ $t('word.schema') }}: {{ workspace.breadcrumbs.schema }}
@@ -94,8 +97,7 @@ export default {
async runQuery (query) {
if (!query) return;
this.isQuering = true;
- this.results = {};
- this.setTabFields({ cUid: this.connection.uid, tUid: this.tabUid, fields: [] });
+ this.clearTabData();
try { // Query Data
const params = {
@@ -107,33 +109,54 @@ export default {
const { status, response } = await Connection.rawQuery(params);
if (status === 'success') {
this.results = response;
- this.selectedFields = response.fields.map(field => field.orgName);
- }
- else
- this.addNotification({ status: 'error', message: response });
- }
- catch (err) {
- this.addNotification({ status: 'error', message: err.stack });
- }
+ if (response.rows) { // if is a select
+ this.selectedFields = response.fields.map(field => field.orgName);
- try { // Table data
- const params = {
- uid: this.connection.uid,
- schema: this.schema,
- table: this.table
- };
+ try { // Table data
+ const params = {
+ uid: this.connection.uid,
+ schema: this.schema,
+ table: this.table
+ };
- const { status, response } = await Tables.getTableColumns(params);
+ const { status, response } = await Tables.getTableColumns(params);
- if (status === 'success') {
- let fields = response.filter(field => this.selectedFields.includes(field.name));
- if (this.selectedFields.length) {
- fields = fields.map((field, index) => {
- return { ...field, alias: this.results.fields[index].name };
- });
+ if (status === 'success') {
+ let fields = response.filter(field => this.selectedFields.includes(field.name));
+ if (this.selectedFields.length) {
+ fields = fields.map((field, index) => {
+ return { ...field, alias: this.results.fields[index].name };
+ });
+ }
+
+ this.setTabFields({ cUid: this.connection.uid, tUid: this.tabUid, fields });
+ }
+ else
+ this.addNotification({ status: 'error', message: response });
+ }
+ catch (err) {
+ this.addNotification({ status: 'error', message: err.stack });
+ }
+
+ try { // Key usage (foreign keys)
+ const params = {
+ uid: this.connection.uid,
+ schema: this.schema,
+ table: this.table
+ };
+
+ const { status, response } = await Tables.getKeyUsage(params);
+ if (status === 'success')
+ this.setTabKeyUsage({ cUid: this.connection.uid, tUid: this.tabUid, keyUsage: response });
+ else
+ this.addNotification({ status: 'error', message: response });
+ }
+ catch (err) {
+ this.addNotification({ status: 'error', message: err.stack });
+ }
+ }
+ else { // if is a query without results
}
-
- this.setTabFields({ cUid: this.connection.uid, tUid: this.tabUid, fields });
}
else
this.addNotification({ status: 'error', message: response });
@@ -142,28 +165,15 @@ export default {
this.addNotification({ status: 'error', message: err.stack });
}
- try { // Key usage (foreign keys)
- const params = {
- uid: this.connection.uid,
- schema: this.schema,
- table: this.table
- };
-
- const { status, response } = await Tables.getKeyUsage(params);
- if (status === 'success')
- this.setTabKeyUsage({ cUid: this.connection.uid, tUid: this.tabUid, keyUsage: response });
- else
- this.addNotification({ status: 'error', message: response });
- }
- catch (err) {
- this.addNotification({ status: 'error', message: err.stack });
- }
-
this.isQuering = false;
this.lastQuery = query;
},
reloadTable () {
this.runQuery(this.lastQuery);
+ },
+ clearTabData () {
+ this.results = {};
+ this.setTabFields({ cUid: this.connection.uid, tUid: this.tabUid, fields: [] });
}
}
};
diff --git a/src/renderer/i18n/en-US.js b/src/renderer/i18n/en-US.js
index f32ace1b..0c376073 100644
--- a/src/renderer/i18n/en-US.js
+++ b/src/renderer/i18n/en-US.js
@@ -69,7 +69,8 @@ module.exports = {
uploadFile: 'Upload file',
addNewRow: 'Add new row',
numberOfInserts: 'Number of inserts',
- openNewTab: 'Open a new tab'
+ openNewTab: 'Open a new tab',
+ affectedRows: 'Affected rows'
},
// Date and Time
short: {