[CP] [xml bugfix] xml type partition table garbled characters

This commit is contained in:
Carrot-77
2023-11-09 14:20:45 +00:00
committed by ob-robot
parent 2e3be94f99
commit a475001ab5
2 changed files with 6 additions and 37 deletions

View File

@ -17,6 +17,9 @@
#include "io/easy_io.h"
#include "lib/oblog/ob_log.h"
#include "share/ob_lob_access_utils.h"
#ifdef OB_BUILD_ORACLE_XML
#include "sql/engine/expr/ob_expr_xml_func_helper.h"
#endif
namespace oceanbase{
using namespace common;
@ -561,39 +564,6 @@ int ObExprOutputPack::process_lob_locator_results(common::ObObj& value,
return ret;
}
int ObExprOutputPack::process_sql_udt_results(common::ObObj& value,
common::ObIAllocator &alloc,
const ObSQLSessionInfo &my_session)
{
int ret = OB_SUCCESS;
if (!value.is_xml_sql_type()) {
ret = OB_NOT_SUPPORTED;
OB_LOG(WARN, "not support udt type", K(ret), K(value.get_type()), K(value.get_udt_subschema_id()));
} else {
bool is_client_support_binary_xml = false; // client receive xml as json, like json
if (value.is_null() || value.is_nop_value()) {
// do nothing
} else if (is_client_support_binary_xml) {
// convert to udt client format
} else {
ObString data;
ObLobLocatorV2 loc(value.get_string(), true);
if (loc.is_null()) {
} else {
ObTextStringIter instr_iter(ObLongTextType, CS_TYPE_BINARY, value.get_string(), true);
if (OB_FAIL(instr_iter.init(0, &my_session, &alloc))) {
LOG_WARN("init lob str inter failed", K(ret), K(value));
} else if (OB_FAIL(instr_iter.get_full_data(data))) {
LOG_WARN("get xml full data failed", K(value));
} else {
value.set_udt_value(data.ptr(), data.length());
}
}
}
}
return ret;
}
int ObExprOutputPack::convert_string_charset(const common::ObString &in_str,
const ObCollationType in_cs_type,
const ObCollationType out_cs_type,
@ -678,8 +648,10 @@ int ObExprOutputPack::try_encode_row(const ObExpr &expr, ObEvalCtx &ctx,
} else if ((obj.is_lob() || obj.is_lob_locator() || obj.is_json())
&& OB_FAIL(process_lob_locator_results(obj, alloc, *session))) {
LOG_WARN("convert lob locator to longtext failed", K(ret));
} else if (obj.is_user_defined_sql_type() && OB_FAIL(process_sql_udt_results(obj, alloc, *session))) {
#ifdef OB_BUILD_ORACLE_XML
} else if (obj.is_user_defined_sql_type() && OB_FAIL(ObXMLExprHelper::process_sql_udt_results(obj, &alloc, session))) {
LOG_WARN("convert udt to client format failed", K(ret), K(obj.get_udt_subschema_id()));
#endif
}
}
}

View File

@ -74,9 +74,6 @@ private:
static int process_lob_locator_results(common::ObObj& value,
common::ObIAllocator &alloc,
const ObSQLSessionInfo &my_session);
static int process_sql_udt_results(common::ObObj& value,
common::ObIAllocator &alloc,
const ObSQLSessionInfo &my_session);
static int convert_string_charset(const common::ObString &in_str,
const ObCollationType in_cs_type,