summaryrefslogtreecommitdiff
path: root/myisam/mi_test2.c
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 /myisam/mi_test2.c
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 'myisam/mi_test2.c')
-rw-r--r--myisam/mi_test2.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/myisam/mi_test2.c b/myisam/mi_test2.c
index d3c3cc2c492..56d8357536a 100644
--- a/myisam/mi_test2.c
+++ b/myisam/mi_test2.c
@@ -606,13 +606,20 @@ int main(int argc, char *argv[])
mi_status(file,&info,HA_STATUS_VARIABLE);
for (i=0 ; i < info.keys ; i++)
{
+ key_range min_key, max_key;
if (mi_rfirst(file,read_record,(int) i) ||
mi_rlast(file,read_record2,(int) i))
goto err;
copy_key(file,(uint) i,(uchar*) read_record,(uchar*) key);
copy_key(file,(uint) i,(uchar*) read_record2,(uchar*) key2);
- range_records=mi_records_in_range(file,(int) i,key,0,HA_READ_KEY_EXACT,
- key2,0,HA_READ_AFTER_KEY);
+ min_key.key= key;
+ min_key.length= USE_WHOLE_KEY;
+ min_key.flag= HA_READ_KEY_EXACT;
+ max_key.key= key2;
+ max_key.length= USE_WHOLE_KEY;
+ max_key.flag= HA_READ_AFTER_KEY;
+
+ range_records= mi_records_in_range(file,(int) i, &min_key, &max_key);
if (range_records < info.records*8/10 ||
range_records > info.records*12/10)
{
@@ -634,12 +641,19 @@ int main(int argc, char *argv[])
for (k=rnd(1000)+1 ; k>0 && key1[k] == 0 ; k--) ;
if (j != 0 && k != 0)
{
+ key_range min_key, max_key;
if (j > k)
swap(int,j,k);
sprintf(key,"%6d",j);
sprintf(key2,"%6d",k);
- range_records=mi_records_in_range(file,0,key,0,HA_READ_AFTER_KEY,
- key2,0,HA_READ_BEFORE_KEY);
+
+ min_key.key= key;
+ min_key.length= USE_WHOLE_KEY;
+ min_key.flag= HA_READ_AFTER_KEY;
+ max_key.key= key2;
+ max_key.length= USE_WHOLE_KEY;
+ max_key.flag= HA_READ_BEFORE_KEY;
+ range_records= mi_records_in_range(file, 0, &min_key, &max_key);
records=0;
for (j++ ; j < k ; j++)
records+=key1[j];