This commit is contained in:
Jan Prochazka
2020-06-29 08:07:50 +02:00
parent abf7ad478d
commit eaaa7beaa1
5 changed files with 21 additions and 5 deletions

View File

@@ -118,6 +118,16 @@ const driver = {
const analyser = new MySqlAnalyser(pool, this);
return analyser.incrementalAnalysis(structure);
},
async analyseSingleObject(pool, name, typeField = 'tables') {
const analyser = new MySqlAnalyser(pool, this);
analyser.singleObjectFilter = { ...name, typeField };
const res = await analyser.fullAnalysis();
return res.tables[0];
},
// @ts-ignore
analyseSingleTable(pool, name) {
return this.analyseSingleObject(pool, name, 'tables');
},
async listDatabases(connection) {
const { rows } = await this.query(connection, 'show databases');
return rows.map((x) => ({ name: x.Database }));