Commit 47578036 authored by serg@serg.mylan's avatar serg@serg.mylan

merged

parents 3dbbb2fc 533e0551
...@@ -878,6 +878,7 @@ truncate table t1; ...@@ -878,6 +878,7 @@ truncate table t1;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
commit; commit;
truncate table t1; truncate table t1;
truncate table t1;
select * from t1; select * from t1;
a a
insert into t1 values(1),(2); insert into t1 values(1),(2);
......
...@@ -574,6 +574,7 @@ insert into t1 values(1),(2); ...@@ -574,6 +574,7 @@ insert into t1 values(1),(2);
truncate table t1; truncate table t1;
commit; commit;
truncate table t1; truncate table t1;
truncate table t1;
select * from t1; select * from t1;
insert into t1 values(1),(2); insert into t1 values(1),(2);
delete from t1; delete from t1;
......
...@@ -649,11 +649,14 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) ...@@ -649,11 +649,14 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
if (!ha_supports_generate(table_type)) if (!ha_supports_generate(table_type))
{ {
/* Probably InnoDB table */ /* Probably InnoDB table */
ulong save_options= thd->options;
table_list->lock_type= TL_WRITE; table_list->lock_type= TL_WRITE;
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT);
ha_enable_transaction(thd, FALSE); ha_enable_transaction(thd, FALSE);
error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0, error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0,
HA_POS_ERROR, 0); HA_POS_ERROR, 0);
ha_enable_transaction(thd, TRUE); ha_enable_transaction(thd, TRUE);
thd->options= save_options;
DBUG_RETURN(error); DBUG_RETURN(error);
} }
if (lock_and_wait_for_table_name(thd, table_list)) if (lock_and_wait_for_table_name(thd, table_list))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment