summaryrefslogtreecommitdiff
path: root/heap
diff options
context:
space:
mode:
authorunknown <monty@mishka.local>2004-05-16 14:48:32 +0300
committerunknown <monty@mishka.local>2004-05-16 14:48:32 +0300
commit70f79563d9fa8ef3cdfef01b8eee95ea6e927147 (patch)
tree318557f2fbc33b547d96f62b2544f2e9f4174082 /heap
parentc2ce702b3bfff6faa25c6e2b145e41394d544d8d (diff)
downloadmariadb-git-70f79563d9fa8ef3cdfef01b8eee95ea6e927147.tar.gz
key_cmp -> key_cmp_if_same
New records_in_range() interface (similar to read_range()) Macros for faster bitmap handling Simplify read_range() code (#WL1786) New general key_cmp() function to compare keys heap/hp_hash.c: New records_in_range() interface include/heap.h: New records_in_range() interface include/my_base.h: Moved 'key_range' here so that all table handlers can use it include/my_bitmap.h: Make some bitmap functions inline for faster usage in one thread include/myisam.h: New records_in_range() interface include/myisammrg.h: New records_in_range() interface myisam/mi_range.c: New records_in_range() interface myisam/mi_test2.c: New records_in_range() interface myisam/rt_test.c: New records_in_range() interface Indentation fixes myisam/sp_test.c: New records_in_range() interface Indentation fixes myisammrg/myrg_range.c: New records_in_range() interface mysys/my_bitmap.c: Make some bitmap functions inline for faster usage in one thread sql/examples/ha_example.cc: New records_in_range() interface sql/field.cc: Fixed indentation sql/ha_berkeley.cc: New records_in_range() interface sql/ha_berkeley.h: New records_in_range() interface sql/ha_heap.cc: New records_in_range() interface sql/ha_heap.h: New records_in_range() interface sql/ha_innodb.cc: New records_in_range() interface sql/ha_innodb.h: New records_in_range() interface sql/ha_isam.cc: New records_in_range() interface sql/ha_isam.h: New records_in_range() interface sql/ha_myisam.cc: New records_in_range() interface sql/ha_myisam.h: New records_in_range() interface sql/ha_myisammrg.cc: New records_in_range() interface sql/ha_myisammrg.h: New records_in_range() interface sql/ha_ndbcluster.cc: New records_in_range() interface sql/ha_ndbcluster.h: New records_in_range() interface sql/handler.cc: Simplify read_range() interface: - Add 'eq_range' to read_range_first - Remove 'eq_range' parameer from read_range_next() - Trust values from index_next_same() - Simplfy compare_key() by moving key_comparision to key.cc (as this code can be reused from other places) sql/handler.h: Move key_range to my_base.h to be used by external table handlers Simplify read_range() interface New records_in_range() interface sql/key.cc: Rename key_cmp() to key_cmp_if_same() to make it more descriptive Add new key_cmp() function usable from range and handler code. sql/mysql_priv.h: Prototypes for new functions sql/opt_range.cc: New records_in_range() interface Simplify cmp_prev() (We can in 5.0 simplify cmp_next() the same way) sql/opt_range.h: Added key_part_info to QUICK_SELECT to be able to use key_cmp() in get_next() sql/opt_sum.cc: key_cmp -> key_cmp_if_same sql/sql_acl.cc: key_cmp -> key_cmp_if_same sql/sql_select.cc: key_cmp -> key_cmp_if_same
Diffstat (limited to 'heap')
-rw-r--r--heap/hp_hash.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/heap/hp_hash.c b/heap/hp_hash.c
index d040f37aea0..38ed581fe58 100644
--- a/heap/hp_hash.c
+++ b/heap/hp_hash.c
@@ -29,19 +29,15 @@
hp_rb_records_in_range()
info HEAP handler
inx Index to use
- start_key Start of range. Null pointer if from first key
- start_key_len Length of start key
- start_search_flag Flag if start key should be included or not
- end_key End of range. Null pointer if to last key
- end_key_len Length of end key
- end_search_flag Flag if start key should be included or not
+ min_key Min key. Is = 0 if no min range
+ max_key Max key. Is = 0 if no max range
NOTES
- start_search_flag can have one of the following values:
+ min_key.flag can have one of the following values:
HA_READ_KEY_EXACT Include the key in the range
HA_READ_AFTER_KEY Don't include key in range
- end_search_flag can have one of the following values:
+ max_key.flag can have one of the following values:
HA_READ_BEFORE_KEY Don't include key in range
HA_READ_AFTER_KEY Include all 'end_key' values in the range
@@ -52,11 +48,8 @@
the range.
*/
-ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
- uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key, uint end_key_len,
- enum ha_rkey_function end_search_flag)
+ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, key_range *min_key,
+ key_range *max_key)
{
ha_rows start_pos, end_pos;
HP_KEYDEF *keyinfo= info->s->keydef + inx;
@@ -67,12 +60,12 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
info->lastinx= inx;
custom_arg.keyseg= keyinfo->seg;
custom_arg.search_flag= SEARCH_FIND | SEARCH_SAME;
- if (start_key)
+ if (min_key)
{
custom_arg.key_length= hp_rb_pack_key(keyinfo, (uchar*) info->recbuf,
- (uchar*) start_key,
- start_key_len);
- start_pos= tree_record_pos(rb_tree, info->recbuf, start_search_flag,
+ (uchar*) min_key->key,
+ min_key->length);
+ start_pos= tree_record_pos(rb_tree, info->recbuf, min_key->flag,
&custom_arg);
}
else
@@ -80,11 +73,12 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
start_pos= 0;
}
- if (end_key)
+ if (max_key)
{
custom_arg.key_length= hp_rb_pack_key(keyinfo, (uchar*) info->recbuf,
- (uchar*) end_key, end_key_len);
- end_pos= tree_record_pos(rb_tree, info->recbuf, end_search_flag,
+ (uchar*) max_key->key,
+ max_key->length);
+ end_pos= tree_record_pos(rb_tree, info->recbuf, max_key->flag,
&custom_arg);
}
else
@@ -100,12 +94,13 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
(end_pos == start_pos ? (ha_rows) 1 : end_pos - start_pos));
}
+
/* Search after a record based on a key */
/* Sets info->current_ptr to found record */
/* next_flag: Search=0, next=1, prev =2, same =3 */
byte *hp_search(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *key,
- uint nextflag)
+ uint nextflag)
{
reg1 HASH_INFO *pos,*prev_ptr;
int flag;