aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Databases/removeWhereConditionPlaceholder.cpp
blob: fb147be26d00e60fa5796cc166a77f7ac3ff7ed2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <Databases/removeWhereConditionPlaceholder.h>

namespace DB
{

std::string removeWhereConditionPlaceholder(const std::string & query)
{
    static constexpr auto true_condition = "(1 = 1)";
    auto condition_position = query.find(CONDITION_PLACEHOLDER_TO_REPLACE_VALUE);
    if (condition_position != std::string::npos)
    {
        auto query_copy = query;
        query_copy.replace(condition_position, CONDITION_PLACEHOLDER_TO_REPLACE_VALUE.size(), true_condition);
        return query_copy;
    }

    return query;
}

}