diff options
author | unknown <monty@mishka.local> | 2004-05-16 14:48:32 +0300 |
---|---|---|
committer | unknown <monty@mishka.local> | 2004-05-16 14:48:32 +0300 |
commit | 70f79563d9fa8ef3cdfef01b8eee95ea6e927147 (patch) | |
tree | 318557f2fbc33b547d96f62b2544f2e9f4174082 /myisam/rt_test.c | |
parent | c2ce702b3bfff6faa25c6e2b145e41394d544d8d (diff) | |
download | mariadb-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/rt_test.c')
-rw-r--r-- | myisam/rt_test.c | 79 |
1 files changed, 29 insertions, 50 deletions
diff --git a/myisam/rt_test.c b/myisam/rt_test.c index bbeb8fce2d1..c1126c1939a 100644 --- a/myisam/rt_test.c +++ b/myisam/rt_test.c @@ -39,7 +39,6 @@ int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused))) } - int run_test(const char *filename) { MI_INFO *file; @@ -48,6 +47,7 @@ int run_test(const char *filename) MI_COLUMNDEF recinfo[20]; MI_KEYDEF keyinfo[20]; HA_KEYSEG keyseg[20]; + key_range range; int silent=0; int opt_unique=0; @@ -66,15 +66,12 @@ int run_test(const char *filename) int upd= 10; ha_rows hrows; - - /* Define a column for NULLs and DEL markers*/ recinfo[0].type=FIELD_NORMAL; recinfo[0].length=1; /* For NULL bits */ rec_length=1; - /* Define 2*ndims columns for coordinates*/ for (i=1; i<=2*ndims ;i++){ @@ -83,7 +80,6 @@ int run_test(const char *filename) rec_length+=key_length; } - /* Define a key with 2*ndims segments */ keyinfo[0].seg=keyseg; @@ -101,8 +97,7 @@ int run_test(const char *filename) keyinfo[0].seg[i].language=default_charset_info->number; } - - if(!silent) + if (!silent) printf("- Creating isam-file\n"); bzero((char*) &create_info,sizeof(create_info)); @@ -115,15 +110,11 @@ int run_test(const char *filename) recinfo,uniques,&uniquedef,&create_info,create_flag)) goto err; - - - - if(!silent) + if (!silent) printf("- Open isam-file\n"); if (!(file=mi_open(filename,2,HA_OPEN_ABORT_IF_LOCKED))) goto err; - if (!silent) printf("- Writing key:s\n"); @@ -144,11 +135,9 @@ int run_test(const char *filename) } } - - if((error=read_with_pos(file,silent))) + if ((error=read_with_pos(file,silent))) goto err; - if (!silent) printf("- Reading rows with key\n"); @@ -160,12 +149,12 @@ int run_test(const char *filename) bzero((char*) read_record,MAX_REC_LENGTH); error=mi_rkey(file,read_record,0,record+1,0,HA_READ_MBR_EQUAL); - if(error && error!=HA_ERR_KEY_NOT_FOUND) + if (error && error!=HA_ERR_KEY_NOT_FOUND) { printf(" mi_rkey: %3d errno: %3d\n",error,my_errno); goto err; } - if(error == HA_ERR_KEY_NOT_FOUND) + if (error == HA_ERR_KEY_NOT_FOUND) { print_record(record,mi_position(file)," NOT FOUND\n"); continue; @@ -173,10 +162,6 @@ int run_test(const char *filename) print_record(read_record,mi_position(file),"\n"); } - - - - if (!silent) printf("- Deleting rows\n"); for (i=0; i < nrecords/4; i++) @@ -184,7 +169,7 @@ int run_test(const char *filename) my_errno=0; bzero((char*) read_record,MAX_REC_LENGTH); error=mi_rrnd(file,read_record,i == 0 ? 0L : HA_OFFSET_ERROR); - if(error) + if (error) { printf("pos: %2d mi_rrnd: %3d errno: %3d\n",i,error,my_errno); goto err; @@ -192,14 +177,13 @@ int run_test(const char *filename) print_record(read_record,mi_position(file),"\n"); error=mi_delete(file,read_record); - if(error) + if (error) { printf("pos: %2d mi_delete: %3d errno: %3d\n",i,error,my_errno); goto err; } } - if (!silent) printf("- Updating rows with position\n"); for (i=0; i < (nrecords - nrecords/4) ; i++) @@ -207,9 +191,9 @@ int run_test(const char *filename) my_errno=0; bzero((char*) read_record,MAX_REC_LENGTH); error=mi_rrnd(file,read_record,i == 0 ? 0L : HA_OFFSET_ERROR); - if(error) + if (error) { - if(error==HA_ERR_RECORD_DELETED) + if (error==HA_ERR_RECORD_DELETED) continue; printf("pos: %2d mi_rrnd: %3d errno: %3d\n",i,error,my_errno); goto err; @@ -219,19 +203,16 @@ int run_test(const char *filename) printf("\t-> "); print_record(record,mi_position(file),"\n"); error=mi_update(file,read_record,record); - if(error) + if (error) { printf("pos: %2d mi_update: %3d errno: %3d\n",i,error,my_errno); goto err; } } - - if((error=read_with_pos(file,silent))) + if ((error=read_with_pos(file,silent))) goto err; - - if (!silent) printf("- Test mi_rkey then a sequence of mi_rnext_same\n"); @@ -246,25 +227,20 @@ int run_test(const char *filename) print_record(read_record,mi_position(file)," mi_rkey\n"); row_count=1; - - do { - if((error=mi_rnext_same(file,read_record))) + for (;;) + { + if ((error=mi_rnext_same(file,read_record))) { - if(error==HA_ERR_END_OF_FILE) + if (error==HA_ERR_END_OF_FILE) break; printf("mi_next: %3d errno: %3d\n",error,my_errno); goto err; } print_record(read_record,mi_position(file)," mi_rnext_same\n"); row_count++; - }while(1); + } printf(" %d rows\n",row_count); - - - - - if (!silent) printf("- Test mi_rfirst then a sequence of mi_rnext\n"); @@ -277,10 +253,11 @@ int run_test(const char *filename) row_count=1; print_record(read_record,mi_position(file)," mi_frirst\n"); - for(i=0;i<nrecords;i++) { - if((error=mi_rnext(file,read_record,0))) + for (i=0;i<nrecords;i++) + { + if ((error=mi_rnext(file,read_record,0))) { - if(error==HA_ERR_END_OF_FILE) + if (error==HA_ERR_END_OF_FILE) break; printf("mi_next: %3d errno: %3d\n",error,my_errno); goto err; @@ -290,16 +267,18 @@ int run_test(const char *filename) } printf(" %d rows\n",row_count); - if (!silent) printf("- Test mi_records_in_range()\n"); create_record1(record, nrecords*4/5); print_record(record,0,"\n"); - hrows=mi_records_in_range(file,0,record+1,0,HA_READ_MBR_INTERSECT,record+1,0,0); + + range.key= record+1; + range.length= 1000; /* Big enough */ + range.flag= HA_READ_MBR_INTERSECT; + hrows= mi_records_in_range(file,0, &range, (key_range*) 0); printf(" %ld rows\n", (long) hrows); - if (mi_close(file)) goto err; my_end(MY_CHECK_ERROR); @@ -325,11 +304,11 @@ static int read_with_pos (MI_INFO * file,int silent) my_errno=0; bzero((char*) read_record,MAX_REC_LENGTH); error=mi_rrnd(file,read_record,i == 0 ? 0L : HA_OFFSET_ERROR); - if(error) + if (error) { - if(error==HA_ERR_END_OF_FILE) + if (error==HA_ERR_END_OF_FILE) break; - if(error==HA_ERR_RECORD_DELETED) + if (error==HA_ERR_RECORD_DELETED) continue; printf("pos: %2d mi_rrnd: %3d errno: %3d\n",i,error,my_errno); return error; |