From 5045615cd945b137c1f6b7c5e4c1bb960eb3b287 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 8 Jul 2014 19:39:06 +0200 Subject: small cleanup of the SHOW CREATE TABLE code --- sql/sql_insert.cc | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'sql/sql_insert.cc') diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index d61af758ced..d1b9961503f 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -4135,15 +4135,14 @@ select_create::binlog_show_create_table(TABLE **tables, uint count) { /* Note 1: In RBR mode, we generate a CREATE TABLE statement for the - created table by calling store_create_info() (behaves as SHOW - CREATE TABLE). In the event of an error, nothing should be - written to the binary log, even if the table is non-transactional; - therefore we pretend that the generated CREATE TABLE statement is - for a transactional table. The event will then be put in the - transaction cache, and any subsequent events (e.g., table-map - events and binrow events) will also be put there. We can then use - ha_autocommit_or_rollback() to either throw away the entire - kaboodle of events, or write them to the binary log. + created table by calling show_create_table(). In the event of an error, + nothing should be written to the binary log, even if the table is + non-transactional; therefore we pretend that the generated CREATE TABLE + statement is for a transactional table. The event will then be put in the + transaction cache, and any subsequent events (e.g., table-map events and + binrow events) will also be put there. We can then use + ha_autocommit_or_rollback() to either throw away the entire kaboodle of + events, or write them to the binary log. We write the CREATE TABLE statement here and not in prepare() since there potentially are sub-selects or accesses to information @@ -4162,12 +4161,9 @@ select_create::binlog_show_create_table(TABLE **tables, uint count) tmp_table_list.table = *tables; query.length(0); // Have to zero it since constructor doesn't - result= store_create_info(thd, &tmp_table_list, &query, create_info, - /* show_database */ TRUE, - MY_TEST(create_info->org_options & - HA_LEX_CREATE_REPLACE) || - create_info->table_was_deleted); - DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */ + result= show_create_table(thd, &tmp_table_list, &query, create_info, + WITH_DB_NAME); + DBUG_ASSERT(result == 0); /* show_create_table() always return 0 */ if (mysql_bin_log.is_open()) { -- cgit v1.2.1