fix: missing schema when queryng INFORMATION_SCHEMA

This commit is contained in:
Fabio 2020-09-19 18:10:57 +02:00
parent 530907d097
commit 530d1bd43f
3 changed files with 9 additions and 2 deletions

View File

@ -20,6 +20,7 @@ export default connections => {
try {
await InformationSchema.testConnection(Connection);
Connection.destroy();
return { status: 'success' };
}
@ -49,6 +50,7 @@ export default connections => {
const { rows: structure } = await InformationSchema.getStructure(Connection);
connections[conn.uid] = Connection;
return { status: 'success', response: structure };
}
catch (err) {

View File

@ -92,7 +92,10 @@ export default {
if (resultsWithRows[index] && resultsWithRows[index].fields && resultsWithRows[index].fields.length) {
return resultsWithRows[index].fields.map(field => {
return { table: field.orgTable, schema: field.db };
return {
table: field.orgTable,
schema: field.db || 'INFORMATION_SCHEMA'
};
}).filter((val, i, arr) => arr.findIndex(el => el.schema === val.schema && el.table === val.table) === i);
}
return [];

View File

@ -285,7 +285,9 @@ export default {
field.name === cKey ||
field.alias === cKey ||
`${field.table}.${field.name}` === cKey ||
`${field.table}.${field.alias}` === cKey)[0];
`${field.table}.${field.alias}` === cKey ||
`${field.table.toLowerCase()}.${field.name}` === cKey ||
`${field.table.toLowerCase()}.${field.alias}` === cKey)[0];
},
isNull (value) {
return value === null ? ' is-null' : '';