From f6c996f0a25cee913130cad69d40c1b7eb2cccc0 Mon Sep 17 00:00:00 2001 From: "guilhem@gbichot3.local" <> Date: Sun, 9 Jul 2006 19:47:54 +0200 Subject: [PATCH] post-merge fixes --- mysql-test/r/rpl_switch_stm_row_mixed.result | 2 ++ sql/sql_insert.cc | 31 ++++++++------------ 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/mysql-test/r/rpl_switch_stm_row_mixed.result b/mysql-test/r/rpl_switch_stm_row_mixed.result index 93fc7f450d..359b667921 100644 --- a/mysql-test/r/rpl_switch_stm_row_mixed.result +++ b/mysql-test/r/rpl_switch_stm_row_mixed.result @@ -286,6 +286,8 @@ master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `mysqltest1`; create table t12 (a int, b float) master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t12) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 9d8e648eb2..6183157377 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2066,9 +2066,19 @@ bool delayed_insert::handle_inserts(void) } if (row->log_query && row->query.str != NULL && mysql_bin_log.is_open()) + { + /* + If the query has several rows to insert, only the first row will come + here. In row-based binlogging, this means that the first row will be + written to binlog as one Table_map event and one Rows event (due to an + event flush done in binlog_query()), then all other rows of this query + will be binlogged together as one single Table_map event and one + single Rows event. + */ thd.binlog_query(THD::ROW_QUERY_TYPE, row->query.str, row->query.length, FALSE, FALSE); + } if (table->s->blob_fields) free_delayed_insert_blobs(table); @@ -2744,22 +2754,6 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, } -class MY_HOOKS : public TABLEOP_HOOKS -{ -public: - MY_HOOKS(select_create *x) : ptr(x) { } - virtual void do_prelock(TABLE **tables, uint count) - { - if (ptr->get_thd()->current_stmt_binlog_row_based && - !(ptr->get_create_info()->options & HA_LEX_CREATE_TMP_TABLE)) - ptr->binlog_show_create_table(tables, count); - } - -private: - select_create *ptr; -}; - - int select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u) { @@ -2772,8 +2766,9 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u) MY_HOOKS(select_create *x) : ptr(x) { } virtual void do_prelock(TABLE **tables, uint count) { - if (ptr->get_thd()->current_stmt_binlog_row_based) - ptr->binlog_show_create_table(tables, count); + if (ptr->get_thd()->current_stmt_binlog_row_based && + !(ptr->get_create_info()->options & HA_LEX_CREATE_TMP_TABLE)) + ptr->binlog_show_create_table(tables, count); } private: -- 2.30.9