1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Fix bug#15028 Multitable update returns different numbers of matched rows

depending on table order

multi_update::send_data() was counting updates, not updated rows. Thus if one 
record have several updates it will be counted several times in 'rows matched'
but updated only once.

multi_update::send_data() now counts only unique rows.
This commit is contained in:
evgen@moonbone.local
2005-12-01 23:22:20 +03:00
parent f57dffe453
commit 3f72e7645f
3 changed files with 37 additions and 6 deletions

View File

@@ -1082,22 +1082,23 @@ bool multi_update::send_data(List<Item> &not_used_values)
int error;
TABLE *tmp_table= tmp_tables[offset];
fill_record(tmp_table->field+1, *values_for_table[offset], 1);
found++;
/* Store pointer to row */
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 != HA_ERR_FOUND_DUPP_KEY &&
error != HA_ERR_FOUND_DUPP_UNIQUE))
if (error= tmp_table->file->write_row(tmp_table->record[0]))
{
if (create_myisam_from_heap(thd, tmp_table, tmp_table_param + offset,
error, 1))
if (error != HA_ERR_FOUND_DUPP_KEY &&
error != HA_ERR_FOUND_DUPP_UNIQUE &&
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
found++;
}
}
DBUG_RETURN(0);