diff options
-rw-r--r-- | mysql-test/r/sp-error.result | 3 | ||||
-rw-r--r-- | mysql-test/r/sp.result | 20 | ||||
-rw-r--r-- | mysql-test/t/sp-error.test | 3 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 16 | ||||
-rw-r--r-- | sql/sp.cc | 22 | ||||
-rw-r--r-- | sql/sp.h | 8 | ||||
-rw-r--r-- | sql/sql_parse.cc | 14 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 12 |
8 files changed, 29 insertions, 69 deletions
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 0a679957e44..db6f89c8c0e 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -235,9 +235,6 @@ ERROR 24000: Cursor is not open drop procedure p| alter procedure bar3 sql security invoker| ERROR 42000: PROCEDURE test.bar3 does not exist -alter procedure bar3 name -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA| -ERROR 42000: Identifier name 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' is too long drop table t1| drop table if exists t1| create table t1 (val int, x float)| diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 3a3a72708a4..d19c3c5355e 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -893,15 +893,15 @@ select * from t1| id data chistics 1 delete from t1| -alter procedure chistics sql security invoker name chistics2| -show create procedure chistics2| +alter procedure chistics sql security invoker| +show create procedure chistics| Procedure sql_mode Create Procedure -chistics2 CREATE PROCEDURE `test`.`chistics2`() +chistics CREATE PROCEDURE `test`.`chistics`() MODIFIES SQL DATA SQL SECURITY INVOKER COMMENT 'Characteristics procedure test' insert into t1 values ("chistics", 1) -drop procedure chistics2| +drop procedure chistics| create function chistics() returns int language sql deterministic @@ -918,18 +918,18 @@ return 42 select chistics()| chistics() 42 -alter function chistics name chistics2 +alter function chistics no sql comment 'Characteristics function test'| -show create function chistics2| +show create function chistics| Function sql_mode Create Function -chistics2 CREATE FUNCTION `test`.`chistics2`() RETURNS int +chistics CREATE FUNCTION `test`.`chistics`() RETURNS int NO SQL DETERMINISTIC SQL SECURITY INVOKER COMMENT 'Characteristics function test' return 42 -drop function chistics2| +drop function chistics| insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3)| set @@sql_mode = 'ANSI'| create procedure modes(out c1 int, out c2 int) @@ -2136,8 +2136,8 @@ insert into test.t1 values (x, y)| show procedure status like 'bar'| Db Name Type Definer Modified Created Security_type Comment test bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER 111111111111 -alter procedure bar name bar2 comment "2222222222" sql security definer| -alter procedure bar2 name bar comment "3333333333"| +alter procedure bar comment "2222222222" sql security definer| +alter procedure bar comment "3333333333"| alter procedure bar| show create procedure bar| Procedure sql_mode Create Procedure diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 6970523ad31..73f2730b44c 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -307,9 +307,6 @@ drop procedure p| --error 1305 alter procedure bar3 sql security invoker| ---error 1059 -alter procedure bar3 name -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA| drop table t1| diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index c3c044a7808..386bd36827e 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -990,9 +990,9 @@ show create procedure chistics| call chistics()| select * from t1| delete from t1| -alter procedure chistics sql security invoker name chistics2| -show create procedure chistics2| -drop procedure chistics2| +alter procedure chistics sql security invoker| +show create procedure chistics| +drop procedure chistics| create function chistics() returns int language sql @@ -1004,11 +1004,11 @@ create function chistics() returns int show create function chistics| # Call it, just to make sure. select chistics()| -alter function chistics name chistics2 +alter function chistics no sql comment 'Characteristics function test'| -show create function chistics2| -drop function chistics2| +show create function chistics| +drop function chistics| # Check mode settings @@ -2268,8 +2268,8 @@ create procedure bar(x char(16), y int) insert into test.t1 values (x, y)| --replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00' show procedure status like 'bar'| -alter procedure bar name bar2 comment "2222222222" sql security definer| -alter procedure bar2 name bar comment "3333333333"| +alter procedure bar comment "2222222222" sql security definer| +alter procedure bar comment "3333333333"| alter procedure bar| show create procedure bar| --replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00' diff --git a/sql/sp.cc b/sql/sp.cc index 8211d06376c..f2a79dd2e20 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -442,9 +442,7 @@ db_drop_routine(THD *thd, int type, sp_name *name) static int -db_update_routine(THD *thd, int type, sp_name *name, - char *newname, uint newnamelen, - st_sp_chistics *chistics) +db_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) { TABLE *table; int ret; @@ -462,10 +460,6 @@ db_update_routine(THD *thd, int type, sp_name *name, if (chistics->suid != SP_IS_DEFAULT_SUID) table->field[MYSQL_PROC_FIELD_SECURITY_TYPE]-> store((longlong)chistics->suid); - if (newname) - table->field[MYSQL_PROC_FIELD_NAME]->store(newname, - newnamelen, - system_charset_info); if (chistics->daccess != SP_DEFAULT_ACCESS) table->field[MYSQL_PROC_FIELD_ACCESS]-> store((longlong)chistics->daccess); @@ -772,9 +766,7 @@ sp_drop_procedure(THD *thd, sp_name *name) int -sp_update_procedure(THD *thd, sp_name *name, - char *newname, uint newnamelen, - st_sp_chistics *chistics) +sp_update_procedure(THD *thd, sp_name *name, st_sp_chistics *chistics) { int ret; bool found; @@ -782,8 +774,7 @@ sp_update_procedure(THD *thd, sp_name *name, DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str)); found= sp_cache_remove(&thd->sp_proc_cache, name); - ret= db_update_routine(thd, TYPE_ENUM_PROCEDURE, name, - newname, newnamelen, chistics); + ret= db_update_routine(thd, TYPE_ENUM_PROCEDURE, name, chistics); if (!found && !ret) sp_cache_invalidate(); DBUG_RETURN(ret); @@ -870,9 +861,7 @@ sp_drop_function(THD *thd, sp_name *name) int -sp_update_function(THD *thd, sp_name *name, - char *newname, uint newnamelen, - st_sp_chistics *chistics) +sp_update_function(THD *thd, sp_name *name, st_sp_chistics *chistics) { int ret; bool found; @@ -880,8 +869,7 @@ sp_update_function(THD *thd, sp_name *name, DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str)); found= sp_cache_remove(&thd->sp_func_cache, name); - ret= db_update_routine(thd, TYPE_ENUM_FUNCTION, name, - newname, newnamelen, chistics); + ret= db_update_routine(thd, TYPE_ENUM_FUNCTION, name, chistics); if (!found && !ret) sp_cache_invalidate(); DBUG_RETURN(ret); @@ -44,9 +44,7 @@ sp_drop_procedure(THD *thd, sp_name *name); int -sp_update_procedure(THD *thd, sp_name *name, - char *newname, uint newnamelen, - st_sp_chistics *chistics); +sp_update_procedure(THD *thd, sp_name *name, st_sp_chistics *chistics); int sp_show_create_procedure(THD *thd, sp_name *name); @@ -64,9 +62,7 @@ int sp_drop_function(THD *thd, sp_name *name); int -sp_update_function(THD *thd, sp_name *name, - char *newname, uint newnamelen, - st_sp_chistics *chistics); +sp_update_function(THD *thd, sp_name *name, st_sp_chistics *chistics); int sp_show_create_function(THD *thd, sp_name *name); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 54a1240c0ab..f1d6603201e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3766,20 +3766,10 @@ purposes internal to the MySQL server", MYF(0)); case SQLCOM_ALTER_FUNCTION: { res= -1; - uint newname_len= 0; - if (lex->name) - newname_len= strlen(lex->name); - if (newname_len > NAME_LEN) - { - net_printf(thd, ER_TOO_LONG_IDENT, lex->name); - goto error; - } if (lex->sql_command == SQLCOM_ALTER_PROCEDURE) - res= sp_update_procedure(thd, lex->spname, - lex->name, newname_len, &lex->sp_chistics); + res= sp_update_procedure(thd, lex->spname, &lex->sp_chistics); else - res= sp_update_function(thd, lex->spname, - lex->name, newname_len, &lex->sp_chistics); + res= sp_update_function(thd, lex->spname, &lex->sp_chistics); switch (res) { case SP_OK: diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 6fb13684098..5caa3401fba 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -789,7 +789,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); opt_extended_describe prepare prepare_src execute deallocate statement sp_suid opt_view_list view_list or_replace algorithm - sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic sp_a_chistic + sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic END_OF_INPUT %type <NONE> call sp_proc_stmts sp_proc_stmt @@ -1371,7 +1371,7 @@ create_function_tail: sp_a_chistics: /* Empty */ {} - | sp_a_chistics sp_a_chistic {} + | sp_a_chistics sp_chistic {} ; sp_c_chistics: @@ -1397,12 +1397,6 @@ sp_chistic: { } ; -/* Alter characteristics */ -sp_a_chistic: - sp_chistic { } - | NAME_SYM ident { Lex->name= $2.str; } - ; - /* Create characteristics */ sp_c_chistic: sp_chistic { } @@ -3195,7 +3189,6 @@ alter: LEX *lex= Lex; bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); - lex->name= 0; } sp_a_chistics { @@ -3210,7 +3203,6 @@ alter: LEX *lex= Lex; bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); - lex->name= 0; } sp_a_chistics { |