[CP] Remove extra space in sql_mode
This commit is contained in:
17
deps/oblib/src/lib/string/ob_string.h
vendored
17
deps/oblib/src/lib/string/ob_string.h
vendored
@ -425,6 +425,23 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
const ObString trim_space_only()
|
||||
{
|
||||
ObString ret;
|
||||
if (NULL != ptr_) {
|
||||
char *start = ptr_;
|
||||
char *end = ptr_ + data_length_;
|
||||
while (start < end && ' ' == *start) {
|
||||
start++;
|
||||
}
|
||||
while (start < end && ' ' == *(end - 1)) {
|
||||
end--;
|
||||
}
|
||||
ret.assign_ptr(start, static_cast<obstr_size_t>(end - start));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ObString make_string(const char* cstr)
|
||||
{
|
||||
return NULL == cstr ? ObString() : ObString(0, static_cast<obstr_size_t>(strlen(cstr)), const_cast<char*>(cstr));
|
||||
|
||||
@ -1457,11 +1457,12 @@ int ObSqlModeVar::do_check_and_convert(ObExecContext& ctx, const ObSetVar& set_v
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("unexpected type", K(ret), K(in_val));
|
||||
}
|
||||
ObString val_without_space = str_val.trim_space_only();
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(find_set(str_val))) {
|
||||
LOG_WARN("fail to find type", K(ret), K(str_val), K(in_val));
|
||||
} else if (OB_FAIL(ob_str_to_sql_mode(str_val, sql_mode))) {
|
||||
LOG_WARN("fail to convert str to sql mode", K(ret), K(str_val), K(in_val));
|
||||
} else if (OB_FAIL(find_set(val_without_space))) {
|
||||
LOG_WARN("fail to find type", K(ret), K(val_without_space), K(in_val));
|
||||
} else if (OB_FAIL(ob_str_to_sql_mode(val_without_space, sql_mode))) {
|
||||
LOG_WARN("fail to convert str to sql mode", K(ret), K(val_without_space), K(in_val));
|
||||
}
|
||||
} else if (ob_is_int_tc(in_val.get_type())) {
|
||||
int64_t int64_val = 0;
|
||||
|
||||
Reference in New Issue
Block a user