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 f0ea0a762bd..cd84c66cbba 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2407,6 +2407,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; + } /* Skip first table, which is the table we are creating */ TABLE_LIST *create_table, *create_table_local; tables= lex->unlink_first_table(tables, &create_table, @@ -2870,6 +2884,11 @@ unsent_create_error: break; } case SQLCOM_TRUNCATE: + if (end_active_trans(thd)) + { + res= -1; + break; + } if (check_one_table_access(thd, DELETE_ACL, tables)) goto error; /* @@ -2984,6 +3003,9 @@ unsent_create_error: */ 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,tables,lex->drop_if_exists, lex->drop_temporary); } @@ -3228,6 +3250,11 @@ purposes internal to the MySQL server", MYF(0)); 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)) { @@ -3258,6 +3285,11 @@ purposes internal to the MySQL server", MYF(0)); } case SQLCOM_DROP_DB: { + if (end_active_trans(thd)) + { + res= -1; + break; + } char *alias; if (!(alias=thd->strdup(lex->name)) || check_db_name(lex->name)) { |