Process a drop routine statement: DROP {FUNCTION|PROCEDURE|PACKAGE|PACKAGE BODY} [IF NOT EXISTS ] [db.]name; @param sph - The stored routine @param options - The IF EXISTS clause @param db - The database name. It can be {NULL,0}, which means the routine name is not qualified with the database name. @param name - The routine name
| 13124 | @returns - false ok success, true on error. |
| 13125 | */ |
| 13126 | bool LEX::stmt_drop_routine(const Sp_handler *sph, |
| 13127 | const DDL_options_st &options, |
| 13128 | const Lex_ident_sys_st &db, |
| 13129 | const Lex_ident_sys_st &name) |
| 13130 | { |
| 13131 | DBUG_ASSERT(name.str); |
| 13132 | if (unlikely(sphead)) |
| 13133 | { |
| 13134 | my_error(ER_SP_NO_DROP_SP, MYF(0), sph->type_lex_cstring().str); |
| 13135 | return true; |
| 13136 | } |
| 13137 | if (Lex_ident_routine::check_name_with_error(name)) |
| 13138 | return true; |
| 13139 | enum_sql_command sqlcom= sph->sqlcom_drop(); |
| 13140 | Lex_ident_db_normalized dbn; |
| 13141 | if (db.str) |
| 13142 | { |
| 13143 | // An explicit database name is given |
| 13144 | if (!(dbn= thd->to_ident_db_normalized_with_error(db)).str) |
| 13145 | return true; |
| 13146 | } |
| 13147 | else if (thd->db.str || sqlcom != SQLCOM_DROP_FUNCTION) |
| 13148 | { |
| 13149 | /* |
| 13150 | There is no an explicit database name in the DROP statement. |
| 13151 | Two cases are possible: |
| 13152 | a. The current database is not NULL. |
| 13153 | b. The current database is NULL and the command is either of these: |
| 13154 | - DROP PACKAGE |
| 13155 | - DROP PACKAGE BODY |
| 13156 | - DROP PROCEDURE |
| 13157 | copy_db_normalized() raises ER_NO_DB_ERROR. |
| 13158 | */ |
| 13159 | if (!(dbn= copy_db_normalized()).str) |
| 13160 | return true; |
| 13161 | } |
| 13162 | else |
| 13163 | { |
| 13164 | /* |
| 13165 | This is a "DROP FUNCTION name" statement. |
| 13166 | There is no an explicit database name given. |
| 13167 | The current database is not set. |
| 13168 | It can still be a valid DROP FUNCTION - for an UDF. |
| 13169 | Keep dbn=={NULL,0}. |
| 13170 | */ |
| 13171 | } |
| 13172 | set_command(sqlcom, options); |
| 13173 | spname= new (thd->mem_root) sp_name(dbn, name, db.str != NULL); |
| 13174 | return false; |
| 13175 | } |
| 13176 | |
| 13177 | |
| 13178 | bool LEX::stmt_alter_function_start(sp_name *name) |
nothing calls this directly
no test coverage detected