[xml bugfix] xmlattributes parameter err info tips fix

This commit is contained in:
obdev 2023-07-14 10:42:06 +00:00 committed by ob-robot
parent 8adcff8a8d
commit ac80c1f662
4 changed files with 16 additions and 7 deletions

View File

@ -20787,11 +20787,11 @@ static const _error _error_OB_ERR_XMLELEMENT_ALIASED = {
.error_solution = "Contact OceanBase Support",
.mysql_errno = -1,
.sqlstate = "42000",
.str_error = "parameter 1 of function XMLELEMENT must be aliased",
.str_user_error = "parameter 1 of function XMLELEMENT must be aliased",
.str_error = "parameter %d of function XMLELEMENT must be aliased",
.str_user_error = "parameter %d of function XMLELEMENT must be aliased",
.oracle_errno = 19208,
.oracle_str_error = "ORA-19208: parameter 1 of function XMLELEMENT must be aliased",
.oracle_str_user_error = "ORA-19208: parameter 1 of function XMLELEMENT must be aliased"
.oracle_str_error = "ORA-19208: parameter %d of function XMLELEMENT must be aliased",
.oracle_str_user_error = "ORA-19208: parameter %d of function XMLELEMENT must be aliased"
};
static const _error _error_OB_INVALID_ALTERATIONG_DATATYPE = {
.error_name = "OB_INVALID_ALTERATIONG_DATATYPE",

View File

@ -1899,7 +1899,7 @@ DEFINE_ORACLE_ERROR(OB_XPATH_EXPRESSION_UNSUPPORTED, -7409, -1, "42000", "Given
DEFINE_ORACLE_ERROR(OB_EXTRACTVALUE_NOT_LEAF_NODE, -7410, -1, "42000", "EXTRACTVALUE can only retrieve value of leaf node", 19026, "EXTRACTVALUE can only retrieve value of leaf node");
DEFINE_ORACLE_ERROR(OB_XML_INSERT_FRAGMENT, -7411, -1, "42000", "Cannot insert XML fragments", 19010, "Cannot insert XML fragments");
DEFINE_ORACLE_ERROR(OB_ERR_NO_ORDER_MAP_SQL, -7412, -1, "42000", "cannot ORDER objects without MAP or ORDER method", 22950, "cannot ORDER objects without MAP or ORDER method");
DEFINE_ORACLE_ERROR(OB_ERR_XMLELEMENT_ALIASED, -7413, -1, "42000", "parameter 1 of function XMLELEMENT must be aliased", 19208, "parameter 1 of function XMLELEMENT must be aliased");
DEFINE_ORACLE_ERROR(OB_ERR_XMLELEMENT_ALIASED, -7413, -1, "42000", "parameter %d of function XMLELEMENT must be aliased", 19208, "parameter %d of function XMLELEMENT must be aliased");
DEFINE_ORACLE_ERROR(OB_INVALID_ALTERATIONG_DATATYPE, -7414, -1, "42000", "invalid alteration of datatype", 22858, "invalid alteration of datatype");
DEFINE_ORACLE_ERROR(OB_INVALID_MODIFICATION_OF_COLUMNS, -7415, -1, "42000", "invalid modification of columns", 22859, "invalid modification of columns");
DEFINE_ORACLE_ERROR(OB_ERR_NULL_FOR_XML_CONSTRUCTOR, -7416, -1, "42000", "Expected XML tag , got no content", 19032, "Expected XML tag , got no content");

View File

@ -3492,7 +3492,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_EXTRACTVALUE_NOT_LEAF_NODE__USER_ERROR_MSG "EXTRACTVALUE can only retrieve value of leaf node"
#define OB_XML_INSERT_FRAGMENT__USER_ERROR_MSG "Cannot insert XML fragments"
#define OB_ERR_NO_ORDER_MAP_SQL__USER_ERROR_MSG "cannot ORDER objects without MAP or ORDER method"
#define OB_ERR_XMLELEMENT_ALIASED__USER_ERROR_MSG "parameter 1 of function XMLELEMENT must be aliased"
#define OB_ERR_XMLELEMENT_ALIASED__USER_ERROR_MSG "parameter %d of function XMLELEMENT must be aliased"
#define OB_INVALID_ALTERATIONG_DATATYPE__USER_ERROR_MSG "invalid alteration of datatype"
#define OB_INVALID_MODIFICATION_OF_COLUMNS__USER_ERROR_MSG "invalid modification of columns"
#define OB_ERR_NULL_FOR_XML_CONSTRUCTOR__USER_ERROR_MSG "Expected XML tag , got no content"
@ -5590,7 +5590,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_EXTRACTVALUE_NOT_LEAF_NODE__ORA_USER_ERROR_MSG "ORA-19026: EXTRACTVALUE can only retrieve value of leaf node"
#define OB_XML_INSERT_FRAGMENT__ORA_USER_ERROR_MSG "ORA-19010: Cannot insert XML fragments"
#define OB_ERR_NO_ORDER_MAP_SQL__ORA_USER_ERROR_MSG "ORA-22950: cannot ORDER objects without MAP or ORDER method"
#define OB_ERR_XMLELEMENT_ALIASED__ORA_USER_ERROR_MSG "ORA-19208: parameter 1 of function XMLELEMENT must be aliased"
#define OB_ERR_XMLELEMENT_ALIASED__ORA_USER_ERROR_MSG "ORA-19208: parameter %d of function XMLELEMENT must be aliased"
#define OB_INVALID_ALTERATIONG_DATATYPE__ORA_USER_ERROR_MSG "ORA-22858: invalid alteration of datatype"
#define OB_INVALID_MODIFICATION_OF_COLUMNS__ORA_USER_ERROR_MSG "ORA-22859: invalid modification of columns"
#define OB_ERR_NULL_FOR_XML_CONSTRUCTOR__ORA_USER_ERROR_MSG "ORA-19032: Expected XML tag , got no content"

View File

@ -1353,12 +1353,17 @@ int ObRawExprResolverImpl::process_xml_attributes_node(const ParseNode *node, Ob
ret = OB_ERR_UNEXPECTED;
LOG_WARN("num child invalid", K(ret), K(node_ptr->num_child_));
} else {
int attributes_count = 0;
do {
ObRawExpr *para_expr = NULL;
if (T_LINK_NODE != node_ptr->type_) {
++attributes_count;
const ParseNode *expr_node = node_ptr;
CK (OB_NOT_NULL(expr_node));
OZ(recursive_resolve(expr_node, para_expr));
if (OB_ERR_XMLELEMENT_ALIASED == ret) {
LOG_USER_ERROR(OB_ERR_XMLELEMENT_ALIASED, attributes_count);
}
CK(OB_NOT_NULL(para_expr));
for (int i = 0; OB_SUCC(ret) && i < para_expr->get_param_count(); i++) {
OZ(func_expr->add_param_expr(para_expr->get_param_expr(i)));
@ -1366,9 +1371,13 @@ int ObRawExprResolverImpl::process_xml_attributes_node(const ParseNode *node, Ob
break;
} else if (T_LINK_NODE == node_ptr->type_ &&
node_ptr->children_[0]->num_child_ == 2) {
++attributes_count;
const ParseNode *expr_node = node_ptr->children_[0];
CK (OB_NOT_NULL(expr_node));
OZ(recursive_resolve(expr_node, para_expr));
if (OB_ERR_XMLELEMENT_ALIASED == ret) {
LOG_USER_ERROR(OB_ERR_XMLELEMENT_ALIASED, attributes_count);
}
CK(OB_NOT_NULL(para_expr));
node_ptr = node_ptr->children_[1];
for (int i = 0; OB_SUCC(ret) && i < para_expr->get_param_count(); i++) {