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