diff options
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b534e876638..3ecc1b907fc 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2740,6 +2740,20 @@ mysql_execute_command(THD *thd) case SQLCOM_CREATE_TABLE: { + /* If CREATE TABLE of non-temporary table, do implicit commit */ + if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)) + { + if (end_active_trans(thd)) + { + res= -1; + break; + } + } + else + { + /* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */ + thd->options|= OPTION_STATUS_NO_TRANS_UPDATE; + } DBUG_ASSERT(first_table == all_tables && first_table != 0); bool link_to_local; // Skip first table, which is the table we are creating @@ -3232,6 +3246,11 @@ end_with_restore_list: break; } case SQLCOM_TRUNCATE: + if (end_active_trans(thd)) + { + res= -1; + break; + } DBUG_ASSERT(first_table == all_tables && first_table != 0); if (check_one_table_access(thd, DELETE_ACL, all_tables)) goto error; @@ -3324,6 +3343,9 @@ end_with_restore_list: */ if (thd->slave_thread) lex->drop_if_exists= 1; + + /* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */ + thd->options|= OPTION_STATUS_NO_TRANS_UPDATE; } res= mysql_rm_table(thd, first_table, lex->drop_if_exists, lex->drop_temporary); @@ -3462,6 +3484,11 @@ end_with_restore_list: break; case SQLCOM_CREATE_DB: { + if (end_active_trans(thd)) + { + res= -1; + break; + } char *alias; if (!(alias=thd->strdup(lex->name)) || check_db_name(lex->name)) { @@ -3492,6 +3519,11 @@ end_with_restore_list: } case SQLCOM_DROP_DB: { + if (end_active_trans(thd)) + { + res= -1; + break; + } if (check_db_name(lex->name)) { my_error(ER_WRONG_DB_NAME, MYF(0), lex->name); |