[Json] json patch from 3.2.2 branch since 2021.12

This commit is contained in:
xj0
2022-02-16 17:34:14 +08:00
committed by LINxiansheng
parent 63edf11b9a
commit bb573a7cd4
47 changed files with 947 additions and 682 deletions

View File

@ -122,20 +122,12 @@ int ObExprJsonSet::calc_resultN(common::ObObj &result,
} else if (is_null_result) {
result.set_null();
} else {
ObString str;
if (OB_FAIL(json_doc->get_raw_binary(str, allocator))) {
ObString raw_bin;
if (OB_FAIL(json_doc->get_raw_binary(raw_bin, allocator))) {
LOG_WARN("json_set result to binary failed", K(ret));
} else {
uint64_t length = str.length();
char *buf = reinterpret_cast<char *>(allocator->alloc(length));
if (OB_ISNULL(buf)) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("fail to alloc memory for json set result", K(ret), K(length));
} else {
MEMCPY(buf, str.ptr(), length);
result.set_string(ObJsonType, buf, length);
result.set_collation_type(CS_TYPE_UTF8MB4_BIN);
}
result.set_collation_type(CS_TYPE_UTF8MB4_BIN);
result.set_string(ObJsonType, raw_bin.ptr(), raw_bin.length());
}
}
return ret;