export query

This commit is contained in:
Jan Prochazka
2020-10-08 15:34:06 +02:00
parent 360a4ef1bc
commit 3819bf9bd7
6 changed files with 69 additions and 15 deletions

View File

@@ -381,13 +381,13 @@ export abstract class GridDisplay {
};
}
createSelect(): Select {
createSelect(options = {}): Select {
return null;
}
processReferences(select: Select, displayedColumnInfo: DisplayedColumnInfo) {}
processReferences(select: Select, displayedColumnInfo: DisplayedColumnInfo, options) {}
createSelectBase(name: NamedObjectInfo, columns: ColumnInfo[]) {
createSelectBase(name: NamedObjectInfo, columns: ColumnInfo[], options) {
if (!columns) return null;
const orderColumnName = columns[0].columnName;
const select: Select = {
@@ -411,7 +411,7 @@ export abstract class GridDisplay {
this.columns.map((col) => ({ ...col, sourceAlias: 'basetbl' })),
'uniqueName'
);
this.processReferences(select, displayedColumnInfo);
this.processReferences(select, displayedColumnInfo, options);
this.applyFilterOnSelect(select, displayedColumnInfo);
this.applyGroupOnSelect(select, displayedColumnInfo);
this.applySortOnSelect(select, displayedColumnInfo);
@@ -427,6 +427,13 @@ export abstract class GridDisplay {
return sql;
}
getExportQuery() {
const select = this.createSelect({ isExport: true });
if (!select) return null;
const sql = treeToSql(this.driver, select, dumpSqlSelect);
return sql;
}
resizeColumn(uniqueName: string, computedSize: number, diff: number) {
this.setConfig((cfg) => {
const columnWidths = {

View File

@@ -162,14 +162,16 @@ export class TableGridDisplay extends GridDisplay {
return this.findTable({ schemaName, pureName });
}
processReferences(select: Select, displayedColumnInfo: DisplayedColumnInfo) {
processReferences(select: Select, displayedColumnInfo: DisplayedColumnInfo, options) {
this.addJoinsFromExpandedColumns(select, this.columns, 'basetbl', displayedColumnInfo);
this.addHintsToSelect(select);
if (!options.isExport) {
this.addHintsToSelect(select);
}
}
createSelect() {
createSelect(options = {}) {
if (!this.table) return null;
const select = this.createSelectBase(this.table, this.table.columns);
const select = this.createSelectBase(this.table, this.table.columns, options);
return select;
}

View File

@@ -43,8 +43,8 @@ export class ViewGridDisplay extends GridDisplay {
};
}
createSelect() {
const select = this.createSelectBase(this.view, this.view.columns);
createSelect(options = {}) {
const select = this.createSelectBase(this.view, this.view.columns, options);
return select;
}
}