Skip to content

Commit

Permalink
fix: unable to obtain fields informations for some queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Sep 20, 2020
1 parent 530d1bd commit 43c7072
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/renderer/components/WorkspaceQueryTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ export default {
}),
getResultParams (index) {
const resultsWithRows = this.results.filter(result => result.rows);
let cachedTable;
if (resultsWithRows[index] && resultsWithRows[index].fields && resultsWithRows[index].fields.length) {
return resultsWithRows[index].fields.map(field => {
if (field.orgTable) cachedTable = field.orgTable;// Needed for some queries on information_schema
return {
table: field.orgTable,
table: field.orgTable || cachedTable,
schema: field.db || 'INFORMATION_SCHEMA'
};
}).filter((val, i, arr) => arr.findIndex(el => el.schema === val.schema && el.table === val.table) === i);
Expand Down Expand Up @@ -147,6 +149,11 @@ export default {
return { ...field, alias: result.fields[fI++].name };
});
}
if (!fields.length) {
fields = response.map(field => {
return { ...field, alias: result.fields[fI++].name };
});
}
fieldsArr[qI] = fieldsArr[qI] ? [...fieldsArr[qI], ...fields] : fields;
}
Expand Down
7 changes: 5 additions & 2 deletions src/renderer/components/WorkspaceQueryTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,14 @@ export default {
resultsWithRows () {
return this.results.filter(result => result.rows);
},
tabProperties () {
return this.getWorkspaceTab(this.tabUid);
},
fields () {
return this.getWorkspaceTab(this.tabUid) && this.getWorkspaceTab(this.tabUid).fields[this.resultsetIndex] ? this.getWorkspaceTab(this.tabUid).fields[this.resultsetIndex] : [];
return this.tabProperties && this.tabProperties.fields[this.resultsetIndex] ? this.tabProperties.fields[this.resultsetIndex] : [];
},
keyUsage () {
return this.getWorkspaceTab(this.tabUid) && this.getWorkspaceTab(this.tabUid).keyUsage[this.resultsetIndex] ? this.getWorkspaceTab(this.tabUid).keyUsage[this.resultsetIndex] : [];
return this.tabProperties && this.tabProperties.keyUsage[this.resultsetIndex] ? this.tabProperties.keyUsage[this.resultsetIndex] : [];
}
},
watch: {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/modules/application.store.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default {
namespaced: true,
strict: true,
state: {
app_name: 'Antares - Database Client',
app_name: 'Antares - SQL Client',
app_version: process.env.PACKAGE_VERSION || 0,
is_loading: false,
is_new_modal: false,
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/modules/settings.store.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
state: {
locale: 'en-US',
explorebar_size: null,
notifications_timeout: 10
notifications_timeout: 5
},
getters: {
getLocale: state => state.locale,
Expand Down

0 comments on commit 43c7072

Please sign in to comment.