696 if (!arg_expr->get_type_info().is_string()) {
697 throw std::runtime_error(
"expression before LIKE must be of a string type.");
699 if (!like_expr->get_type_info().is_string()) {
700 throw std::runtime_error(
"expression after LIKE must be of a string type.");
702 char escape_char =
'\\';
703 if (escape_expr !=
nullptr) {
704 if (!escape_expr->get_type_info().is_string()) {
705 throw std::runtime_error(
"expression after ESCAPE must be of a string type.");
707 if (!escape_expr->get_type_info().is_string()) {
708 throw std::runtime_error(
"expression after ESCAPE must be of a string type.");
711 if (c !=
nullptr && c->get_constval().stringval->length() > 1) {
712 throw std::runtime_error(
"String after ESCAPE must have a single character.");
714 escape_char = (*c->get_constval().stringval)[0];
717 bool is_simple =
false;
721 std::transform(pattern.begin(), pattern.end(), pattern.begin(), ::tolower);
729 std::shared_ptr<Analyzer::Expr>
result = makeExpr<Analyzer::LikeExpr>(
730 arg_expr->decompress(), like_expr, escape_expr, is_ilike, is_simple);
OUTPUT transform(INPUT const &input, FUNC const &func)
static void erase_cntl_chars(std::string &like_str, char escape_char)
Datum get_constval() const
static bool test_is_simple_expr(const std::string &like_str, char escape_char)
static void check_like_expr(const std::string &like_str, char escape_char)