[fix] json not strict mode insert

This commit is contained in:
xj0
2022-02-28 20:16:09 +08:00
committed by LINxiansheng
parent 0b3eff2515
commit c856bc403e
2 changed files with 7 additions and 1 deletions

View File

@ -1423,7 +1423,9 @@ DEF_TEXT_FUNCS(ObLongTextType, string, ObString);
uint64_t hash_res = 0; \ uint64_t hash_res = 0; \
ObJsonBin j_bin(j_bin_str.ptr(), j_bin_str.length()); \ ObJsonBin j_bin(j_bin_str.ptr(), j_bin_str.length()); \
ObIJsonBase *j_base = &j_bin; \ ObIJsonBase *j_base = &j_bin; \
if (OB_FAIL(j_bin.reset_iter())) { \ if (j_bin_str.length() ==0 || param.is_null()) { \
hash_res = hash; \
} else if (OB_FAIL(j_bin.reset_iter())) { \
COMMON_LOG(WARN, "fail to reset json bin iter", K(ret), K(j_bin_str)); \ COMMON_LOG(WARN, "fail to reset json bin iter", K(ret), K(j_bin_str)); \
right_to_die_or_duty_to_live(); \ right_to_die_or_duty_to_live(); \
} else if (OB_FAIL(j_base->calc_json_hash_value(hash, T::hash, hash_res))) { \ } else if (OB_FAIL(j_base->calc_json_hash_value(hash, T::hash, hash_res))) { \

View File

@ -996,6 +996,10 @@ int ObMySQLUtil::json_cell_str(char *buf, const int64_t len, const ObString &val
if (OB_ISNULL(buf)) { if (OB_ISNULL(buf)) {
ret = OB_INVALID_ARGUMENT; ret = OB_INVALID_ARGUMENT;
OB_LOG(WARN, "invalid input args", K(ret), KP(buf)); OB_LOG(WARN, "invalid input args", K(ret), KP(buf));
} else if (val.length() == 0) {
if (OB_FAIL(ObMySQLUtil::store_null(buf, len, pos))) {
OB_LOG(WARN, "fail to set null string", K(pos), K(len));
}
} else if (OB_FAIL(j_bin.reset_iter())) { } else if (OB_FAIL(j_bin.reset_iter())) {
OB_LOG(WARN, "fail to reset json bin iter", K(ret), K(val)); OB_LOG(WARN, "fail to reset json bin iter", K(ret), K(val));
} else if (OB_FAIL(j_base->print(jbuf, true))) { } else if (OB_FAIL(j_base->print(jbuf, true))) {