generated designer query SQL

This commit is contained in:
Jan Prochazka
2020-12-28 13:59:36 +01:00
parent 79759b1665
commit c10c6afbc5
8 changed files with 217 additions and 14 deletions

View File

@@ -42,14 +42,14 @@ export function dumpSqlSourceRef(dmp: SqlDumper, source: Source) {
export function dumpSqlRelation(dmp: SqlDumper, from: Relation) {
dmp.put('&n %k ', from.joinType);
dumpSqlSourceDef(dmp, from);
if (from.conditions) {
if (from.conditions && from.conditions.length > 0) {
dmp.put(' ^on ');
dmp.putCollection(' ^and ', from.conditions, cond => dumpSqlCondition(dmp, cond));
dmp.putCollection(' ^and ', from.conditions, (cond) => dumpSqlCondition(dmp, cond));
}
}
export function dumpSqlFromDefinition(dmp: SqlDumper, from: FromDefinition) {
dumpSqlSourceDef(dmp, from);
dmp.put(' ');
if (from.relations) from.relations.forEach(rel => dumpSqlRelation(dmp, rel));
if (from.relations) from.relations.forEach((rel) => dumpSqlRelation(dmp, rel));
}