[scn] mv definition of SCN to dir of share

This commit is contained in:
obdev
2022-11-28 02:50:55 +00:00
committed by ob-robot
parent 68151eb87a
commit 99d4f56fec
716 changed files with 7746 additions and 6117 deletions

View File

@ -2083,49 +2083,11 @@ int ObSysVarOnCheckFuncs::check_and_convert_time_zone(ObExecContext &ctx,
common::ObObj &out_val)
{
int ret = OB_SUCCESS;
UNUSED(sys_var);
UNUSED(ctx);
UNUSED(set_var);
int32_t sec_val = 0;
int ret_more = OB_SUCCESS;
bool check_timezone_valid = false;
bool is_oralce_mode = false;
ObSQLSessionInfo *session = ctx.get_my_session();
if (OB_ISNULL(session)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("fail to get session info", K(ret), K(session));
} else {
is_oralce_mode = is_oracle_compatible(session->get_sql_mode());
ObString str = in_val.get_string();
if (OB_ISNULL(str.ptr()) || OB_UNLIKELY(str.length() <= 0)) {
ret = OB_ERR_UNKNOWN_TIME_ZONE;
LOG_WARN("invalid time zone offset", K(ret), K(str));
} else {
if (OB_FAIL(ObTimeConverter::str_to_offset(str, sec_val, ret_more, is_oralce_mode, check_timezone_valid))) {
if (ret != OB_ERR_UNKNOWN_TIME_ZONE) {
LOG_WARN("fail to convert time zone", K(sec_val), K(ret));
} else {
ret = OB_SUCCESS;
}
} else {
int64_t pos = 0;
const int64_t buf_len = 16;
char *tmp_buf = reinterpret_cast<char*>(ctx.get_allocator().alloc(buf_len));
if(OB_ISNULL(tmp_buf)) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("fail to allocate memory", K(ret), K(tmp_buf));
} else {
int32_t offset_min = static_cast<int32_t>(SEC_TO_MIN(sec_val));
const char *fmt_str = (offset_min < 0 ? "-%02d:%02d" : "+%02d:%02d");
if (OB_FAIL(databuff_printf(tmp_buf, buf_len, pos, fmt_str, abs(offset_min) / 60, abs(offset_min) % 60))) {
LOG_ERROR("fail to print offset_min information to tmp_buf", K(ret), K(tmp_buf), K(offset_min));
} else {
out_val.set_varchar(tmp_buf, pos);
}
}
}
}
}
UNUSED(sys_var);
UNUSED(in_val);
UNUSED(out_val);
return ret;
}