dbgate/packages/sqltree/src/dumpSqlCondition.ts
2020-03-05 13:32:42 +01:00

16 lines
479 B
TypeScript

import { SqlDumper } from '@dbgate/types';
import { Condition, BinaryCondition } from './types';
import { dumpSqlExpression } from './dumpSqlExpression';
export function dumpSqlCondition(dmp: SqlDumper, condition: Condition) {
switch (condition.conditionType) {
case 'binary':
dmp.put('(');
dumpSqlExpression(dmp, condition.left);
dmp.put(' %s ', condition.operator);
dumpSqlExpression(dmp, condition.right);
dmp.put(')');
break;
}
}