[to #42036778] fix SIGNAL/RESIGNAL statements in SQL

This commit is contained in:
0xacc 2022-12-20 08:07:57 +00:00 committed by ob-robot
parent 47adcea9b8
commit 0003c2605b
3 changed files with 19 additions and 2 deletions

View File

@ -247,13 +247,24 @@ stmt_list:
stmt:
outer_stmt
{
if(NULL != $1 && T_SP_DO == $1->type_) {
if(NULL != $1 && !parse_ctx->is_inner_parse_) {
switch($1->type_) {
// wrap nodes of following types into an anonymous block to mock SQL execution.
case T_SP_DO:
case T_SP_SIGNAL:
case T_SP_RESIGNAL: {
ParseNode *proc_stmts = NULL;
merge_nodes(proc_stmts, parse_ctx->mem_pool_, T_SP_PROC_STMT_LIST, $1);
ParseNode *block_content = NULL;
merge_nodes(block_content, parse_ctx->mem_pool_, T_SP_BLOCK_CONTENT, proc_stmts);
malloc_non_terminal_node($1, parse_ctx->mem_pool_, T_SP_ANONYMOUS_BLOCK, 1, block_content);
} break;
default:{
// do nothing
} break;
}
}
$$ = $1;
int32_t str_len = @1.last_column - @1.first_column + 1;
$$->pos_ = @1.first_column;

View File

@ -369,6 +369,8 @@ ObParser::State ObParser::transform_normal(ObString &normal)
ELSIF(2, S_OF, "of")
ELSIF(11, S_EDITIONABLE, "editionable")
ELSIF(14, S_EDITIONABLE, "noneditionable")
ELSIF(6, S_SIGNAL, "signal")
ELSIF(8, S_RESIGNAL, "resignal")
ELSE()
if (S_INVALID == state
@ -400,7 +402,9 @@ ObParser::State ObParser::transform_normal(
case S_FUNCTION:
case S_PACKAGE:
case S_TRIGGER:
case S_TYPE: {
case S_TYPE:
case S_SIGNAL:
case S_RESIGNAL: {
is_pl = true;
} break;
case S_CALL: {

View File

@ -133,6 +133,8 @@ enum State {
S_DEFINER,
S_OF,
S_EDITIONABLE,
S_SIGNAL,
S_RESIGNAL,
S_EXPLAIN,
S_EXPLAIN_FORMAT,