summaryrefslogtreecommitdiff
path: root/sql/sql_udf.cc
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2010-02-06 13:28:06 +0300
committerKonstantin Osipov <kostja@sun.com>2010-02-06 13:28:06 +0300
commita72f90bc43a809e6678e1343a1ee760878061be3 (patch)
tree16fe2efa0a3d5e40e00972a1dc3bc4e13f71170c /sql/sql_udf.cc
parentba678eef7de4a8c5fbea07928b87fef84765f22b (diff)
parentb38ef2b5f7bc231b63b770c28688ee9f0109c88b (diff)
downloadmariadb-git-a72f90bc43a809e6678e1343a1ee760878061be3.tar.gz
Merge next-mr -> next-4284.
mysql-test/t/disabled.def: Restore disabled ssl tests: SSL certificates were updated. Disable sp_sync.test, the test case can't work in next-4284. mysql-test/t/partition_innodb.test: Disable parsing of the test case for Bug#47343, the test can not work in next-4284. mysql-test/t/ps_ddl.test: Update results (CREATE TABLE IF NOT EXISTS takes into account existence of the temporary table).
Diffstat (limited to 'sql/sql_udf.cc')
-rw-r--r--sql/sql_udf.cc26
1 files changed, 22 insertions, 4 deletions
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 462555606c8..15c3083ea9d 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -418,6 +418,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)
@@ -457,8 +458,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)))
@@ -525,13 +526,21 @@ int mysql_create_function(THD *thd,udf_func *udf)
/* Binlog the create function. */
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
+ {
+ /* Restore the state of binlog format */
+ thd->current_stmt_binlog_row_based= save_binlog_row_based;
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);
}
@@ -543,6 +552,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)
@@ -558,8 +568,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,
@@ -600,10 +610,18 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
while binlogging, to avoid binlog inconsistency.
*/
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
+ {
+ /* Restore the state of binlog format */
+ thd->current_stmt_binlog_row_based= save_binlog_row_based;
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);
}