Time hours convert to days and hours in prepare statement

This commit is contained in:
obdev
2023-04-14 02:41:29 +00:00
committed by ob-robot
parent d0d70a2f27
commit 6cb6adfa7e

View File

@ -675,13 +675,15 @@ int ObMySQLUtil::time_cell_str(
LOG_WARN("convert usec to timestamp failed", K(ret)); LOG_WARN("convert usec to timestamp failed", K(ret));
} else { } else {
timelen = 12; timelen = 12;
int ob_time_day = ob_time.parts_[DT_DATE] + ob_time.parts_[DT_HOUR] / 24;
int ob_time_hour = ob_time.parts_[DT_HOUR] % 24;
if (OB_FAIL(ObMySQLUtil::store_int1(buf, len, timelen, pos))) {//length if (OB_FAIL(ObMySQLUtil::store_int1(buf, len, timelen, pos))) {//length
LOG_WARN("fail to store int", K(ret)); LOG_WARN("fail to store int", K(ret));
} else if (OB_FAIL(ObMySQLUtil::store_int1(buf, len, static_cast<int8_t>(DT_MODE_NEG & ob_time.mode_), pos))) {//is_negative(1) } else if (OB_FAIL(ObMySQLUtil::store_int1(buf, len, static_cast<int8_t>(DT_MODE_NEG & ob_time.mode_), pos))) {//is_negative(1)
LOG_WARN("fail to store int", K(ret)); LOG_WARN("fail to store int", K(ret));
} else if (OB_FAIL(ObMySQLUtil::store_int4(buf, len, static_cast<int32_t>(ob_time.parts_[DT_DATE]), pos))) {//days(4) } else if (OB_FAIL(ObMySQLUtil::store_int4(buf, len, static_cast<int32_t>(ob_time_day), pos))) {//days(4)
LOG_WARN("fail to store int", K(ret)); LOG_WARN("fail to store int", K(ret));
} else if (OB_FAIL(ObMySQLUtil::store_int1(buf, len, static_cast<int8_t>(ob_time.parts_[DT_HOUR]), pos))) {//hour(1) } else if (OB_FAIL(ObMySQLUtil::store_int1(buf, len, static_cast<int8_t>(ob_time_hour), pos))) {//hour(1)
LOG_WARN("fail to store int", K(ret)); LOG_WARN("fail to store int", K(ret));
} else if (OB_FAIL(ObMySQLUtil::store_int1(buf, len, static_cast<int8_t>(ob_time.parts_[DT_MIN]), pos))) {//minute(1) } else if (OB_FAIL(ObMySQLUtil::store_int1(buf, len, static_cast<int8_t>(ob_time.parts_[DT_MIN]), pos))) {//minute(1)
LOG_WARN("fail to store int", K(ret)); LOG_WARN("fail to store int", K(ret));