mirror of
https://github.com/MariaDB/server.git
synced 2025-07-13 02:22:51 +03:00
Merge osalerma@bk-internal.mysql.com:/home/bk/mysql-5.0
into 127.(none):/home/osku/mysql-5.0
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user