Commit edfdf0d0 authored by Alexander Barkov's avatar Alexander Barkov

A cleanup for MDEV-13415 Wrap the code in sp.cc into a class Sp_handler

Fixing mysql_execute_command() and store_schema_proc() not to use
stored object type codes TYPE_ENUM_PROCEDURE and TYPE_ENUM_FUNCTION.
Using pointers to Sp_handler instead, to make the code symmetric across
existing (function,procedure) and future (e.g package) SP object types.
parent 211f9eea
......@@ -5405,11 +5405,10 @@ mysql_execute_command(THD *thd)
}
if (first_table)
{
if (lex->type == TYPE_ENUM_PROCEDURE ||
lex->type == TYPE_ENUM_FUNCTION)
const Sp_handler *sph= Sp_handler::handler((stored_procedure_type)
lex->type);
if (sph)
{
const Sp_handler *sph= Sp_handler::handler((stored_procedure_type)
lex->type);
uint grants= lex->all_privileges
? (PROC_ACLS & ~GRANT_ACL) | (lex->grant & GRANT_ACL)
: lex->grant;
......
......@@ -6031,10 +6031,7 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
check_some_routine_access(thd, db.str, name.str, sph))
return 0;
if ((lex->sql_command == SQLCOM_SHOW_STATUS_PROC &&
sph->type() == TYPE_ENUM_PROCEDURE) ||
(lex->sql_command == SQLCOM_SHOW_STATUS_FUNC &&
sph->type() == TYPE_ENUM_FUNCTION) ||
if (sph == Sp_handler::handler(lex->sql_command)||
(sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0)
{
restore_record(table, s->default_values);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment