summaryrefslogtreecommitdiff
path: root/sql/sp.cc
diff options
context:
space:
mode:
authorunknown <davi@endora.local>2008-02-07 16:14:39 -0200
committerunknown <davi@endora.local>2008-02-07 16:14:39 -0200
commit7b59d1e6c806bbbf2bf759ceaff462319f2942f4 (patch)
tree348f9cebc4bf73a1e63cc9f5a97c2b467935cbc6 /sql/sp.cc
parentdf75b2553ee242f7353fef54ec78d0533206a3d2 (diff)
parent1b6b7010a6b1bd6e7f79632c2738d7a1654078e4 (diff)
downloadmariadb-git-7b59d1e6c806bbbf2bf759ceaff462319f2942f4.tar.gz
Merge mysql.com:/Users/davi/mysql/bugs/32633-5.1
into mysql.com:/Users/davi/mysql/mysql-5.1-runtime sql/sp.cc: Auto merged
Diffstat (limited to 'sql/sp.cc')
-rw-r--r--sql/sp.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/sql/sp.cc b/sql/sp.cc
index 5514cf0ed5f..83995e9b753 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -388,7 +388,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
uint length;
char buff[65];
String str(buff, sizeof(buff), &my_charset_bin);
- ulong sql_mode;
+ ulong sql_mode, saved_mode= thd->variables.sql_mode;
Open_tables_state open_tables_state_backup;
Stored_program_creation_ctx *creation_ctx;
@@ -400,6 +400,9 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
if (!(table= open_proc_table_for_read(thd, &open_tables_state_backup)))
DBUG_RETURN(SP_OPEN_TABLE_FAILED);
+ /* Reset sql_mode during data dictionary operations. */
+ thd->variables.sql_mode= 0;
+
if ((ret= db_find_routine_aux(thd, type, name, table)) != SP_OK)
goto done;
@@ -503,6 +506,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
done:
if (table)
close_system_tables(thd, &open_tables_state_backup);
+ thd->variables.sql_mode= saved_mode;
DBUG_RETURN(ret);
}
@@ -703,6 +707,7 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
int ret;
TABLE *table;
char definer[USER_HOST_BUFF_SIZE];
+ ulong saved_mode= thd->variables.sql_mode;
CHARSET_INFO *db_cs= get_default_db_collation(thd, sp->m_db.str);
@@ -717,6 +722,9 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
DBUG_ASSERT(type == TYPE_ENUM_PROCEDURE ||
type == TYPE_ENUM_FUNCTION);
+ /* Reset sql_mode during data dictionary operations. */
+ thd->variables.sql_mode= 0;
+
/*
This statement will be replicated as a statement, even when using
row-based replication. The flag will be reset at the end of the
@@ -818,7 +826,7 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
store_failed= store_failed ||
table->field[MYSQL_PROC_FIELD_SQL_MODE]->
- store((longlong)thd->variables.sql_mode, TRUE);
+ store((longlong)saved_mode, TRUE);
if (sp->m_chistics->comment.str)
{
@@ -918,6 +926,7 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
done:
thd->count_cuted_fields= saved_count_cuted_fields;
+ thd->variables.sql_mode= saved_mode;
close_thread_tables(thd);
DBUG_RETURN(ret);