cherry-pick bug fix in 3.1

This commit is contained in:
bf0
2021-07-21 23:46:35 +08:00
committed by wangzelin.wzl
parent d49f1baf7d
commit 7fb21bbbe7
23 changed files with 450 additions and 208 deletions

View File

@ -2397,5 +2397,21 @@ int ObStringScanner::next_character(ObString& encoding, int32_t& wchar)
return ret;
}
} // namespace common
} // namespace oceanbase
bool ObStringScanner::next_character(ObString &encoding, int32_t &wchar, int &ret)
{
bool has_next = false;
ret = next_character(encoding, wchar);
if (OB_ITER_END == ret) {
has_next = false;
ret = OB_SUCCESS;
} else if (OB_SUCC(ret)) {
has_next = true;
} else {
LOG_WARN("fail to get next character", K(ret), K(*this));
has_next = false;
}
return has_next;
}
} // namespace common
} // namespace oceanbase

View File

@ -93,6 +93,8 @@ private:
virtual ~ObCharset(){};
public:
static const int32_t MAX_MB_LEN = 5;
static const int32_t MIN_MB_LEN = 1;
static const int64_t CHARSET_WRAPPER_COUNT = 2;
static const int64_t COLLATION_WRAPPER_COUNT = 3;
@ -306,7 +308,8 @@ public:
ObStringScanner(const ObString& str, common::ObCollationType collation_type)
: str_(str), collation_type_(collation_type)
{}
int next_character(ObString& encoding, int32_t& wchar);
int next_character(ObString &encoding, int32_t &wchar);
bool next_character(ObString &encoding, int32_t &wchar, int &ret);
TO_STRING_KV(K_(str), K_(collation_type));
private:

View File

@ -3183,16 +3183,13 @@ int ObTimeConverter::str_to_ob_time_oracle_dfm(
// 2. set default value for ob_time
if (OB_SUCC(ret)) {
int64_t utc_curr_time = ObTimeUtility::current_time();
int64_t utc_curr_time_copy = utc_curr_time;
int32_t cur_date = 0;
if (OB_ISNULL(cvrt_ctx.tz_info_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("session timezone info is null", K(ret));
} else if (sub_timezone_offset(*(cvrt_ctx.tz_info_),
ObString(),
utc_curr_time,
session_tz_offset,
session_tz_id,
session_tran_type_id)) {
} else if (sub_timezone_offset(*(cvrt_ctx.tz_info_), ObString(),
utc_curr_time_copy, session_tz_offset, session_tz_id, session_tran_type_id)) {
LOG_WARN("get session timezone offset failed", K(ret));
} else if (OB_FAIL(datetime_to_date(utc_curr_time, cvrt_ctx.tz_info_, cur_date))) {
LOG_WARN("timestamp to date failed", K(ret));