[CP] fix like(nchar) bug

This commit is contained in:
sdc
2023-06-01 03:47:55 +00:00
committed by ob-robot
parent ab45b51c6a
commit 9b7afa1d90
3 changed files with 22 additions and 13 deletions

View File

@ -229,9 +229,15 @@ int ObExprLike::calc_with_non_instr_mode(T &result,
} else if (text_val.length() <= 0 && pattern_val.length() <= 0) {
// empty string
result.set_int(1);
} else if (OB_UNLIKELY(CS_TYPE_UTF8MB4_BIN != coll_type && escape_wc == static_cast<int32_t>('%'))) {
// when cs_type is not utf8mb4_bin and escape = %, there is a bug of wildcmp
ret = OB_NOT_SUPPORTED;
LOG_USER_ERROR(OB_NOT_SUPPORTED, "escape %");
} else {
bool b = ObCharset::wildcmp(coll_type, text_val, pattern_val, escape_wc,
static_cast<int32_t>('_'), static_cast<int32_t>('%'));
SQL_LOG(DEBUG, "calc_with_non_instr_mode1", K(escape_coll), K(escape_val), K(escape_wc), K(pattern_val),
K(coll_type), KPHEX(text_val.ptr(), text_val.length()), KPHEX(pattern_val.ptr(), pattern_val.length()), K(b));
result.set_int(static_cast<int64_t>(b));
}
return ret;