706 if (!arg_expr->get_type_info().is_string()) {
707 throw std::runtime_error(
"expression before LIKE must be of a string type.");
709 if (!like_expr->get_type_info().is_string()) {
710 throw std::runtime_error(
"expression after LIKE must be of a string type.");
712 char escape_char =
'\\';
713 if (escape_expr !=
nullptr) {
714 if (!escape_expr->get_type_info().is_string()) {
715 throw std::runtime_error(
"expression after ESCAPE must be of a string type.");
717 if (!escape_expr->get_type_info().is_string()) {
718 throw std::runtime_error(
"expression after ESCAPE must be of a string type.");
721 if (c !=
nullptr && c->get_constval().stringval->length() > 1) {
722 throw std::runtime_error(
"String after ESCAPE must have a single character.");
724 escape_char = (*c->get_constval().stringval)[0];
727 bool is_simple =
false;
731 std::transform(pattern.begin(), pattern.end(), pattern.begin(), ::tolower);
739 std::shared_ptr<Analyzer::Expr>
result = makeExpr<Analyzer::LikeExpr>(
740 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)