fix issue<46240158><46141201><46115703><46107852>:record error information to warning buf
This commit is contained in:
@ -35,4 +35,5 @@ static const int32_t OB_PARSER_ERR_NO_ATTR_FOUND = -9650;
|
||||
static const int32_t OB_PARSER_ERR_NON_INT_LITERAL = -9605;
|
||||
static const int32_t OB_PARSER_ERR_NUMERIC_OR_VALUE_ERROR = -5677;
|
||||
static const int32_t OB_PARSER_ERR_NON_INTEGRAL_NUMERIC_LITERAL = -9670;
|
||||
static const int32_t OB_PARSER_ERR_UNDECLARED_VAR = -5543;
|
||||
#endif /*OCEANBASE_SQL_PARSER_PARSE_DEFINE_*/
|
||||
|
||||
@ -111,6 +111,16 @@ int add_alias_name(ParseNode *node, ParseResult *result, int end);
|
||||
return ERROR; \
|
||||
} while(0)
|
||||
|
||||
#define YYABORT_UNDECLARE_VAR \
|
||||
do { \
|
||||
if (OB_UNLIKELY(NULL == result)) { \
|
||||
(void)fprintf(stderr, "ERROR : result is NULL\n"); \
|
||||
} else if (0 == result->extra_errno_) { \
|
||||
result->extra_errno_ = OB_PARSER_ERR_UNDECLARED_VAR;\
|
||||
} else {/*do nothing*/} \
|
||||
YYABORT; \
|
||||
} while(0)
|
||||
|
||||
#define YYABORT_NOT_VALID_ROUTINE_NAME \
|
||||
do { \
|
||||
if (OB_UNLIKELY(NULL == result)) { \
|
||||
@ -386,7 +396,7 @@ do {
|
||||
} while (0)
|
||||
|
||||
//查找pl变量,并把该变量替换成:int形式
|
||||
#define lookup_pl_exec_symbol(node, result, start, end, is_trigger_new, is_add_alas_name) \
|
||||
#define lookup_pl_exec_symbol(node, result, start, end, is_trigger_new, is_add_alas_name, is_report_error) \
|
||||
do { \
|
||||
if (OB_UNLIKELY((NULL == node || NULL == result || NULL == node->str_value_))) { \
|
||||
yyerror(NULL, result, "invalid var node: %p\n", node); \
|
||||
@ -430,6 +440,8 @@ do {
|
||||
result->no_param_sql_[result->no_param_sql_len_++] = ':'; \
|
||||
result->no_param_sql_len_ += sprintf(result->no_param_sql_ + result->no_param_sql_len_, "%ld", idx); \
|
||||
store_pl_symbol(node, result->param_nodes_, result->tail_param_node_); \
|
||||
} else if (is_report_error) { \
|
||||
YYABORT_UNDECLARE_VAR; \
|
||||
} else { /*do nothing*/ } \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@ -753,7 +753,7 @@ column_name
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_COLUMN_REF, 3, NULL, NULL, $1);
|
||||
dup_node_string($1, $$, result->malloc_pool_);
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false, false);
|
||||
#endif
|
||||
}
|
||||
| relation_name '.' column_name
|
||||
@ -763,7 +763,7 @@ column_name
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
if (3 == $1->str_len_) {
|
||||
if (0 == strcasecmp("NEW", $1->str_value_) || 0 == strcasecmp("OLD", $1->str_value_)) {
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @3.last_column, true, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @3.last_column, true, false, false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -848,7 +848,7 @@ column_name
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_COLUMN_REF, 3, NULL, NULL, col_name);
|
||||
dup_node_string(col_name, $$, result->malloc_pool_);
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false, false);
|
||||
#endif
|
||||
} else {
|
||||
yyerror(&@1, result, "force key work can be used to be name in PL\n");
|
||||
@ -862,7 +862,7 @@ column_name
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_COLUMN_REF, 3, NULL, NULL, col_name);
|
||||
dup_node_string(col_name, $$, result->malloc_pool_);
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false, false);
|
||||
#endif
|
||||
} else {
|
||||
yyerror(&@1, result, "cascade key work can be used to be name in PL\n");
|
||||
@ -9085,7 +9085,7 @@ expr %prec LOWER_PARENS
|
||||
NULL != $1->children_[2] && T_STAR == $1->children_[2]->type_) {
|
||||
/* do nothing */
|
||||
} else {
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, true);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, true, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -10578,7 +10578,7 @@ INTNUM
|
||||
$$ = $1;
|
||||
if (result->pl_parse_info_.is_pl_parse_) {
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false, false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -10683,7 +10683,7 @@ column_name
|
||||
$$ = $1;
|
||||
if (result->pl_parse_info_.is_pl_parse_) {
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @1.last_column, false, false, true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -15733,7 +15733,7 @@ new_or_old_column_ref:
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_COLUMN_REF, 3, NULL, $1, $3);
|
||||
dup_node_string($3, $$, result->malloc_pool_);
|
||||
#ifndef SQL_PARSER_COMPILATION
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @3.last_column, true, false);
|
||||
lookup_pl_exec_symbol($$, result, @1.first_column, @3.last_column, true, false, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user