table grid display, SQL for browse table is generated on FE

This commit is contained in:
Jan Prochazka
2020-03-05 09:40:05 +01:00
parent bbc969fa71
commit aad9512951
14 changed files with 152 additions and 39 deletions

View File

@@ -0,0 +1,20 @@
import GridDisplay from "./GridDisplay";
import { Select } from "@dbgate/sqltree";
import { TableInfo, EngineDriver } from "@dbgate/types";
export default class TableGridDisplay extends GridDisplay {
constructor(public table: TableInfo, public driver: EngineDriver) {
super();
}
getPageQuery(offset: number, count: number) {
const select = new Select();
if (this.driver.dialect.limitSelect) select.topRecords = count;
if (this.driver.dialect.rangeSelect)
select.range = { offset: offset, limit: count };
select.from = this.table;
select.selectAll = true;
const sql = select.toSql(this.driver);
return sql;
}
}