summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-06-12 16:58:48 +0300
committerGeorgi Kodinov <joro@sun.com>2009-06-12 16:58:48 +0300
commit34ec15724f33e9ed6da0bfa9d269562b27128912 (patch)
tree35c3311fd35bdd4faa975404ae64686a9da7b51d /sql/opt_range.cc
parenta141a6375aebc01c6a4c3d4430860a8a2e772f79 (diff)
parent1f2b5b3037d82b9f31e7bee01eebdfe8d008b276 (diff)
downloadmariadb-git-34ec15724f33e9ed6da0bfa9d269562b27128912.tar.gz
automerge
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 349c5243b2a..d5463413c9b 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -10886,8 +10886,14 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range()
/* Compare the found key with max_key. */
int cmp_res= key_cmp(index_info->key_part, max_key,
real_prefix_len + min_max_arg_len);
- if (!(((cur_range->flag & NEAR_MAX) && (cmp_res == -1)) ||
- (cmp_res <= 0)))
+ /*
+ The key is outside of the range if:
+ the interval is open and the key is equal to the maximum boundry
+ or
+ the key is greater than the maximum
+ */
+ if (((cur_range->flag & NEAR_MAX) && cmp_res == 0) ||
+ cmp_res > 0)
{
result= HA_ERR_KEY_NOT_FOUND;
continue;
@@ -11004,8 +11010,14 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range()
/* Compare the found key with min_key. */
int cmp_res= key_cmp(index_info->key_part, min_key,
real_prefix_len + min_max_arg_len);
- if (!(((cur_range->flag & NEAR_MIN) && (cmp_res == 1)) ||
- (cmp_res >= 0)))
+ /*
+ The key is outside of the range if:
+ the interval is open and the key is equal to the minimum boundry
+ or
+ the key is less than the minimum
+ */
+ if (((cur_range->flag & NEAR_MIN) && cmp_res == 0) ||
+ cmp_res < 0)
continue;
}
/* If we got to this point, the current key qualifies as MAX. */