summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <pem@mysql.comhem.se>2004-10-22 19:05:17 +0200
committerunknown <pem@mysql.comhem.se>2004-10-22 19:05:17 +0200
commit35588c9dd0aef7db1c89731b0c4899b41576df9c (patch)
treebcc3c64a109a454f469b5e05f9f3ada2bdc7158d /sql
parentb24dd9336681880dc72f27fc346a2e1e9775d394 (diff)
downloadmariadb-git-35588c9dd0aef7db1c89731b0c4899b41576df9c.tar.gz
Fixed BUG#6027: Stored procedures can be renamed.
Removed the support for renaming SPs. It's non-standard, conflicted with a standard syntax, and was a bit broken anyway. mysql-test/r/sp-error.result: Removed test for renaming procedures with alter. mysql-test/r/sp.result: Removed test for renaming procedures with alter. mysql-test/t/sp-error.test: Removed test for renaming procedures with alter. mysql-test/t/sp.test: Removed test for renaming procedures with alter. sql/sp.cc: Removed support for renaming SPs. It's non-standard, conflicted with a standard syntax, and was a bit broken anyway. sql/sp.h: Removed support for renaming SPs. It's non-standard, conflicted with a standard syntax, and was a bit broken anyway. sql/sql_parse.cc: Removed support for renaming SPs. It's non-standard, conflicted with a standard syntax, and was a bit broken anyway. sql/sql_yacc.yy: Removed support for renaming SPs. It's non-standard, conflicted with a standard syntax, and was a bit broken anyway.
Diffstat (limited to 'sql')
-rw-r--r--sql/sp.cc22
-rw-r--r--sql/sp.h8
-rw-r--r--sql/sql_parse.cc14
-rw-r--r--sql/sql_yacc.yy12
4 files changed, 11 insertions, 45 deletions
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);
diff --git a/sql/sp.h b/sql/sp.h
index 783de2fe7ee..acdfe824b97 100644
--- a/sql/sp.h
+++ b/sql/sp.h
@@ -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
{