summaryrefslogtreecommitdiff
path: root/sql/ha_berkeley.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/ha_berkeley.cc')
-rw-r--r--sql/ha_berkeley.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 3f6b2629e16..10ff4dcc260 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -1429,7 +1429,12 @@ int ha_berkeley::index_read(byte * buf, const byte * key,
pack_key(&last_key, active_index, key_buff, key, key_len);
/* Store for compare */
memcpy(key_buff2, key_buff, (key_len=last_key.size));
- key_info->handler.bdb_return_if_eq= -1;
+ /*
+ If HA_READ_AFTER_KEY is set, return next key, else return first
+ matching key.
+ */
+ key_info->handler.bdb_return_if_eq= (find_flag == HA_READ_AFTER_KEY ?
+ 1 : -1);
error=read_row(cursor->c_get(cursor, &last_key, &row, DB_SET_RANGE),
(char*) buf, active_index, &row, (DBT*) 0, 0);
key_info->handler.bdb_return_if_eq= 0;