mirror of
https://github.com/Fabio286/antares.git
synced 2025-04-04 05:21:01 +02:00
fix: unable to obtain fields informations for some queries
This commit is contained in:
parent
530d1bd43f
commit
43c7072c1c
@ -89,11 +89,13 @@ export default {
|
|||||||
}),
|
}),
|
||||||
getResultParams (index) {
|
getResultParams (index) {
|
||||||
const resultsWithRows = this.results.filter(result => result.rows);
|
const resultsWithRows = this.results.filter(result => result.rows);
|
||||||
|
let cachedTable;
|
||||||
|
|
||||||
if (resultsWithRows[index] && resultsWithRows[index].fields && resultsWithRows[index].fields.length) {
|
if (resultsWithRows[index] && resultsWithRows[index].fields && resultsWithRows[index].fields.length) {
|
||||||
return resultsWithRows[index].fields.map(field => {
|
return resultsWithRows[index].fields.map(field => {
|
||||||
|
if (field.orgTable) cachedTable = field.orgTable;// Needed for some queries on information_schema
|
||||||
return {
|
return {
|
||||||
table: field.orgTable,
|
table: field.orgTable || cachedTable,
|
||||||
schema: field.db || 'INFORMATION_SCHEMA'
|
schema: field.db || 'INFORMATION_SCHEMA'
|
||||||
};
|
};
|
||||||
}).filter((val, i, arr) => arr.findIndex(el => el.schema === val.schema && el.table === val.table) === i);
|
}).filter((val, i, arr) => arr.findIndex(el => el.schema === val.schema && el.table === val.table) === i);
|
||||||
@ -147,6 +149,11 @@ export default {
|
|||||||
return { ...field, alias: result.fields[fI++].name };
|
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;
|
fieldsArr[qI] = fieldsArr[qI] ? [...fieldsArr[qI], ...fields] : fields;
|
||||||
}
|
}
|
||||||
|
@ -141,11 +141,14 @@ export default {
|
|||||||
resultsWithRows () {
|
resultsWithRows () {
|
||||||
return this.results.filter(result => result.rows);
|
return this.results.filter(result => result.rows);
|
||||||
},
|
},
|
||||||
|
tabProperties () {
|
||||||
|
return this.getWorkspaceTab(this.tabUid);
|
||||||
|
},
|
||||||
fields () {
|
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 () {
|
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: {
|
watch: {
|
||||||
|
@ -3,7 +3,7 @@ export default {
|
|||||||
namespaced: true,
|
namespaced: true,
|
||||||
strict: true,
|
strict: true,
|
||||||
state: {
|
state: {
|
||||||
app_name: 'Antares - Database Client',
|
app_name: 'Antares - SQL Client',
|
||||||
app_version: process.env.PACKAGE_VERSION || 0,
|
app_version: process.env.PACKAGE_VERSION || 0,
|
||||||
is_loading: false,
|
is_loading: false,
|
||||||
is_new_modal: false,
|
is_new_modal: false,
|
||||||
|
@ -7,7 +7,7 @@ export default {
|
|||||||
state: {
|
state: {
|
||||||
locale: 'en-US',
|
locale: 'en-US',
|
||||||
explorebar_size: null,
|
explorebar_size: null,
|
||||||
notifications_timeout: 10
|
notifications_timeout: 5
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
getLocale: state => state.locale,
|
getLocale: state => state.locale,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user