mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 21:16:00 +00:00
introduced sqltree typescript library
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
class Command {
|
||||
/** @param driver {import('@dbgate/types').EngineDriver} */
|
||||
toSql(driver) {
|
||||
const dumper = driver.createDumper();
|
||||
this.dumpSql(dumper);
|
||||
return dumper.s;
|
||||
}
|
||||
|
||||
/** @param dumper {import('@dbgate/types').SqlDumper} */
|
||||
dumpSql(dumper) {}
|
||||
}
|
||||
|
||||
module.exports = Command;
|
||||
@@ -1,37 +0,0 @@
|
||||
const Command = require('./command');
|
||||
|
||||
class Select extends Command {
|
||||
constructor() {
|
||||
super();
|
||||
/** @type {number} */
|
||||
this.topRecords = undefined;
|
||||
/** @type {import('@dbgate/types').NamedObjectInfo} */
|
||||
this.from = undefined;
|
||||
/** @type {import('@dbgate/types').RangeDefinition} */
|
||||
this.range = undefined;
|
||||
this.distinct = false;
|
||||
this.selectAll = false;
|
||||
}
|
||||
|
||||
/** @param dumper {import('@dbgate/types').SqlDumper} */
|
||||
dumpSql(dumper) {
|
||||
dumper.put('^select ');
|
||||
if (this.topRecords) {
|
||||
dumper.put('^top %s ', this.topRecords);
|
||||
}
|
||||
if (this.distinct) {
|
||||
dumper.put('^distinct ');
|
||||
}
|
||||
if (this.selectAll) {
|
||||
dumper.put('* ');
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
dumper.put('^from %f ', this.from);
|
||||
if (this.range) {
|
||||
dumper.put('^limit %s ^offset %s ', this.range.limit, this.range.offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Select;
|
||||
@@ -1,6 +1,6 @@
|
||||
const engines = require('@dbgate/engines');
|
||||
const Select = require('../dmlf/select');
|
||||
const driverConnect = require('../utility/driverConnect')
|
||||
const { Select } = require('@dbgate/sqltree');
|
||||
const driverConnect = require('../utility/driverConnect');
|
||||
|
||||
let systemConnection;
|
||||
let storedConnection;
|
||||
|
||||
Reference in New Issue
Block a user