summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorunknown <osku@127.(none)>2005-08-30 12:39:20 +0300
committerunknown <osku@127.(none)>2005-08-30 12:39:20 +0300
commitc12a760ce9e0c99a2b943bf2de4d7278fb8fa21e (patch)
tree1980d4b95ca3a5967f5fba11239975ef072e8178 /sql/sql_delete.cc
parentb3dcaff948d27cc0a659ef56cc63b0b3aa20a1c0 (diff)
downloadmariadb-git-c12a760ce9e0c99a2b943bf2de4d7278fb8fa21e.tar.gz
Bug #11946: Review fixes.
sql/ha_innodb.cc: Add 'value' parameter to reset_auto_increment. sql/ha_innodb.h: Add 'value' parameter to reset_auto_increment. sql/handler.h: Add 'value' parameter to reset_auto_increment. sql/mysql_priv.h: Add 'reset_auto_increment' parameter to mysql_delete. sql/sql_delete.cc: Add 'reset_auto_increment' parameter to mysql_delete, and use it instead of checking for SQLCOM_TRUNCATE. mysql_truncate: Adapt to changes in mysql_delete. sql/sql_parse.cc: mysql_execute_command: Adapt to changes in mysql_delete.
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 3e50b806897..c7fabdaf18e 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -27,7 +27,8 @@
#include "sql_trigger.h"
bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
- SQL_LIST *order, ha_rows limit, ulonglong options)
+ SQL_LIST *order, ha_rows limit, ulonglong options,
+ bool reset_auto_increment)
{
int error;
TABLE *table;
@@ -230,18 +231,18 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (options & OPTION_QUICK)
(void) table->file->extra(HA_EXTRA_NORMAL);
- if ((error < 0) && (thd->lex->sql_command == SQLCOM_TRUNCATE))
+ if (reset_auto_increment && (error < 0))
{
/*
We're really doing a truncate and need to reset the table's
auto-increment counter.
*/
- int error2 = table->file->reset_auto_increment();
+ int error2= table->file->reset_auto_increment(0);
if (error2 && (error2 != HA_ERR_WRONG_COMMAND))
{
table->file->print_error(error2, MYF(0));
- error = 1;
+ error= 1;
}
}
@@ -828,7 +829,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
ha_enable_transaction(thd, FALSE);
mysql_init_select(thd->lex);
error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0,
- HA_POS_ERROR, LL(0));
+ HA_POS_ERROR, LL(0), TRUE);
ha_enable_transaction(thd, TRUE);
thd->options= save_options;
DBUG_RETURN(error);