Fix printing of EXISTS (SELECT) (#114)

* Fix printing of EXISTS (SELECT)

* Update sqlhelper.cpp
This commit is contained in:
mrks 2019-04-23 11:35:17 +02:00 committed by GitHub
parent ddb6276fac
commit ab1e6b4192
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 5 deletions

View File

@ -88,19 +88,28 @@ namespace hsql {
case kOpNot: case kOpNot:
inprint("NOT", numIndent); inprint("NOT", numIndent);
break; break;
case kOpExists:
inprint("EXISTS", numIndent);
break;
default: default:
inprintU(expr->opType, numIndent); inprintU(expr->opType, numIndent);
break; break;
} }
printExpression(expr->expr, numIndent + 1);
if (expr->expr2 != nullptr) { if (expr->select) {
printExpression(expr->expr2, numIndent + 1); printSelectStatementInfo(expr->select, numIndent + 1);
} else if (expr->exprList != nullptr) { } else {
for (Expr* e : *expr->exprList) printExpression(e, numIndent + 1); printExpression(expr->expr, numIndent + 1);
if (expr->expr2 != nullptr) {
printExpression(expr->expr2, numIndent + 1);
} else if (expr->exprList != nullptr) {
for (Expr* e : *expr->exprList) printExpression(e, numIndent + 1);
}
} }
} }
void printExpression(Expr* expr, uintmax_t numIndent) { void printExpression(Expr* expr, uintmax_t numIndent) {
if (!expr) return;
switch (expr->type) { switch (expr->type) {
case kExprStar: case kExprStar:
inprint("*", numIndent); inprint("*", numIndent);