mirror of https://github.com/Fabio286/antares.git
fix: wrong result fields type and order with some queries
This commit is contained in:
parent
580105e9f3
commit
a8cd17748f
|
@ -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'
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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 };
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
@contextmenu="contextMenu"
|
||||
/>
|
||||
</template>
|
||||
</basevirtualscroll>
|
||||
</BaseVirtualScroll>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue