mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 15:16:01 +00:00
editing table works
This commit is contained in:
@@ -62,10 +62,13 @@ export function dumpSqlSelect(dmp: SqlDumper, cmd: Select) {
|
||||
}
|
||||
|
||||
export function dumpSqlUpdate(dmp: SqlDumper, cmd: Update) {
|
||||
dmp.put('^update ');
|
||||
dumpSqlSourceRef(dmp, cmd.from);
|
||||
|
||||
dmp.put('&n^set ');
|
||||
if (cmd.alterTableUpdateSyntax) {
|
||||
dmp.put('^alter ^table %f &n^update ', cmd.from?.name);
|
||||
} else {
|
||||
dmp.put('^update ');
|
||||
dumpSqlSourceRef(dmp, cmd.from);
|
||||
dmp.put('&n^set ');
|
||||
}
|
||||
dmp.put('&>');
|
||||
dmp.putCollection(', ', cmd.fields, col => {
|
||||
dmp.put('%i=', col.targetColumn);
|
||||
@@ -81,8 +84,14 @@ export function dumpSqlUpdate(dmp: SqlDumper, cmd: Update) {
|
||||
}
|
||||
|
||||
export function dumpSqlDelete(dmp: SqlDumper, cmd: Delete) {
|
||||
dmp.put('^delete ^from ');
|
||||
dumpSqlSourceRef(dmp, cmd.from);
|
||||
if (cmd.alterTableDeleteSyntax) {
|
||||
dmp.put('^alter ^table ');
|
||||
dumpSqlSourceRef(dmp, cmd.from);
|
||||
dmp.put('^delete ');
|
||||
} else {
|
||||
dmp.put('^delete ^from ');
|
||||
dumpSqlSourceRef(dmp, cmd.from);
|
||||
}
|
||||
|
||||
if (cmd.where) {
|
||||
dmp.put('&n^where ');
|
||||
|
||||
@@ -26,12 +26,17 @@ export interface Update {
|
||||
fields: UpdateField[];
|
||||
from: FromDefinition;
|
||||
where?: Condition;
|
||||
// ALTER TABLE xxx UPDATE col1=val1 - syntax for ClickHouse
|
||||
alterTableUpdateSyntax?: boolean;
|
||||
}
|
||||
|
||||
export interface Delete {
|
||||
commandType: 'delete';
|
||||
from: FromDefinition;
|
||||
where?: Condition;
|
||||
|
||||
// ALTER TABLE xxx DELETE - syntax for ClickHouse
|
||||
alterTableDeleteSyntax?: boolean;
|
||||
}
|
||||
|
||||
export interface Insert {
|
||||
|
||||
Reference in New Issue
Block a user