summaryrefslogtreecommitdiff
path: root/sql/sql_udf.cc
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2010-01-30 23:09:31 +0300
committerAlexander Nozdrin <alik@sun.com>2010-01-30 23:09:31 +0300
commit2b90de942c9a23a584393a905f6df7016168a9c0 (patch)
tree81e219c792bb0ac78dac1e4685f956c765599271 /sql/sql_udf.cc
parent2b8f00a9c061ad43aadcf43335884fce38ab3fa0 (diff)
parent6ee51dc7ef7945c6a860222ca14140a147f7884d (diff)
downloadmariadb-git-2b90de942c9a23a584393a905f6df7016168a9c0.tar.gz
Manual merge from mysql-trunk-merge.
Conflicts: - sql/event_db_repository.cc - sql/events.cc - sql/sp.cc - sql/sql_acl.cc - sql/sql_udf.cc
Diffstat (limited to 'sql/sql_udf.cc')
-rw-r--r--sql/sql_udf.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index ff7573b4cfd..57c9110405a 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -421,6 +421,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
TABLE *table;
TABLE_LIST tables;
udf_func *u_d;
+ bool save_binlog_row_based;
DBUG_ENTER("mysql_create_function");
if (!initialized)
@@ -460,8 +461,8 @@ int mysql_create_function(THD *thd,udf_func *udf)
Turn off row binlogging of this statement and use statement-based
so that all supporting tables are updated for CREATE FUNCTION command.
*/
- if (thd->is_current_stmt_binlog_format_row())
- thd->clear_current_stmt_binlog_format_row();
+ save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
+ thd->clear_current_stmt_binlog_format_row();
mysql_rwlock_wrlock(&THR_LOCK_udf);
if ((my_hash_search(&udf_hash,(uchar*) udf->name.str, udf->name.length)))
@@ -531,12 +532,17 @@ int mysql_create_function(THD *thd,udf_func *udf)
/* Binlog the create function. */
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
DBUG_RETURN(1);
+
+ /* Restore the state of binlog format */
+ thd->current_stmt_binlog_row_based= save_binlog_row_based;
DBUG_RETURN(0);
err:
if (new_dl)
dlclose(dl);
mysql_rwlock_unlock(&THR_LOCK_udf);
+ /* Restore the state of binlog format */
+ thd->current_stmt_binlog_row_based= save_binlog_row_based;
DBUG_RETURN(1);
}
@@ -548,6 +554,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
udf_func *udf;
char *exact_name_str;
uint exact_name_len;
+ bool save_binlog_row_based;
DBUG_ENTER("mysql_drop_function");
if (!initialized)
@@ -563,8 +570,8 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
Turn off row binlogging of this statement and use statement-based
so that all supporting tables are updated for DROP FUNCTION command.
*/
- if (thd->is_current_stmt_binlog_format_row())
- thd->clear_current_stmt_binlog_format_row();
+ save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
+ thd->clear_current_stmt_binlog_format_row();
mysql_rwlock_wrlock(&THR_LOCK_udf);
if (!(udf=(udf_func*) my_hash_search(&udf_hash,(uchar*) udf_name->str,
@@ -606,9 +613,14 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
/* Binlog the drop function. */
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
DBUG_RETURN(1);
+
+ /* Restore the state of binlog format */
+ thd->current_stmt_binlog_row_based= save_binlog_row_based;
DBUG_RETURN(0);
err:
mysql_rwlock_unlock(&THR_LOCK_udf);
+ /* Restore the state of binlog format */
+ thd->current_stmt_binlog_row_based= save_binlog_row_based;
DBUG_RETURN(1);
}