summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorunknown <kaa@polly.local>2007-04-23 18:22:33 +0400
committerunknown <kaa@polly.local>2007-04-23 18:22:33 +0400
commitc705567e9c3ecea3bbcf8e5e8ef6ab6123892728 (patch)
tree24f873cc5431a99425c7bd62ffd427c12c3ded2f /sql/sql_update.cc
parentf7417a299eddf6212996c357f79b2715af98567b (diff)
downloadmariadb-git-c705567e9c3ecea3bbcf8e5e8ef6ab6123892728.tar.gz
Fix for bug #22364 "Inconsistent "matched rows" when executing UPDATE"
In multi_update::send_data(), the counter of matched rows was not correctly incremented, when during insertion of a new row to a temporay table it had to be converted from HEAP to MyISAM. This fix changes the logic to increment the counter of matched rows in the following cases: 1. If the error returned from write_row() is zero. 2. If the error returned from write_row() is non-zero, is neither HA_ERR_FOUND_DUPP_KEY nor HA_ERR_FOUND_DUPP_UNIQUE, and a call to create_myisam_from_heap() succeeds. mysql-test/r/update.result: Added a test case for bug #22364 "Inconsistent "matched rows" when executing UPDATE" mysql-test/t/update.test: Added a test case for bug #22364 "Inconsistent "matched rows" when executing UPDATE" sql/sql_update.cc: In multi_update::send_data(), the counter of matched rows was not correctly incremented, when during insertion of a new row to a temporay table it had to be converted from HEAP to MyISAM. This fix changes the logic to increment the counter of matched rows in the following cases: 1. If the error returned from write_row() is zero. 2. If the error returned from write_row() is non-zero, is neither HA_ERR_FOUND_DUPP_KEY nor HA_ERR_FOUND_DUPP_UNIQUE, and a call to create_myisam_from_heap() succeeds.
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 27d38114885..b316a15e9f7 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1328,19 +1328,18 @@ bool multi_update::send_data(List<Item> &not_used_values)
memcpy((char*) tmp_table->field[0]->ptr,
(char*) table->file->ref, table->file->ref_length);
/* Write row, ignoring duplicated updates to a row */
- if ((error= tmp_table->file->write_row(tmp_table->record[0])))
+ error= tmp_table->file->write_row(tmp_table->record[0]);
+ if (error != HA_ERR_FOUND_DUPP_KEY && error != HA_ERR_FOUND_DUPP_UNIQUE)
{
- if (error != HA_ERR_FOUND_DUPP_KEY &&
- error != HA_ERR_FOUND_DUPP_UNIQUE &&
+ if (error &&
create_myisam_from_heap(thd, tmp_table,
- tmp_table_param + offset, error, 1))
- {
- do_update=0;
- DBUG_RETURN(1); // Not a table_is_full error
- }
- }
- else
+ tmp_table_param + offset, error, 1))
+ {
+ do_update= 0;
+ DBUG_RETURN(1); // Not a table_is_full error
+ }
found++;
+ }
}
}
DBUG_RETURN(0);