From ab1e6b419292dfff2162e00a3e8a614b851c6ed4 Mon Sep 17 00:00:00 2001 From: mrks Date: Tue, 23 Apr 2019 11:35:17 +0200 Subject: [PATCH] Fix printing of EXISTS (SELECT) (#114) * Fix printing of EXISTS (SELECT) * Update sqlhelper.cpp --- src/util/sqlhelper.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/util/sqlhelper.cpp b/src/util/sqlhelper.cpp index 8e4aec4..353d8c2 100755 --- a/src/util/sqlhelper.cpp +++ b/src/util/sqlhelper.cpp @@ -88,19 +88,28 @@ namespace hsql { case kOpNot: inprint("NOT", numIndent); break; + case kOpExists: + inprint("EXISTS", numIndent); + break; default: inprintU(expr->opType, numIndent); break; } - 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); + + if (expr->select) { + printSelectStatementInfo(expr->select, numIndent + 1); + } else { + 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) { + if (!expr) return; switch (expr->type) { case kExprStar: inprint("*", numIndent);