fix string type null value error in dblink.

This commit is contained in:
cqliang1995
2023-05-17 08:16:49 +00:00
committed by ob-robot
parent 3fdda9347e
commit 477943c609
3 changed files with 11 additions and 2 deletions

View File

@ -97,7 +97,11 @@ template <>
UNUSED(obj);
UNUSED(params);
int ret = OB_SUCCESS;
ret = databuff_printf(buffer, length, pos, "NULL");
if (params.print_null_string_value_) {
ret = databuff_printf(buffer, length, pos, "''");
} else {
ret = databuff_printf(buffer, length, pos, "NULL");
}
return ret;
}
template <>

View File

@ -1115,7 +1115,8 @@ struct ObObjPrintParams
uint32_t binary_string_print_hex_:1;
uint32_t need_print_converter_:1;
uint32_t print_const_expr_type_:1;
uint32_t reserved_:23;
uint32_t print_null_string_value_:1;
uint32_t reserved_:22;
};
};

View File

@ -240,6 +240,10 @@ int ObLinkOp::combine_link_stmt(const ObString &link_stmt_fmt,
int64_t param_idx = param_infos.at(next_param).idx_;
const ObObjParam &param = param_store.at(param_idx);
ObObjPrintParams obj_print_params = CREATE_OBJ_PRINT_PARAM(ctx_.get_my_session());
if (lib::is_oracle_mode() && ObSQLUtils::is_oracle_empty_string(param)) {
obj_print_params.print_null_string_value_ = true;
}
if (DBLINK_DRV_OCI == link_type_) {
// Ensure that when oceanbase connects to oracle,
// the target character set of param is the same as that of oci connection.