| 6444 | */ |
| 6445 | |
| 6446 | static bool __attribute__ ((noinline)) |
| 6447 | alter_routine(THD *thd, LEX *lex) |
| 6448 | { |
| 6449 | int sp_result; |
| 6450 | const Sp_handler *sph= Sp_handler::handler(lex->sql_command); |
| 6451 | if (check_routine_access(thd, ALTER_PROC_ACL, &lex->spname->m_db, |
| 6452 | &lex->spname->m_name, sph, 0)) |
| 6453 | return 1; |
| 6454 | /* |
| 6455 | Note that if you implement the capability of ALTER FUNCTION to |
| 6456 | alter the body of the function, this command should be made to |
| 6457 | follow the restrictions that log-bin-trust-function-creators=0 |
| 6458 | already puts on CREATE FUNCTION. |
| 6459 | */ |
| 6460 | /* Conditionally writes to binlog */ |
| 6461 | sp_result= sph->sp_update_routine(thd, lex->spname, &lex->sp_chistics); |
| 6462 | switch (sp_result) { |
| 6463 | case SP_OK: |
| 6464 | my_ok(thd); |
| 6465 | return 0; |
| 6466 | case SP_KEY_NOT_FOUND: |
| 6467 | my_error(ER_SP_DOES_NOT_EXIST, MYF(0), |
| 6468 | sph->type_str(), ErrConvDQName(lex->spname).ptr()); |
| 6469 | return 1; |
| 6470 | default: |
| 6471 | my_error(ER_SP_CANT_ALTER, MYF(0), |
| 6472 | sph->type_str(), ErrConvDQName(lex->spname).ptr()); |
| 6473 | return 1; |
| 6474 | } |
| 6475 | return 0; /* purecov: deadcode */ |
| 6476 | } |
| 6477 | |
| 6478 | |
| 6479 | static bool __attribute__ ((noinline)) |
no test coverage detected