diff --git a/src/main/libs/clients/MySQLClient.js b/src/main/libs/clients/MySQLClient.js index 19f5bffd..99e89615 100644 --- a/src/main/libs/clients/MySQLClient.js +++ b/src/main/libs/clients/MySQLClient.js @@ -351,6 +351,7 @@ export class MySQLClient extends AntaresCore { const remappedFields = fields ? fields.map(field => { return { name: field.name, + orgName: field.orgName, schema: field.db, table: field.orgTable, type: 'varchar' diff --git a/src/renderer/components/SettingBarContext.vue b/src/renderer/components/SettingBarContext.vue index 5ca26716..542b1c96 100644 --- a/src/renderer/components/SettingBarContext.vue +++ b/src/renderer/components/SettingBarContext.vue @@ -71,7 +71,7 @@ export default { }), confirmDeleteConnection () { this.deleteConnection(this.contextConnection); - this.$emit('close-context'); + this.closeContext(); }, showEditModal () { this.isEditModal = true; @@ -85,6 +85,7 @@ export default { }, hideConfirmModal () { this.isConfirmModal = false; + this.closeContext(); }, closeContext () { this.$emit('close-context'); diff --git a/src/renderer/components/WorkspaceQueryTab.vue b/src/renderer/components/WorkspaceQueryTab.vue index f2fd2d32..05ecdfc7 100644 --- a/src/renderer/components/WorkspaceQueryTab.vue +++ b/src/renderer/components/WorkspaceQueryTab.vue @@ -136,12 +136,10 @@ export default { let qI = 0;// queries index for (const result of this.results) { // cycle queries - let fI = 0;// fields index - if (result.rows) { // if is a select const paramsArr = this.getResultParams(qI); - selectedFields = result.fields.map(field => field.name); + selectedFields = result.fields.map(field => field.orgName || field.name); this.resultsCount += result.rows.length; for (const paramObj of paramsArr) { @@ -154,15 +152,20 @@ export default { const { status, response } = await Tables.getTableColumns(params); if (status === 'success') { - let fields = response.filter(field => selectedFields.includes(field.name)); + let fields = response.length ? selectedFields.map(selField => { + return response.find(field => field.name === selField); + }) : []; + if (selectedFields.length) { fields = fields.map(field => { - return { ...field, alias: result.fields[fI++].name }; + const alias = result.fields.find(resField => resField.orgName === field.name).name || field.name; + return { ...field, alias }; }); } + if (!fields.length) { - fields = response.map(field => { - return { ...field, alias: result.fields[fI++].name }; + fields = result.fields.map(field => { + return { ...field, alias: field.name }; }); } diff --git a/src/renderer/components/WorkspaceQueryTable.vue b/src/renderer/components/WorkspaceQueryTable.vue index 4b3242c8..56b47f1c 100644 --- a/src/renderer/components/WorkspaceQueryTable.vue +++ b/src/renderer/components/WorkspaceQueryTable.vue @@ -73,7 +73,7 @@ @contextmenu="contextMenu" /> - + diff --git a/src/renderer/components/WorkspaceQueryTableRow.vue b/src/renderer/components/WorkspaceQueryTableRow.vue index 623836f5..2689f33c 100644 --- a/src/renderer/components/WorkspaceQueryTableRow.vue +++ b/src/renderer/components/WorkspaceQueryTableRow.vue @@ -177,6 +177,7 @@ export default { } if (BIT.includes(type)) { + if (typeof val === 'number') val = [val]; const hex = Buffer.from(val).toString('hex'); return hexToBinary(hex); }