mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
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
This commit is contained in:
parent
c2ce702b3b
commit
70f79563d9
37 changed files with 408 additions and 463 deletions
|
|
@ -32,10 +32,10 @@ static void print_key(const char *key,const char * tail);
|
|||
static int run_test(const char *filename);
|
||||
static int read_with_pos(MI_INFO * file, int silent);
|
||||
|
||||
static int rtree_CreateLineStringWKB(double *ords, uint n_dims, uint n_points, uchar *wkb);
|
||||
static int rtree_CreateLineStringWKB(double *ords, uint n_dims, uint n_points,
|
||||
uchar *wkb);
|
||||
static void rtree_PrintWKB(uchar *wkb, uint n_dims);
|
||||
|
||||
|
||||
static char blob_key[MAX_REC_LENGTH];
|
||||
|
||||
|
||||
|
|
@ -46,7 +46,6 @@ int main(int argc __attribute__((unused)),char *argv[])
|
|||
}
|
||||
|
||||
|
||||
|
||||
int run_test(const char *filename)
|
||||
{
|
||||
MI_INFO *file;
|
||||
|
|
@ -55,7 +54,7 @@ int run_test(const char *filename)
|
|||
MI_COLUMNDEF recinfo[20];
|
||||
MI_KEYDEF keyinfo[20];
|
||||
HA_KEYSEG keyseg[20];
|
||||
|
||||
key_range min_range, max_range;
|
||||
int silent=0;
|
||||
int create_flag=0;
|
||||
int null_fields=0;
|
||||
|
|
@ -100,7 +99,7 @@ int run_test(const char *filename)
|
|||
keyinfo[0].seg[0].bit_start=4; /* Long BLOB */
|
||||
|
||||
|
||||
if(!silent)
|
||||
if (!silent)
|
||||
printf("- Creating isam-file\n");
|
||||
|
||||
bzero((char*) &create_info,sizeof(create_info));
|
||||
|
|
@ -113,17 +112,12 @@ 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");
|
||||
|
||||
|
|
@ -143,11 +137,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("- Deleting rows with position\n");
|
||||
for (i=0; i < nrecords/4; i++)
|
||||
|
|
@ -155,23 +147,20 @@ 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;
|
||||
}
|
||||
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/2 ; i++)
|
||||
|
|
@ -179,9 +168,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;
|
||||
|
|
@ -191,20 +180,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");
|
||||
|
||||
|
|
@ -219,25 +204,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");
|
||||
|
||||
|
|
@ -251,9 +231,9 @@ int run_test(const char *filename)
|
|||
print_record(read_record,mi_position(file)," mi_frirst\n");
|
||||
|
||||
for(i=0;i<nrecords;i++) {
|
||||
if((error=mi_rnext(file,read_record,0)))
|
||||
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;
|
||||
|
|
@ -263,22 +243,22 @@ int run_test(const char *filename)
|
|||
}
|
||||
printf(" %d rows\n",row_count);
|
||||
|
||||
|
||||
|
||||
|
||||
if (!silent)
|
||||
printf("- Test mi_records_in_range()\n");
|
||||
|
||||
create_key(key, nrecords*upd);
|
||||
print_key(key," INTERSECT\n");
|
||||
hrows=mi_records_in_range(file,0,key,0,HA_READ_MBR_INTERSECT,record+1,0,
|
||||
HA_READ_KEY_EXACT);
|
||||
min_range.key= key;
|
||||
min_range.length= 1000; /* Big enough */
|
||||
min_range.flag= HA_READ_MBR_INTERSECT;
|
||||
max_range.key= record+1;
|
||||
max_range.length= 1000; /* Big enough */
|
||||
max_range.flag= HA_READ_KEY_EXACT;
|
||||
hrows= mi_records_in_range(file,0, &min_range, &max_range);
|
||||
printf(" %ld rows\n", (long) hrows);
|
||||
|
||||
|
||||
if (mi_close(file)) goto err;
|
||||
my_end(MY_CHECK_ERROR);
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
|
|
@ -287,7 +267,6 @@ err:
|
|||
}
|
||||
|
||||
|
||||
|
||||
static int read_with_pos (MI_INFO * file,int silent)
|
||||
{
|
||||
int error;
|
||||
|
|
@ -302,11 +281,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;
|
||||
|
|
@ -351,7 +330,7 @@ static void print_record(char * record, my_off_t offs,const char * tail)
|
|||
pos+=4;
|
||||
printf(" len=%d ",len);
|
||||
memcpy_fixed(&ptr,pos,sizeof(char*));
|
||||
if(ptr)
|
||||
if (ptr)
|
||||
rtree_PrintWKB((uchar*) ptr,SPDIMS);
|
||||
else
|
||||
printf("<NULL> ");
|
||||
|
|
@ -360,7 +339,6 @@ static void print_record(char * record, my_off_t offs,const char * tail)
|
|||
}
|
||||
|
||||
|
||||
|
||||
#ifdef NOT_USED
|
||||
static void create_point(char *record,uint rownr)
|
||||
{
|
||||
|
|
@ -447,7 +425,6 @@ static void print_key(const char *key,const char * tail)
|
|||
}
|
||||
|
||||
|
||||
|
||||
#ifdef NOT_USED
|
||||
|
||||
static int rtree_CreatePointWKB(double *ords, uint n_dims, uchar *wkb)
|
||||
|
|
@ -489,6 +466,7 @@ static int rtree_CreateLineStringWKB(double *ords, uint n_dims, uint n_points,
|
|||
return 9 + n_points * n_dims * 8;
|
||||
}
|
||||
|
||||
|
||||
static void rtree_PrintWKB(uchar *wkb, uint n_dims)
|
||||
{
|
||||
uint wkb_type;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue