diff options
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r-- | sql/sql_delete.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 475df34dc4f..166a0e130e3 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -590,8 +590,12 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) { /* Probably InnoDB table */ table_list->lock_type= TL_WRITE; - DBUG_RETURN(mysql_delete(thd, table_list, (COND*) 0, (ORDER*) 0, - HA_POS_ERROR, 0)); + ulong save_options= thd->options; + thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT); + int res= mysql_delete(thd, table_list, (COND*) 0, (ORDER*) 0, + HA_POS_ERROR, 0); + thd->options= save_options; + DBUG_RETURN(res); } if (lock_and_wait_for_table_name(thd, table_list)) DBUG_RETURN(-1); |