diff options
author | unknown <osku@127.(none)> | 2005-08-29 09:06:43 +0300 |
---|---|---|
committer | unknown <osku@127.(none)> | 2005-08-29 09:06:43 +0300 |
commit | d7d3b4cdcbbbe68b7ee7c39466116b271d3b8351 (patch) | |
tree | fa562597c08dce3de422d77cf8e36b5e768b8b2f /sql/sql_delete.cc | |
parent | 11d32b4af305ba98f19d24adc65a04816bfb2861 (diff) | |
parent | 9363d02fbb1e3583b5fbb0d96c63a26f76d2779d (diff) | |
download | mariadb-git-d7d3b4cdcbbbe68b7ee7c39466116b271d3b8351.tar.gz |
Merge osalerma@bk-internal.mysql.com:/home/bk/mysql-5.0
into 127.(none):/home/osku/mysql-5.0
sql/ha_innodb.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r-- | sql/sql_delete.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 4ec5b43f8e7..3e50b806897 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -100,6 +100,13 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, free_underlaid_joins(thd, select_lex); thd->row_count_func= 0; send_ok(thd,0L); + + /* + We don't need to call reset_auto_increment in this case, because + mysql_truncate always gives a NULL conds argument, hence we never + get here. + */ + DBUG_RETURN(0); // Nothing to delete } @@ -223,6 +230,21 @@ 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)) + { + /* + We're really doing a truncate and need to reset the table's + auto-increment counter. + */ + int error2 = table->file->reset_auto_increment(); + + if (error2 && (error2 != HA_ERR_WRONG_COMMAND)) + { + table->file->print_error(error2, MYF(0)); + error = 1; + } + } + cleanup: /* Invalidate the table in the query cache if something changed. This must |