1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Fixed that when using a trigger mysql.proc is now accessed

Cleanup:  Changed procedure type from a int/char to an enum for easier to manage and debug code.

mysql-test/r/trigger.result:
  Test that mysql.proc is not used as part of creating or using a trigger.
mysql-test/t/trigger.test:
  Test that mysql.proc is not used as part of creating or using a trigger.
sql/sp.cc:
  The main bug fix is to not look up triggers in mysql.proc; This is done by ignoreing type == TYPE_ENUM_TRIGGER in sp_add_used_routine()
  Cleanup:  Changed procedure type from a int/char to an enum.
sql/sp.h:
  Cleanup:  Changed procedure type from a int/char to an enum.
sql/sp_head.h:
  Cleanup:  Changed procedure type from a int/char to an enum.
sql/sql_db.cc:
  Fix include order
sql/sql_lex.cc:
  Fix include order
sql/sql_parse.cc:
  Cleanup:  Changed procedure type from a int/char to an enum.
sql/sql_show.cc:
  Fix include order
sql/sql_view.cc:
  Fix include order
This commit is contained in:
Michael Widenius
2011-10-06 16:56:59 +03:00
parent 5f607a2c70
commit 9c32088322
10 changed files with 107 additions and 45 deletions

View File

@ -4560,9 +4560,10 @@ create_sp_error:
*/
/* Conditionally writes to binlog */
int type= lex->sql_command == SQLCOM_ALTER_PROCEDURE ?
TYPE_ENUM_PROCEDURE :
TYPE_ENUM_FUNCTION;
stored_procedure_type type;
type= (lex->sql_command == SQLCOM_ALTER_PROCEDURE ?
TYPE_ENUM_PROCEDURE :
TYPE_ENUM_FUNCTION);
sp_result= sp_update_routine(thd,
type,
@ -4590,8 +4591,8 @@ create_sp_error:
case SQLCOM_DROP_FUNCTION:
{
int sp_result;
int type= (lex->sql_command == SQLCOM_DROP_PROCEDURE ?
TYPE_ENUM_PROCEDURE : TYPE_ENUM_FUNCTION);
stored_procedure_type type= (lex->sql_command == SQLCOM_DROP_PROCEDURE ?
TYPE_ENUM_PROCEDURE : TYPE_ENUM_FUNCTION);
sp_result= sp_routine_exists_in_table(thd, type, lex->spname);
mysql_reset_errors(thd, 0);
@ -4618,9 +4619,10 @@ create_sp_error:
#endif
/* Conditionally writes to binlog */
int type= lex->sql_command == SQLCOM_DROP_PROCEDURE ?
TYPE_ENUM_PROCEDURE :
TYPE_ENUM_FUNCTION;
stored_procedure_type type;
type= (lex->sql_command == SQLCOM_DROP_PROCEDURE ?
TYPE_ENUM_PROCEDURE :
TYPE_ENUM_FUNCTION);
sp_result= sp_drop_routine(thd, type, lex->spname);
}