summaryrefslogtreecommitdiff
path: root/client/mysqlbinlog.cc
diff options
context:
space:
mode:
authorunknown <Dao-Gang.Qu@sun.com>2009-09-30 10:01:52 +0800
committerunknown <Dao-Gang.Qu@sun.com>2009-09-30 10:01:52 +0800
commitde04eb6c37016ac5c42fe75bceaa95842da94f15 (patch)
treee46f05d28d235e3143d24fe449544525477f4e2e /client/mysqlbinlog.cc
parent0fb0b2b1b828fcd3e7d51b41184d9fac3fe15d18 (diff)
downloadmariadb-git-de04eb6c37016ac5c42fe75bceaa95842da94f15.tar.gz
Bug #46998 mysqlbinlog can't output BEGIN even if the database is included in a transaction
The 'BEGIN/COMMIT/ROLLBACK' log event could be filtered out if the database is not selected by --database option of mysqlbinlog command. This can result in problem if there are some statements in the transaction are not filtered out. To fix the problem, mysqlbinlog will output 'BEGIN/ROLLBACK/COMMIT' in regardless of the database filtering rules. client/mysqlbinlog.cc: Skip the database check for BEGIN/COMMIT/ROLLBACK log events. mysql-test/r/mysqlbinlog.result: Test result for bug#46998 mysql-test/t/mysqlbinlog.test: Added test to verify if the 'BEGIN', 'COMMIT' and 'ROLLBACK' are output in regardless of database filtering
Diffstat (limited to 'client/mysqlbinlog.cc')
-rw-r--r--client/mysqlbinlog.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index ab78bbea944..05d8b539543 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -557,7 +557,10 @@ int process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
switch (ev_type) {
case QUERY_EVENT:
- if (check_database(((Query_log_event*)ev)->db))
+ if (strncmp(((Query_log_event*)ev)->query, "BEGIN", 5) &&
+ strncmp(((Query_log_event*)ev)->query, "COMMIT", 6) &&
+ strncmp(((Query_log_event*)ev)->query, "ROLLBACK", 8) &&
+ check_database(((Query_log_event*)ev)->db))
goto end;
ev->print(result_file, print_event_info);
break;