mysql - result structure

This commit is contained in:
Jan Prochazka 2020-02-02 19:34:04 +01:00
parent 6188e90340
commit c0b45a56d8
5 changed files with 6 additions and 9 deletions

View File

@ -23,7 +23,6 @@ class MySqlAnalyser extends DatabaseAnalayser {
functions = false,
triggers = false
) {
console.log('DB', this.pool._database_name);
let res = await loadQuery(resFileName);
res = res.replace('=[OBJECT_NAME_CONDITION]', ' is not null');
res = res.replace('#DATABASE#', this.pool._database_name);

View File

@ -21,7 +21,7 @@ const driver = {
return new Promise((resolve, reject) => {
connection.query(sql, function(error, results, fields) {
if (error) reject(error);
resolve({ rows: results });
resolve({ rows: results, columns: fields });
});
});
},

View File

@ -41,7 +41,6 @@ async function handleTableData({ msgid, schemaName, pureName }) {
select.from = { schemaName, pureName };
select.selectAll = true;
const sql = select.toSql(driver);
console.log('SQL', sql);
const res = await driver.query(systemConnection, sql);
process.send({ msgtype: 'response', msgid, ...res });

6
types/engines.d.ts vendored
View File

@ -10,12 +10,6 @@ export interface EngineDriver {
user,
password,
database
}: {
server: any;
port: any;
user: any;
password: any;
database: any;
}): any;
query(pool: any, sql: string): Promise<QueryResult>;
getVersion(pool: any): Promise<{ version: string }>;

5
types/query.d.ts vendored
View File

@ -3,6 +3,11 @@ export interface RangeDefinition {
limit: number;
}
export interface QueryResultColumn {
name: string;
}
export interface QueryResult {
rows: any[];
columns: QueryResultColumn[];
}