[to #42036778] fix SIGNAL/RESIGNAL statements in SQL
This commit is contained in:
@ -247,13 +247,24 @@ stmt_list:
|
|||||||
stmt:
|
stmt:
|
||||||
outer_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;
|
ParseNode *proc_stmts = NULL;
|
||||||
merge_nodes(proc_stmts, parse_ctx->mem_pool_, T_SP_PROC_STMT_LIST, $1);
|
merge_nodes(proc_stmts, parse_ctx->mem_pool_, T_SP_PROC_STMT_LIST, $1);
|
||||||
ParseNode *block_content = NULL;
|
ParseNode *block_content = NULL;
|
||||||
merge_nodes(block_content, parse_ctx->mem_pool_, T_SP_BLOCK_CONTENT, proc_stmts);
|
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);
|
malloc_non_terminal_node($1, parse_ctx->mem_pool_, T_SP_ANONYMOUS_BLOCK, 1, block_content);
|
||||||
|
} break;
|
||||||
|
default:{
|
||||||
|
// do nothing
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
int32_t str_len = @1.last_column - @1.first_column + 1;
|
int32_t str_len = @1.last_column - @1.first_column + 1;
|
||||||
$$->pos_ = @1.first_column;
|
$$->pos_ = @1.first_column;
|
||||||
|
|||||||
@ -369,6 +369,8 @@ ObParser::State ObParser::transform_normal(ObString &normal)
|
|||||||
ELSIF(2, S_OF, "of")
|
ELSIF(2, S_OF, "of")
|
||||||
ELSIF(11, S_EDITIONABLE, "editionable")
|
ELSIF(11, S_EDITIONABLE, "editionable")
|
||||||
ELSIF(14, S_EDITIONABLE, "noneditionable")
|
ELSIF(14, S_EDITIONABLE, "noneditionable")
|
||||||
|
ELSIF(6, S_SIGNAL, "signal")
|
||||||
|
ELSIF(8, S_RESIGNAL, "resignal")
|
||||||
ELSE()
|
ELSE()
|
||||||
|
|
||||||
if (S_INVALID == state
|
if (S_INVALID == state
|
||||||
@ -400,7 +402,9 @@ ObParser::State ObParser::transform_normal(
|
|||||||
case S_FUNCTION:
|
case S_FUNCTION:
|
||||||
case S_PACKAGE:
|
case S_PACKAGE:
|
||||||
case S_TRIGGER:
|
case S_TRIGGER:
|
||||||
case S_TYPE: {
|
case S_TYPE:
|
||||||
|
case S_SIGNAL:
|
||||||
|
case S_RESIGNAL: {
|
||||||
is_pl = true;
|
is_pl = true;
|
||||||
} break;
|
} break;
|
||||||
case S_CALL: {
|
case S_CALL: {
|
||||||
|
|||||||
@ -133,6 +133,8 @@ enum State {
|
|||||||
S_DEFINER,
|
S_DEFINER,
|
||||||
S_OF,
|
S_OF,
|
||||||
S_EDITIONABLE,
|
S_EDITIONABLE,
|
||||||
|
S_SIGNAL,
|
||||||
|
S_RESIGNAL,
|
||||||
|
|
||||||
S_EXPLAIN,
|
S_EXPLAIN,
|
||||||
S_EXPLAIN_FORMAT,
|
S_EXPLAIN_FORMAT,
|
||||||
|
|||||||
Reference in New Issue
Block a user