summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorKristofer Pettersson <kristofer.pettersson@sun.com>2008-11-03 14:08:42 +0100
committerKristofer Pettersson <kristofer.pettersson@sun.com>2008-11-03 14:08:42 +0100
commit5ef4fb24177e04002e93c788720f248965146faa (patch)
tree2396d9c32c518ad2141e2b95df86e593b549b927 /sql/sql_delete.cc
parentc82ff582226749c6049bdbbbdaa2031dc72d343b (diff)
downloadmariadb-git-5ef4fb24177e04002e93c788720f248965146faa.tar.gz
Bug#29507 TRUNCATE shows to many rows effected
TRUNCATE TABLE for InnoDB tables returned a count showing an approximation of the number of rows affected to gain efficiency. Now the statement always returns 0 rows affected for clarity. sql/sql_delete.cc: * Set row count to 0 if auto increment was reset which can happen if TRUNCATE TABLE was issued.
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 73a46aaac98..f7c44152571 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -398,7 +398,11 @@ cleanup:
free_underlaid_joins(thd, select_lex);
if (error < 0 || (thd->lex->ignore && !thd->is_fatal_error))
{
- thd->row_count_func= deleted;
+ /*
+ If a TRUNCATE TABLE was issued, the number of rows should be reported as
+ zero since the exact number is unknown.
+ */
+ thd->row_count_func= reset_auto_increment ? 0 : deleted;
my_ok(thd, (ha_rows) thd->row_count_func);
DBUG_PRINT("info",("%ld records deleted",(long) deleted));
}