summaryrefslogtreecommitdiff
path: root/sql/events.cc
diff options
context:
space:
mode:
authorunknown <cbell/Chuck@mysql_cab_desk.>2007-03-29 09:54:59 -0400
committerunknown <cbell/Chuck@mysql_cab_desk.>2007-03-29 09:54:59 -0400
commit4a0f5887b71ca3bda0d06e5d0641f985a0ca679a (patch)
treeb882e0f7e923a5f2e63a816eb86059d4de1a3abd /sql/events.cc
parentcbbb40346ffaed733ba9784c7ee9f461667d45fd (diff)
parent7e43b1f586142693a9b1ec1cf5ac92e6a38a3190 (diff)
downloadmariadb-git-4a0f5887b71ca3bda0d06e5d0641f985a0ca679a.tar.gz
Merge cbell@bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl
into mysql_cab_desk.:C:/source/c++/mysql-5.1-new-rpl mysql-test/t/events.test: Auto merged sql/event_queue.cc: Auto merged sql/events.cc: Auto merged sql/lex.h: Auto merged sql/slave.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_yacc.yy: Auto merged BitKeeper/deleted/.del-init_db.sql~a77d572c39d5a1f8: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches. BitKeeper/deleted/.del-mysql_create_system_tables.sh: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches. mysql-test/r/events.result: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches. mysql-test/r/events_grant.result: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches. mysql-test/r/events_restart_phase1.result: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches. mysql-test/r/system_mysql_db.result: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches. mysql-test/t/events_restart_phase1.test: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches. scripts/mysql_system_tables.sql: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches. scripts/mysql_system_tables_fix.sql: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches. sql/event_data_objects.cc: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches. sql/event_data_objects.h: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches. sql/event_db_repository.cc: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches. sql/event_db_repository.h: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches. sql/sql_udf.cc: WL#3629 : Replication of Invocation and Invoked Features Manual merge prior to pushing patches.
Diffstat (limited to 'sql/events.cc')
-rw-r--r--sql/events.cc52
1 files changed, 50 insertions, 2 deletions
diff --git a/sql/events.cc b/sql/events.cc
index 88014ee34af..5931c0a95d4 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -324,7 +324,15 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, bool if_not_exists)
DBUG_RETURN(TRUE);
}
+ /*
+ Turn off row binlogging of this statement and use statement-based
+ so that all supporting tables are updated for CREATE EVENT command.
+ */
+ if (thd->current_stmt_binlog_row_based)
+ thd->clear_current_stmt_binlog_row_based();
+
pthread_mutex_lock(&LOCK_event_metadata);
+
/* On error conditions my_error() is called so no need to handle here */
if (!(ret= db_repository->create_event(thd, parse_data, if_not_exists)) &&
!parse_data->do_not_create)
@@ -340,8 +348,16 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, bool if_not_exists)
DBUG_ASSERT(ret == OP_LOAD_ERROR);
delete new_element;
}
- else
+ else /* Binlog the create event. */
+ {
event_queue->create_event(thd, new_element);
+ if (mysql_bin_log.is_open())
+ {
+ thd->clear_error();
+ thd->binlog_query(THD::MYSQL_QUERY_TYPE,
+ thd->query, thd->query_length, FALSE, FALSE);
+ }
+ }
}
pthread_mutex_unlock(&LOCK_event_metadata);
@@ -383,7 +399,15 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, sp_name *rename_to)
DBUG_RETURN(TRUE);
}
+ /*
+ Turn off row binlogging of this statement and use statement-based
+ so that all supporting tables are updated for UPDATE EVENT command.
+ */
+ if (thd->current_stmt_binlog_row_based)
+ thd->clear_current_stmt_binlog_row_based();
+
pthread_mutex_lock(&LOCK_event_metadata);
+
/* On error conditions my_error() is called so no need to handle here */
if (!(ret= db_repository->update_event(thd, parse_data, new_dbname, new_name)))
{
@@ -398,9 +422,17 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, sp_name *rename_to)
DBUG_ASSERT(ret == OP_LOAD_ERROR);
delete new_element;
}
- else
+ else /* Binlog the alter event. */
+ {
event_queue->update_event(thd, parse_data->dbname, parse_data->name,
new_element);
+ if (mysql_bin_log.is_open())
+ {
+ thd->clear_error();
+ thd->binlog_query(THD::MYSQL_QUERY_TYPE,
+ thd->query, thd->query_length, FALSE, FALSE);
+ }
+ }
}
pthread_mutex_unlock(&LOCK_event_metadata);
@@ -435,10 +467,26 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
DBUG_RETURN(TRUE);
}
+ /*
+ Turn off row binlogging of this statement and use statement-based so
+ that all supporting tables are updated for DROP EVENT command.
+ */
+ if (thd->current_stmt_binlog_row_based)
+ thd->clear_current_stmt_binlog_row_based();
+
pthread_mutex_lock(&LOCK_event_metadata);
/* On error conditions my_error() is called so no need to handle here */
if (!(ret= db_repository->drop_event(thd, dbname, name, if_exists)))
+ {
event_queue->drop_event(thd, dbname, name);
+ /* Binlog the drop event. */
+ if (mysql_bin_log.is_open())
+ {
+ thd->clear_error();
+ thd->binlog_query(THD::MYSQL_QUERY_TYPE,
+ thd->query, thd->query_length, FALSE, FALSE);
+ }
+ }
pthread_mutex_unlock(&LOCK_event_metadata);
DBUG_RETURN(ret);
}