diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 10ac9fbf84f3b012ff04ba39da38985610c0aaa3..00b2dee7165f7e602230673b7fcb394dcf4189e6 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -1948,8 +1948,8 @@ int ha_ndbcluster::index_end() int ha_ndbcluster::index_read(byte *buf, - const byte *key, uint key_len, - enum ha_rkey_function find_flag) + const byte *key, uint key_len, + enum ha_rkey_function find_flag) { DBUG_ENTER("index_read"); DBUG_PRINT("enter", ("active_index: %u, key_len: %u, find_flag: %d", @@ -1959,7 +1959,7 @@ int ha_ndbcluster::index_read(byte *buf, start_key.key= key; start_key.length= key_len; start_key.flag= find_flag; - DBUG_RETURN(read_range_first(&start_key, NULL, false, true)); + DBUG_RETURN(read_range_first_to_buf(&start_key, NULL, false, true, buf)); } @@ -2013,10 +2013,25 @@ int ha_ndbcluster::read_range_first(const key_range *start_key, const key_range *end_key, bool eq_range, bool sorted) { - KEY* key_info; - int error= 1; byte* buf= table->record[0]; DBUG_ENTER("ha_ndbcluster::read_range_first"); + + DBUG_RETURN(read_range_first_to_buf(start_key, + end_key, + eq_range, + sorted, + buf)); +} + +inline +int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key, + const key_range *end_key, + bool eq_range, bool sorted, + byte* buf) +{ + KEY* key_info; + int error= 1; + DBUG_ENTER("ha_ndbcluster::read_range_first_to_buf"); DBUG_PRINT("info", ("eq_range: %d, sorted: %d", eq_range, sorted)); if (m_active_cursor) diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index c49a6078e7ab3172ffc1a324bf93c7627e810c33..d71db9268bb906f575f22d5d73c3fe84ccfd1256 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -93,6 +93,10 @@ class ha_ndbcluster: public handler int read_range_first(const key_range *start_key, const key_range *end_key, bool eq_range, bool sorted); + int read_range_first_to_buf(const key_range *start_key, + const key_range *end_key, + bool eq_range, bool sorted, + byte* buf); int read_range_next(); bool get_error_message(int error, String *buf); diff --git a/sql/handler.cc b/sql/handler.cc index b7634b3cf334a290acdb5a4d97613b7002f4d810..237d4ce02de14613a43155b321d62cfcdcc96e4b 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1433,9 +1433,9 @@ int handler::read_range_first(const key_range *start_key, start_key->length, start_key->flag); if (result) - DBUG_RETURN((result == HA_ERR_KEY_NOT_FOUND || - result == HA_ERR_END_OF_FILE) ? HA_ERR_END_OF_FILE : - result); + DBUG_RETURN((result == HA_ERR_KEY_NOT_FOUND) + ? HA_ERR_END_OF_FILE + : result); DBUG_RETURN (compare_key(end_range) <= 0 ? 0 : HA_ERR_END_OF_FILE); }