mirror of
https://github.com/dbgate/dbgate
synced 2024-11-15 00:06:30 +00:00
21 lines
571 B
TypeScript
21 lines
571 B
TypeScript
|
import { SqlDumper } from "@dbgate/types";
|
||
|
import { Expression, ColumnRefExpression } from "./types";
|
||
|
import { dumpSqlSourceRef } from "./dumpSqlSource";
|
||
|
|
||
|
function dumpSqlColumnRef(dumper: SqlDumper, expr: ColumnRefExpression) {
|
||
|
if (expr.source) {
|
||
|
if (dumpSqlSourceRef(dumper, expr.source)) {
|
||
|
dumper.put(".");
|
||
|
}
|
||
|
}
|
||
|
dumper.put("%i", expr.columnName);
|
||
|
}
|
||
|
|
||
|
export function dumpSqlExpression(dumper: SqlDumper, expr: Expression) {
|
||
|
switch (expr.exprType) {
|
||
|
case "column":
|
||
|
dumpSqlColumnRef(dumper, expr as ColumnRefExpression);
|
||
|
break;
|
||
|
}
|
||
|
}
|