summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2005-04-14 18:14:54 +0200
committerunknown <serg@serg.mylan>2005-04-14 18:14:54 +0200
commit1403fb000b58a171b094a93b35c4f93123c15b19 (patch)
tree962ce86bfc4a780ef1e0ff19b8cc6f2b4366be91 /sql/sql_delete.cc
parent28a1851629725f312edc604b191197ccd33df63e (diff)
downloadmariadb-git-1403fb000b58a171b094a93b35c4f93123c15b19.tar.gz
TRUNCATE is always a transaction on itself. pretent we're in auto-commit mode
bug#8151
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc8
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);