mirror of https://github.com/Fabio286/antares.git
fix: missing header for some query results
This commit is contained in:
parent
9ecd88870d
commit
d560c384f5
|
@ -194,10 +194,18 @@ export class MySQLClient extends AntaresCore {
|
|||
if (err)
|
||||
reject(err);
|
||||
else {
|
||||
const remappedFields = fields ? fields.map(field => {
|
||||
return {
|
||||
name: field.name,
|
||||
db: field.db,
|
||||
table: field.orgTable
|
||||
};
|
||||
}) : [];
|
||||
|
||||
resolve({
|
||||
rows: Array.isArray(response) ? response : false,
|
||||
report: !Array.isArray(response) ? response : false,
|
||||
fields
|
||||
fields: remappedFields
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -100,9 +100,9 @@ export default {
|
|||
|
||||
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
|
||||
if (field.table) cachedTable = field.table;// Needed for some queries on information_schema
|
||||
return {
|
||||
table: field.orgTable || cachedTable,
|
||||
table: field.table || cachedTable,
|
||||
schema: field.db || 'INFORMATION_SCHEMA'
|
||||
};
|
||||
}).filter((val, i, arr) => arr.findIndex(el => el.schema === val.schema && el.table === val.table) === i);
|
||||
|
@ -137,7 +137,7 @@ export default {
|
|||
if (result.rows) { // if is a select
|
||||
const paramsArr = this.getResultParams(qI);
|
||||
|
||||
selectedFields = result.fields.map(field => field.orgName);
|
||||
selectedFields = result.fields.map(field => field.name);
|
||||
this.resultsCount += result.rows.length;
|
||||
|
||||
for (const paramObj of paramsArr) {
|
||||
|
@ -162,7 +162,7 @@ export default {
|
|||
});
|
||||
}
|
||||
|
||||
fieldsArr[qI] = fieldsArr[qI] ? [...fieldsArr[qI], ...fields] : fields;
|
||||
fieldsArr[qI] = fieldsArr[qI] ? [...fieldsArr[qI], ...fields] : fields.length ? fields : result.fields;
|
||||
}
|
||||
else
|
||||
this.addNotification({ status: 'error', message: response });
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
:class="{'active': resultsetIndex === index}"
|
||||
@click="selectResultset(index)"
|
||||
>
|
||||
<a>{{ result.fields ? result.fields[0].orgTable : '' }} ({{ result.rows.length }})</a>
|
||||
<a>{{ result.fields ? result.fields[0].table : '' }} ({{ result.rows.length }})</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div ref="table" class="table table-hover">
|
||||
|
@ -207,7 +207,7 @@ export default {
|
|||
},
|
||||
getTable (index) {
|
||||
if (this.resultsWithRows[index] && this.resultsWithRows[index].fields && this.resultsWithRows[index].fields.length)
|
||||
return this.resultsWithRows[index].fields[0].orgTable;
|
||||
return this.resultsWithRows[index].fields[0].table;
|
||||
return '';
|
||||
},
|
||||
getSchema (index) {
|
||||
|
|
Loading…
Reference in New Issue