stop generating empty WHERE () section in mysql queries

This commit is contained in:
hotid 2018-10-26 20:14:43 +03:00
parent e4e38f71e1
commit f22779ad15

View File

@ -119,6 +119,7 @@ String transformQueryForExternalDatabase(
{
if (function->name == "and")
{
bool compatibleFound = false;
auto new_function_and = std::make_shared<ASTFunction>();
auto new_function_and_arguments = std::make_shared<ASTExpressionList>();
new_function_and->arguments = new_function_and_arguments;
@ -126,8 +127,12 @@ String transformQueryForExternalDatabase(
for (const auto & elem : function->arguments->children)
if (isCompatible(*elem))
{
new_function_and_arguments->children.push_back(elem);
compatibleFound = true;
}
if (compatibleFound)
select->where_expression = std::move(new_function_and);
}
}