fix find_in_set, sleep(null), errorcode
This commit is contained in:
@ -77,10 +77,13 @@ int search(const ObString &str, const ObString &str_list, const ObCollationType
|
|||||||
ObString comma_str = ObCharsetUtils::get_const_str(cs_type, ',');
|
ObString comma_str = ObCharsetUtils::get_const_str(cs_type, ',');
|
||||||
|
|
||||||
while (str_list_pos < str_list.length()) {
|
while (str_list_pos < str_list.length()) {
|
||||||
int64_t comma_pos = ObCharset::instrb(cs_type, str_list.ptr() + str_list_pos, str_list.length() - str_list_pos,
|
comma_pos = ObCharset::instrb(cs_type,
|
||||||
comma_str.ptr(), comma_str.length());
|
str_list.ptr() + str_list_pos,
|
||||||
|
str_list.length() - str_list_pos,
|
||||||
|
comma_str.ptr(),
|
||||||
|
comma_str.length());
|
||||||
const char* elem_ptr = str_list.ptr() + str_list_pos;
|
const char* elem_ptr = str_list.ptr() + str_list_pos;
|
||||||
int64_t elem_length = (comma_pos >=0) ? comma_pos : str_list.length() - str_list_pos;
|
int64_t elem_length = (comma_pos >= 0) ? comma_pos : (str_list.length() - str_list_pos);
|
||||||
if (0 != ObCharset::strcmp(cs_type, elem_ptr, elem_length, str.ptr(), str.length())) {
|
if (0 != ObCharset::strcmp(cs_type, elem_ptr, elem_length, str.ptr(), str.length())) {
|
||||||
//not match
|
//not match
|
||||||
str_list_pos += elem_length + ((comma_pos >= 0) ? comma_str.length() : 0);
|
str_list_pos += elem_length + ((comma_pos >= 0) ? comma_str.length() : 0);
|
||||||
@ -90,7 +93,8 @@ int search(const ObString &str, const ObString &str_list, const ObCollationType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_list_pos < str_list.length()) {
|
if (str_list_pos < str_list.length()
|
||||||
|
|| (str_list_pos == str_list.length() && 0 == str.length() && comma_pos > 0)) {
|
||||||
res_pos = elem_idx;
|
res_pos = elem_idx;
|
||||||
} else {
|
} else {
|
||||||
res_pos = 0;
|
res_pos = 0;
|
||||||
|
|||||||
@ -110,6 +110,9 @@ int ObExprSleep::eval_sleep(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res)
|
|||||||
if (OB_FAIL(expr.eval_param_value(ctx, sec))) {
|
if (OB_FAIL(expr.eval_param_value(ctx, sec))) {
|
||||||
LOG_WARN("eval arg failed", K(ret));
|
LOG_WARN("eval arg failed", K(ret));
|
||||||
} else if (sec->is_null()) {
|
} else if (sec->is_null()) {
|
||||||
|
ret = OB_INVALID_ARGUMENT;
|
||||||
|
LOG_USER_ERROR(OB_INVALID_ARGUMENT, "sleep");
|
||||||
|
LOG_WARN("invalid arguments to sleep");
|
||||||
} else if (OB_FAIL(get_usec(number::ObNumber(sec->get_number()), usec, calc_alloc))) {
|
} else if (OB_FAIL(get_usec(number::ObNumber(sec->get_number()), usec, calc_alloc))) {
|
||||||
ret = OB_SUCCESS;
|
ret = OB_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -2548,9 +2548,9 @@ int ObRawExprResolverImpl::process_datatype_or_questionmark(const ParseNode &nod
|
|||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("context param list is null", K(ret));
|
LOG_WARN("context param list is null", K(ret));
|
||||||
} else if (val.get_unknown() >= ctx_.param_list_->count()) {
|
} else if (val.get_unknown() >= ctx_.param_list_->count()) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_BIND_VARIABLE_NOT_EXIST;
|
||||||
LOG_WARN("question mark index out of param list count",
|
LOG_WARN("bind variable does not exist",
|
||||||
"index", val.get_unknown(), "param_count", ctx_.param_list_->count());
|
K(ret), K(val.get_unknown()), K(ctx_.param_list_->count()));
|
||||||
} else {
|
} else {
|
||||||
const ObObjParam ¶m = ctx_.param_list_->at(val.get_unknown());
|
const ObObjParam ¶m = ctx_.param_list_->at(val.get_unknown());
|
||||||
c_expr->set_is_literal_bool(param.is_boolean());
|
c_expr->set_is_literal_bool(param.is_boolean());
|
||||||
|
|||||||
Reference in New Issue
Block a user