Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
The drop_routine has two copies in sql_yacc.yy:
- for sql_mode=DEFAULT
- for sql_mode=ORACLE
drop_routine:
|
DROP FUNCTION_SYM opt_if_exists ident '.' ident |
{
|
if (Lex->stmt_drop_function($3, $4, $6)) |
MYSQL_YYABORT;
|
}
|
| DROP FUNCTION_SYM opt_if_exists ident
|
{
|
if (Lex->stmt_drop_function($3, $4)) |
MYSQL_YYABORT;
|
}
|
| DROP PROCEDURE_SYM opt_if_exists sp_name
|
{
|
if (Lex->stmt_drop_procedure($3, $4)) |
MYSQL_YYABORT;
|
}
|
;
|
drop_routine:
|
DROP FUNCTION_SYM opt_if_exists ident '.' ident |
{
|
if (Lex->stmt_drop_function($3, $4, $6)) |
MYSQL_YYABORT;
|
}
|
| DROP FUNCTION_SYM opt_if_exists ident
|
{
|
if (Lex->stmt_drop_function($3, $4)) |
MYSQL_YYABORT;
|
}
|
| DROP PROCEDURE_SYM opt_if_exists sp_name
|
{
|
if (Lex->stmt_drop_procedure($3, $4)) |
MYSQL_YYABORT;
|
}
|
| DROP PACKAGE_ORACLE_SYM opt_if_exists sp_name
|
{
|
LEX *lex= Lex;
|
lex->set_command(SQLCOM_DROP_PACKAGE, $3);
|
if (unlikely(lex->sphead)) |
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PACKAGE")); |
lex->spname= $4;
|
}
|
| DROP PACKAGE_ORACLE_SYM BODY_ORACLE_SYM opt_if_exists sp_name
|
{
|
LEX *lex= Lex;
|
lex->set_command(SQLCOM_DROP_PACKAGE_BODY, $4);
|
if (unlikely(lex->sphead)) |
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PACKAGE BODY")); |
lex->spname= $5;
|
}
|
;
|
It's not necessary two have two copies. The grammar can be unified to a simple rule used for both sql_mode=DEFAULT and sql_mode=ORACLE:
drop_routine:
|
DROP sp_handler opt_if_exists ident '.' ident |
{
|
if (Lex->stmt_drop_routine($2, $3, $4, $6)) |
MYSQL_YYABORT;
|
}
|
| DROP sp_handler opt_if_exists ident
|
{
|
if (Lex->stmt_drop_routine($2, $3, Lex_ident_sys(), $4)) |
MYSQL_YYABORT;
|
}
|
;
|
where LEX::stmt_drop_routine() is a new method in LEX replacing these three methods:
bool stmt_drop_function(const DDL_options_st &options, |
const Lex_ident_sys_st &db, |
const Lex_ident_sys_st &name); |
|
bool stmt_drop_function(const DDL_options_st &options, |
const Lex_ident_sys_st &name); |
|
bool stmt_drop_procedure(const DDL_options_st &options, |
sp_name *name);
|
Unification can done with help of a new method in Sp_handler:
virtual enum_sql_command sqlcom_drop() const= 0; |
which will have the following overrides for Sp_handler descendants:
enum_sql_command sqlcom_drop() const { return SQLCOM_DROP_PROCEDURE; } |
enum_sql_command sqlcom_drop() const { return SQLCOM_DROP_FUNCTION; } |
enum_sql_command sqlcom_drop() const { return SQLCOM_DROP_PACKAGE; } |
enum_sql_command sqlcom_drop() const { return SQLCOM_DROP_PACKAGE_BODY; } |
Attachments
Issue Links
- blocks
-
MDEV-32101 CREATE PACKAGE [BODY] for sql_mode=DEFAULT
- Closed