diff options
author | unknown <msvensson@devsrv-b.mysql.com> | 2006-02-28 11:17:40 +0100 |
---|---|---|
committer | unknown <msvensson@devsrv-b.mysql.com> | 2006-02-28 11:17:40 +0100 |
commit | 701b69914421935de129ea9c7e4ce8cc0afe1969 (patch) | |
tree | 213fe06b059798792c4838652be50d0d2c9915fe /sql/ha_federated.cc | |
parent | 85e54a08c4fc468ab89f8df27bc981027cb22e6c (diff) | |
download | mariadb-git-701b69914421935de129ea9c7e4ce8cc0afe1969.tar.gz |
Bug#17377 Federated Engine returns wrong Data, always the rows with the highest ID
- Always make rnd_pos reposition the cursor in the fetched result set.
mysql-test/r/federated.result:
Update test result
mysql-test/t/federated.test:
Add test for bug#17377
sql/ha_federated.cc:
Remove the "scan_flag" variable. rnd_pos should always move to a new position in the result set.
The "scan" flag in rnd_init will protect from the old result set being
closed and a new fecthed. I think the "scan_flag" was added before check of the "scan" argument in rnd_init was added.
sql/ha_federated.h:
Remove class variable "scan_flag"
Diffstat (limited to 'sql/ha_federated.cc')
-rw-r--r-- | sql/ha_federated.cc | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index af7c987e477..c6d5c77803b 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -740,7 +740,7 @@ error: ha_federated::ha_federated(TABLE *table_arg) :handler(&federated_hton, table_arg), - mysql(0), stored_result(0), scan_flag(0), + mysql(0), stored_result(0), ref_length(sizeof(MYSQL_ROW_OFFSET)), current_position(0) {} @@ -2243,7 +2243,7 @@ int ha_federated::rnd_init(bool scan) containing the correct record, hence update the wrong row! */ - scan_flag= scan; + if (scan) { DBUG_PRINT("info", ("share->select_query %s", share->select_query)); @@ -2365,24 +2365,13 @@ void ha_federated::position(const byte *record) int ha_federated::rnd_pos(byte *buf, byte *pos) { DBUG_ENTER("ha_federated::rnd_pos"); - /* - we do not need to do any of this if there has been a scan performed - already, or if this is an update and index_read_idx already has a result - set in which to build it's update query from - */ - if (scan_flag) - { - int retval; - statistic_increment(table->in_use->status_var.ha_read_rnd_count, - &LOCK_status); - memcpy_fixed(¤t_position, pos, sizeof(MYSQL_ROW_OFFSET)); // pos - /* is not aligned */ - stored_result->current_row= 0; - stored_result->data_cursor= current_position; - retval= rnd_next(buf); - DBUG_RETURN(retval); - } - DBUG_RETURN(0); + + statistic_increment(table->in_use->status_var.ha_read_rnd_count, + &LOCK_status); + memcpy_fixed(¤t_position, pos, sizeof(MYSQL_ROW_OFFSET)); + stored_result->current_row= 0; + stored_result->data_cursor= current_position; + DBUG_RETURN(rnd_next(buf)); } |