MI_KEYSEG -> HA_KEYSEG

_mi_key_cmp -> ha_key_cmp
parent eab2893d
...@@ -53,3 +53,4 @@ tonu@x3.internalnet ...@@ -53,3 +53,4 @@ tonu@x3.internalnet
venu@work.mysql.com venu@work.mysql.com
zak@balfor.local zak@balfor.local
zak@linux.local zak@linux.local
ram@gw.udmsearch.izhnet.ru
...@@ -42,7 +42,7 @@ typedef struct st_hp_hash_info ...@@ -42,7 +42,7 @@ typedef struct st_hp_hash_info
} HASH_INFO; } HASH_INFO;
typedef struct { typedef struct {
MI_KEYSEG *keyseg; HA_KEYSEG *keyseg;
uint key_length; uint key_length;
uint search_flag; uint search_flag;
} heap_rb_param; } heap_rb_param;
......
...@@ -195,7 +195,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) ...@@ -195,7 +195,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
{ {
/*register*/ /*register*/
ulong nr=1, nr2=4; ulong nr=1, nr2=4;
MI_KEYSEG *seg,*endseg; HA_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{ {
...@@ -242,7 +242,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) ...@@ -242,7 +242,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
{ {
/*register*/ /*register*/
ulong nr=1, nr2=4; ulong nr=1, nr2=4;
MI_KEYSEG *seg,*endseg; HA_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{ {
...@@ -300,7 +300,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) ...@@ -300,7 +300,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
{ {
register ulong nr=0; register ulong nr=0;
MI_KEYSEG *seg,*endseg; HA_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{ {
...@@ -341,7 +341,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) ...@@ -341,7 +341,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
{ {
register ulong nr=0; register ulong nr=0;
MI_KEYSEG *seg,*endseg; HA_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{ {
...@@ -381,7 +381,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) ...@@ -381,7 +381,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2) int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2)
{ {
MI_KEYSEG *seg,*endseg; HA_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{ {
...@@ -412,7 +412,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2) ...@@ -412,7 +412,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2)
int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key) int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
{ {
MI_KEYSEG *seg,*endseg; HA_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; for (seg=keydef->seg,endseg=seg+keydef->keysegs ;
seg < endseg ; seg < endseg ;
...@@ -450,7 +450,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key) ...@@ -450,7 +450,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec) void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec)
{ {
MI_KEYSEG *seg,*endseg; HA_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{ {
...@@ -464,7 +464,7 @@ void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec) ...@@ -464,7 +464,7 @@ void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec)
void hp_rb_make_key(HP_KEYDEF *keydef, byte *key, void hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
const byte *rec, byte *recpos) const byte *rec, byte *recpos)
{ {
MI_KEYSEG *seg, *endseg; HA_KEYSEG *seg, *endseg;
/* -1 means that HA_KEYTYPE_END segment will not copy */ /* -1 means that HA_KEYTYPE_END segment will not copy */
for (seg= keydef->seg, endseg= seg + keydef->keysegs - 1; seg < endseg; for (seg= keydef->seg, endseg= seg + keydef->keysegs - 1; seg < endseg;
...@@ -481,7 +481,7 @@ void hp_rb_make_key(HP_KEYDEF *keydef, byte *key, ...@@ -481,7 +481,7 @@ void hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
uint hp_rb_pack_key(HP_INFO *info, uint inx, uchar *key, const uchar *old, uint hp_rb_pack_key(HP_INFO *info, uint inx, uchar *key, const uchar *old,
uint k_length) uint k_length)
{ {
MI_KEYSEG *seg, *endseg; HA_KEYSEG *seg, *endseg;
uchar *start_key= key; uchar *start_key= key;
HP_KEYDEF *keydef= info->s->keydef + inx; HP_KEYDEF *keydef= info->s->keydef + inx;
...@@ -508,7 +508,7 @@ uint hp_rb_pack_key(HP_INFO *info, uint inx, uchar *key, const uchar *old, ...@@ -508,7 +508,7 @@ uint hp_rb_pack_key(HP_INFO *info, uint inx, uchar *key, const uchar *old,
my_bool hp_if_null_in_key(HP_KEYDEF *keydef, const byte *record) my_bool hp_if_null_in_key(HP_KEYDEF *keydef, const byte *record)
{ {
MI_KEYSEG *seg,*endseg; HA_KEYSEG *seg,*endseg;
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{ {
if (seg->null_bit && (record[seg->null_pos] & seg->null_bit)) if (seg->null_bit && (record[seg->null_pos] & seg->null_bit))
......
...@@ -41,7 +41,7 @@ HP_INFO *heap_open(const char *name, int mode, uint keys, HP_KEYDEF *keydef, ...@@ -41,7 +41,7 @@ HP_INFO *heap_open(const char *name, int mode, uint keys, HP_KEYDEF *keydef,
uint i,j,key_segs,max_length,length; uint i,j,key_segs,max_length,length;
HP_INFO *info; HP_INFO *info;
HP_SHARE *share; HP_SHARE *share;
MI_KEYSEG *keyseg; HA_KEYSEG *keyseg;
DBUG_ENTER("heap_open"); DBUG_ENTER("heap_open");
...@@ -72,14 +72,14 @@ HP_INFO *heap_open(const char *name, int mode, uint keys, HP_KEYDEF *keydef, ...@@ -72,14 +72,14 @@ HP_INFO *heap_open(const char *name, int mode, uint keys, HP_KEYDEF *keydef,
} }
if (!(share = (HP_SHARE*) my_malloc((uint) sizeof(HP_SHARE)+ if (!(share = (HP_SHARE*) my_malloc((uint) sizeof(HP_SHARE)+
keys*sizeof(HP_KEYDEF)+ keys*sizeof(HP_KEYDEF)+
key_segs*sizeof(MI_KEYSEG), key_segs*sizeof(HA_KEYSEG),
MYF(MY_ZEROFILL)))) MYF(MY_ZEROFILL))))
{ {
pthread_mutex_unlock(&THR_LOCK_heap); pthread_mutex_unlock(&THR_LOCK_heap);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
share->keydef=(HP_KEYDEF*) (share+1); share->keydef=(HP_KEYDEF*) (share+1);
keyseg=(MI_KEYSEG*) (share->keydef+keys); keyseg=(HA_KEYSEG*) (share->keydef+keys);
init_block(&share->block,reclength+1,min_records,max_records); init_block(&share->block,reclength+1,min_records,max_records);
/* Fix keys */ /* Fix keys */
memcpy(share->keydef,keydef,(size_t) (sizeof(keydef[0])*keys)); memcpy(share->keydef,keydef,(size_t) (sizeof(keydef[0])*keys));
......
...@@ -36,7 +36,7 @@ int main(int argc, char **argv) ...@@ -36,7 +36,7 @@ int main(int argc, char **argv)
char record[128],key[32]; char record[128],key[32];
const char *filename; const char *filename;
HP_KEYDEF keyinfo[10]; HP_KEYDEF keyinfo[10];
MI_KEYSEG keyseg[4]; HA_KEYSEG keyseg[4];
MY_INIT(argv[0]); MY_INIT(argv[0]);
filename= "test1"; filename= "test1";
......
...@@ -61,7 +61,7 @@ int main(int argc, char *argv[]) ...@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
const char *filename,*filename2; const char *filename,*filename2;
HP_INFO *file,*file2; HP_INFO *file,*file2;
HP_KEYDEF keyinfo[MAX_KEYS]; HP_KEYDEF keyinfo[MAX_KEYS];
MI_KEYSEG keyseg[MAX_KEYS*5]; HA_KEYSEG keyseg[MAX_KEYS*5];
HEAP_PTR position; HEAP_PTR position;
MY_INIT(argv[0]); /* init my_sys library & pthreads */ MY_INIT(argv[0]); /* init my_sys library & pthreads */
LINT_INIT(position); LINT_INIT(position);
......
...@@ -85,7 +85,7 @@ typedef struct st_hp_keydef /* Key definition with open */ ...@@ -85,7 +85,7 @@ typedef struct st_hp_keydef /* Key definition with open */
uint length; /* Length of key (automatic) */ uint length; /* Length of key (automatic) */
uint8 algorithm; /* HASH / BTREE */ uint8 algorithm; /* HASH / BTREE */
uint ref_offs; /* Data reference offset */ uint ref_offs; /* Data reference offset */
MI_KEYSEG *seg; HA_KEYSEG *seg;
HP_BLOCK block; /* Where keys are saved */ HP_BLOCK block; /* Where keys are saved */
TREE rb_tree; TREE rb_tree;
int (*write_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo, int (*write_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo,
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "m_ctype.h" #include "m_ctype.h"
#include "myisampack.h" #include "myisampack.h"
typedef struct st_MI_KEYSEG /* Key-portion */ typedef struct st_HA_KEYSEG /* Key-portion */
{ {
uint8 type; /* Type of key (for sort) */ uint8 type; /* Type of key (for sort) */
uint8 language; uint8 language;
...@@ -34,7 +34,7 @@ typedef struct st_MI_KEYSEG /* Key-portion */ ...@@ -34,7 +34,7 @@ typedef struct st_MI_KEYSEG /* Key-portion */
uint32 start; /* Start of key in record */ uint32 start; /* Start of key in record */
uint32 null_pos; /* position to NULL indicator */ uint32 null_pos; /* position to NULL indicator */
CHARSET_INFO *charset; CHARSET_INFO *charset;
} MI_KEYSEG; } HA_KEYSEG;
#define get_key_length(length,key) \ #define get_key_length(length,key) \
{ if ((uchar) *(key) != 255) \ { if ((uchar) *(key) != 255) \
...@@ -52,11 +52,11 @@ typedef struct st_MI_KEYSEG /* Key-portion */ ...@@ -52,11 +52,11 @@ typedef struct st_MI_KEYSEG /* Key-portion */
extern int _mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint , extern int _mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
my_bool); my_bool);
extern int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
register uchar *b, uint key_length, uint nextflag, register uchar *b, uint key_length, uint nextflag,
uint *diff_pos); uint *diff_pos);
extern int hp_rb_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, extern int hp_rb_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
register uchar *b, uint key_length, uint nextflag, register uchar *b, uint key_length, uint nextflag,
uint *diff_pos); uint *diff_pos);
......
...@@ -122,7 +122,7 @@ typedef struct st_mi_keydef /* Key definition with open & info */ ...@@ -122,7 +122,7 @@ typedef struct st_mi_keydef /* Key definition with open & info */
uint16 block_size; /* block_size (auto) */ uint16 block_size; /* block_size (auto) */
uint32 version; /* For concurrent read/write */ uint32 version; /* For concurrent read/write */
MI_KEYSEG *seg,*end; HA_KEYSEG *seg,*end;
int (*bin_search)(struct st_myisam_info *info,struct st_mi_keydef *keyinfo, int (*bin_search)(struct st_myisam_info *info,struct st_mi_keydef *keyinfo,
uchar *page,uchar *key, uchar *page,uchar *key,
uint key_len,uint comp_flag,uchar * *ret_pos, uint key_len,uint comp_flag,uchar * *ret_pos,
...@@ -146,7 +146,7 @@ typedef struct st_unique_def /* Segment definition of unique */ ...@@ -146,7 +146,7 @@ typedef struct st_unique_def /* Segment definition of unique */
uint16 keysegs; /* Number of key-segment */ uint16 keysegs; /* Number of key-segment */
uchar key; /* Mapped to which key */ uchar key; /* Mapped to which key */
uint8 null_are_equal; uint8 null_are_equal;
MI_KEYSEG *seg,*end; HA_KEYSEG *seg,*end;
} MI_UNIQUEDEF; } MI_UNIQUEDEF;
typedef struct st_mi_decode_tree /* Decode huff-table */ typedef struct st_mi_decode_tree /* Decode huff-table */
...@@ -318,7 +318,7 @@ typedef struct st_sort_info { ...@@ -318,7 +318,7 @@ typedef struct st_sort_info {
char *record,*buff; char *record,*buff;
void *wordlist, *wordptr; void *wordlist, *wordptr;
MI_KEYDEF *keyinfo; MI_KEYDEF *keyinfo;
MI_KEYSEG *keyseg; HA_KEYSEG *keyseg;
} SORT_INFO; } SORT_INFO;
typedef struct st_mi_check_param typedef struct st_mi_check_param
......
...@@ -33,7 +33,7 @@ FILE *df,*qf; ...@@ -33,7 +33,7 @@ FILE *df,*qf;
MI_COLUMNDEF recinfo[3]; MI_COLUMNDEF recinfo[3];
MI_KEYDEF keyinfo[2]; MI_KEYDEF keyinfo[2];
MI_KEYSEG keyseg[10]; HA_KEYSEG keyseg[10];
#define SWL_INIT 500 #define SWL_INIT 500
#define SWL_PLUS 50 #define SWL_PLUS 50
......
...@@ -23,7 +23,7 @@ ulong ft_max_word_len=HA_FT_MAXLEN; ...@@ -23,7 +23,7 @@ ulong ft_max_word_len=HA_FT_MAXLEN;
ulong ft_max_word_len_for_sort=20; ulong ft_max_word_len_for_sort=20;
const char *ft_boolean_syntax="+ -><()~*:\"\"&|"; const char *ft_boolean_syntax="+ -><()~*:\"\"&|";
const MI_KEYSEG ft_keysegs[FT_SEGS]={ const HA_KEYSEG ft_keysegs[FT_SEGS]={
{ {
HA_KEYTYPE_VARTEXT, /* type */ HA_KEYTYPE_VARTEXT, /* type */
7, /* language (will be overwritten) */ 7, /* language (will be overwritten) */
......
...@@ -45,7 +45,7 @@ int main(int argc,char *argv[]) ...@@ -45,7 +45,7 @@ int main(int argc,char *argv[])
static MI_COLUMNDEF recinfo[3]; static MI_COLUMNDEF recinfo[3];
static MI_KEYDEF keyinfo[2]; static MI_KEYDEF keyinfo[2];
static MI_KEYSEG keyseg[10]; static HA_KEYSEG keyseg[10];
static int run_test(const char *filename) static int run_test(const char *filename)
{ {
......
...@@ -122,7 +122,7 @@ byte ft_simple_get_word(byte **, byte *, FT_WORD *); ...@@ -122,7 +122,7 @@ byte ft_simple_get_word(byte **, byte *, FT_WORD *);
typedef struct _st_ft_seg_iterator { typedef struct _st_ft_seg_iterator {
uint num, len; uint num, len;
MI_KEYSEG *seg; HA_KEYSEG *seg;
const byte *rec, *pos; const byte *rec, *pos;
} FT_SEG_ITERATOR; } FT_SEG_ITERATOR;
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define FT_SEGS 2 #define FT_SEGS 2
#endif /* EVAL_RUN */ #endif /* EVAL_RUN */
extern const MI_KEYSEG ft_keysegs[FT_SEGS]; extern const HA_KEYSEG ft_keysegs[FT_SEGS];
int _mi_ft_cmp(MI_INFO *, uint, const byte *, const byte *); int _mi_ft_cmp(MI_INFO *, uint, const byte *, const byte *);
int _mi_ft_add(MI_INFO *, uint, byte *, const byte *, my_off_t); int _mi_ft_add(MI_INFO *, uint, byte *, const byte *, my_off_t);
......
...@@ -588,7 +588,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, ...@@ -588,7 +588,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
goto err; goto err;
} }
if ((*keys)++ && if ((*keys)++ &&
(flag=_mi_key_cmp(keyinfo->seg,info->lastkey,key,key_length, (flag=ha_key_cmp(keyinfo->seg,info->lastkey,key,key_length,
comp_flag, &not_used)) >=0) comp_flag, &not_used)) >=0)
{ {
DBUG_DUMP("old",(byte*) info->lastkey, info->lastkey_length); DBUG_DUMP("old",(byte*) info->lastkey, info->lastkey_length);
...@@ -606,7 +606,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, ...@@ -606,7 +606,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
if (*keys != 1L) /* not first_key */ if (*keys != 1L) /* not first_key */
{ {
uint diff; uint diff;
_mi_key_cmp(keyinfo->seg,info->lastkey,key,USE_WHOLE_KEY,SEARCH_FIND, ha_key_cmp(keyinfo->seg,info->lastkey,key,USE_WHOLE_KEY,SEARCH_FIND,
&diff); &diff);
param->unique_count[diff-1]++; param->unique_count[diff-1]++;
} }
...@@ -674,7 +674,7 @@ static ha_checksum calc_checksum(ha_rows count) ...@@ -674,7 +674,7 @@ static ha_checksum calc_checksum(ha_rows count)
static uint isam_key_length(MI_INFO *info, register MI_KEYDEF *keyinfo) static uint isam_key_length(MI_INFO *info, register MI_KEYDEF *keyinfo)
{ {
uint length; uint length;
MI_KEYSEG *keyseg; HA_KEYSEG *keyseg;
DBUG_ENTER("isam_key_length"); DBUG_ENTER("isam_key_length");
length= info->s->rec_reflength; length= info->s->rec_reflength;
...@@ -2625,7 +2625,7 @@ int sort_write_record(SORT_INFO *sort_info) ...@@ -2625,7 +2625,7 @@ int sort_write_record(SORT_INFO *sort_info)
static int sort_key_cmp(SORT_INFO *sort_info, const void *a, const void *b) static int sort_key_cmp(SORT_INFO *sort_info, const void *a, const void *b)
{ {
uint not_used; uint not_used;
return (_mi_key_cmp(sort_info->keyseg,*((uchar**) a),*((uchar**) b), return (ha_key_cmp(sort_info->keyseg,*((uchar**) a),*((uchar**) b),
USE_WHOLE_KEY, SEARCH_SAME,&not_used)); USE_WHOLE_KEY, SEARCH_SAME,&not_used));
} /* sort_key_cmp */ } /* sort_key_cmp */
...@@ -2639,7 +2639,7 @@ static int sort_key_write(SORT_INFO *sort_info, const void *a) ...@@ -2639,7 +2639,7 @@ static int sort_key_write(SORT_INFO *sort_info, const void *a)
if (sort_info->key_block->inited) if (sort_info->key_block->inited)
{ {
cmp=_mi_key_cmp(sort_info->keyseg,sort_info->key_block->lastkey,(uchar*) a, cmp=ha_key_cmp(sort_info->keyseg,sort_info->key_block->lastkey,(uchar*) a,
USE_WHOLE_KEY,SEARCH_FIND | SEARCH_UPDATE ,&diff_pos); USE_WHOLE_KEY,SEARCH_FIND | SEARCH_UPDATE ,&diff_pos);
sort_info->unique[diff_pos-1]++; sort_info->unique[diff_pos-1]++;
} }
...@@ -2922,7 +2922,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) ...@@ -2922,7 +2922,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
MI_INFO info; MI_INFO info;
MYISAM_SHARE share; MYISAM_SHARE share;
MI_KEYDEF *keyinfo,*key,*key_end; MI_KEYDEF *keyinfo,*key,*key_end;
MI_KEYSEG *keysegs,*keyseg; HA_KEYSEG *keysegs,*keyseg;
MI_COLUMNDEF *recdef,*rec,*end; MI_COLUMNDEF *recdef,*rec,*end;
MI_UNIQUEDEF *uniquedef,*u_ptr,*u_end; MI_UNIQUEDEF *uniquedef,*u_ptr,*u_end;
MI_STATUS_INFO status_info; MI_STATUS_INFO status_info;
...@@ -2944,7 +2944,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) ...@@ -2944,7 +2944,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
(size_t) (sizeof(MI_KEYDEF)*share.base.keys)); (size_t) (sizeof(MI_KEYDEF)*share.base.keys));
key_parts= share.base.all_key_parts; key_parts= share.base.all_key_parts;
if (!(keysegs=(MI_KEYSEG*) my_alloca(sizeof(MI_KEYSEG)* if (!(keysegs=(HA_KEYSEG*) my_alloca(sizeof(HA_KEYSEG)*
(key_parts+share.base.keys)))) (key_parts+share.base.keys))))
{ {
my_afree((gptr) keyinfo); my_afree((gptr) keyinfo);
...@@ -2980,7 +2980,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) ...@@ -2980,7 +2980,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
/* Change the new key to point at the saved key segments */ /* Change the new key to point at the saved key segments */
memcpy((byte*) keysegs,(byte*) share.keyparts, memcpy((byte*) keysegs,(byte*) share.keyparts,
(size_t) (sizeof(MI_KEYSEG)*(key_parts+share.base.keys+ (size_t) (sizeof(HA_KEYSEG)*(key_parts+share.base.keys+
share.state.header.uniques))); share.state.header.uniques)));
keyseg=keysegs; keyseg=keysegs;
for (key=keyinfo,key_end=keyinfo+share.base.keys; key != key_end ; key++) for (key=keyinfo,key_end=keyinfo+share.base.keys; key != key_end ; key++)
......
...@@ -53,7 +53,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -53,7 +53,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
MYISAM_SHARE share; MYISAM_SHARE share;
MI_KEYDEF *keydef,tmp_keydef; MI_KEYDEF *keydef,tmp_keydef;
MI_UNIQUEDEF *uniquedef; MI_UNIQUEDEF *uniquedef;
MI_KEYSEG *keyseg,tmp_keyseg; HA_KEYSEG *keyseg,tmp_keyseg;
MI_COLUMNDEF *rec; MI_COLUMNDEF *rec;
ulong *rec_per_key_part; ulong *rec_per_key_part;
my_off_t key_root[MI_MAX_POSSIBLE_KEY],key_del[MI_MAX_KEY_BLOCK_SIZE]; my_off_t key_root[MI_MAX_POSSIBLE_KEY],key_del[MI_MAX_KEY_BLOCK_SIZE];
...@@ -440,7 +440,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -440,7 +440,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
info_length=base_pos+(uint) (MI_BASE_INFO_SIZE+ info_length=base_pos+(uint) (MI_BASE_INFO_SIZE+
keys * MI_KEYDEF_SIZE+ keys * MI_KEYDEF_SIZE+
uniques * MI_UNIQUEDEF_SIZE + uniques * MI_UNIQUEDEF_SIZE +
(key_segs + unique_key_parts)*MI_KEYSEG_SIZE+ (key_segs + unique_key_parts)*HA_KEYSEG_SIZE+
columns*MI_COLUMNDEF_SIZE); columns*MI_COLUMNDEF_SIZE);
bmove(share.state.header.file_version,(byte*) myisam_file_magic,4); bmove(share.state.header.file_version,(byte*) myisam_file_magic,4);
...@@ -596,14 +596,14 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -596,14 +596,14 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
goto err; goto err;
for (j=0 ; j < ft_segs ; j++) for (j=0 ; j < ft_segs ; j++)
{ {
MI_KEYSEG seg=ft_keysegs[j]; HA_KEYSEG seg=ft_keysegs[j];
seg.language= keydefs[i].seg[0].language; seg.language= keydefs[i].seg[0].language;
if (mi_keyseg_write(file, &seg)) if (mi_keyseg_write(file, &seg))
goto err; goto err;
} }
for (j=0 ; j < sp_segs ; j++) for (j=0 ; j < sp_segs ; j++)
{ {
MI_KEYSEG sseg; HA_KEYSEG sseg;
sseg.type=SPTYPE; sseg.type=SPTYPE;
sseg.language= 7; sseg.language= 7;
sseg.null_bit=0; sseg.null_bit=0;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/* Print a key in user understandable format */ /* Print a key in user understandable format */
void _mi_print_key(FILE *stream, register MI_KEYSEG *keyseg, void _mi_print_key(FILE *stream, register HA_KEYSEG *keyseg,
const uchar *key, uint length) const uchar *key, uint length)
{ {
int flag; int flag;
......
...@@ -37,7 +37,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, ...@@ -37,7 +37,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
{ {
byte *pos,*end; byte *pos,*end;
uchar *start; uchar *start;
reg1 MI_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
DBUG_ENTER("_mi_make_key"); DBUG_ENTER("_mi_make_key");
if(info->s->keyinfo[keynr].flag & HA_SPATIAL) if(info->s->keyinfo[keynr].flag & HA_SPATIAL)
...@@ -153,7 +153,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, ...@@ -153,7 +153,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
{ {
uint length; uint length;
uchar *pos,*end,*start_key=key; uchar *pos,*end,*start_key=key;
reg1 MI_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
enum ha_base_keytype type; enum ha_base_keytype type;
DBUG_ENTER("_mi_pack_key"); DBUG_ENTER("_mi_pack_key");
...@@ -252,7 +252,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, ...@@ -252,7 +252,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
{ {
reg2 byte *key; reg2 byte *key;
byte *pos,*key_end; byte *pos,*key_end;
reg1 MI_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
byte *blob_ptr; byte *blob_ptr;
DBUG_ENTER("_mi_put_key_in_record"); DBUG_ENTER("_mi_put_key_in_record");
...@@ -385,7 +385,7 @@ int _mi_read_key_record(MI_INFO *info, my_off_t filepos, byte *buf) ...@@ -385,7 +385,7 @@ int _mi_read_key_record(MI_INFO *info, my_off_t filepos, byte *buf)
void update_auto_increment(MI_INFO *info,const byte *record) void update_auto_increment(MI_INFO *info,const byte *record)
{ {
ulonglong value; ulonglong value;
MI_KEYSEG *keyseg=info->s->keyinfo[info->s->base.auto_key-1].seg; HA_KEYSEG *keyseg=info->s->keyinfo[info->s->base.auto_key-1].seg;
const uchar *key=(uchar*) record+keyseg->start; const uchar *key=(uchar*) record+keyseg->start;
switch (keyseg->type) { switch (keyseg->type) {
......
...@@ -256,7 +256,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) ...@@ -256,7 +256,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
&share->uniqueinfo,uniques*sizeof(MI_UNIQUEDEF), &share->uniqueinfo,uniques*sizeof(MI_UNIQUEDEF),
&share->keyparts, &share->keyparts,
(key_parts+unique_key_parts+keys+uniques) * (key_parts+unique_key_parts+keys+uniques) *
sizeof(MI_KEYSEG), sizeof(HA_KEYSEG),
&share->rec, &share->rec,
(share->base.fields+1)*sizeof(MI_COLUMNDEF), (share->base.fields+1)*sizeof(MI_COLUMNDEF),
&share->blobs,sizeof(MI_BLOB)*share->base.blobs, &share->blobs,sizeof(MI_BLOB)*share->base.blobs,
...@@ -286,7 +286,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) ...@@ -286,7 +286,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share->blocksize=min(IO_SIZE,myisam_block_size); share->blocksize=min(IO_SIZE,myisam_block_size);
{ {
MI_KEYSEG *pos=share->keyparts; HA_KEYSEG *pos=share->keyparts;
for (i=0 ; i < keys ; i++) for (i=0 ; i < keys ; i++)
{ {
disk_pos=mi_keydef_read(disk_pos, &share->keyinfo[i]); disk_pos=mi_keydef_read(disk_pos, &share->keyinfo[i]);
...@@ -949,9 +949,9 @@ char *mi_keydef_read(char *ptr, MI_KEYDEF *keydef) ...@@ -949,9 +949,9 @@ char *mi_keydef_read(char *ptr, MI_KEYDEF *keydef)
** mi_keyseg ** mi_keyseg
***************************************************************************/ ***************************************************************************/
int mi_keyseg_write(File file, const MI_KEYSEG *keyseg) int mi_keyseg_write(File file, const HA_KEYSEG *keyseg)
{ {
uchar buff[MI_KEYSEG_SIZE]; uchar buff[HA_KEYSEG_SIZE];
uchar *ptr=buff; uchar *ptr=buff;
*ptr++ =keyseg->type; *ptr++ =keyseg->type;
...@@ -969,7 +969,7 @@ int mi_keyseg_write(File file, const MI_KEYSEG *keyseg) ...@@ -969,7 +969,7 @@ int mi_keyseg_write(File file, const MI_KEYSEG *keyseg)
} }
char *mi_keyseg_read(char *ptr, MI_KEYSEG *keyseg) char *mi_keyseg_read(char *ptr, HA_KEYSEG *keyseg)
{ {
keyseg->type = *ptr++; keyseg->type = *ptr++;
keyseg->language = *ptr++; keyseg->language = *ptr++;
......
...@@ -60,7 +60,7 @@ int mi_rnext_same(MI_INFO *info, byte *buf) ...@@ -60,7 +60,7 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
info->lastkey_length,flag, info->lastkey_length,flag,
info->s->state.key_root[inx]))) info->s->state.key_root[inx])))
break; break;
if (_mi_key_cmp(keyinfo->seg,info->lastkey2,info->lastkey, if (ha_key_cmp(keyinfo->seg,info->lastkey2,info->lastkey,
info->last_rkey_length, SEARCH_FIND, &not_used)) info->last_rkey_length, SEARCH_FIND, &not_used))
{ {
error=1; error=1;
......
...@@ -133,7 +133,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -133,7 +133,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
&info->lastkey_length)) &info->lastkey_length))
goto err; goto err;
if ((nextflag & SEARCH_LAST) && if ((nextflag & SEARCH_LAST) &&
_mi_key_cmp(keyinfo->seg, info->lastkey, key, key_len, SEARCH_FIND, ha_key_cmp(keyinfo->seg, info->lastkey, key, key_len, SEARCH_FIND,
&not_used)) &not_used))
{ {
my_errno=HA_ERR_KEY_NOT_FOUND; /* Didn't find key */ my_errno=HA_ERR_KEY_NOT_FOUND; /* Didn't find key */
...@@ -191,7 +191,7 @@ int _mi_bin_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, ...@@ -191,7 +191,7 @@ int _mi_bin_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
while (start != end) while (start != end)
{ {
mid= (start+end)/2; mid= (start+end)/2;
if ((flag=_mi_key_cmp(keyinfo->seg,page+(uint) mid*totlength,key,key_len, if ((flag=ha_key_cmp(keyinfo->seg,page+(uint) mid*totlength,key,key_len,
comp_flag,&not_used)) comp_flag,&not_used))
>= 0) >= 0)
end=mid; end=mid;
...@@ -199,7 +199,7 @@ int _mi_bin_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, ...@@ -199,7 +199,7 @@ int _mi_bin_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
start=mid+1; start=mid+1;
} }
if (mid != start) if (mid != start)
flag=_mi_key_cmp(keyinfo->seg,page+(uint) start*totlength,key,key_len, flag=ha_key_cmp(keyinfo->seg,page+(uint) start*totlength,key,key_len,
comp_flag,&not_used); comp_flag,&not_used);
if (flag < 0) if (flag < 0)
start++; /* point at next, bigger key */ start++; /* point at next, bigger key */
...@@ -239,7 +239,7 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, ...@@ -239,7 +239,7 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
length,page,end)); length,page,end));
DBUG_RETURN(MI_FOUND_WRONG_KEY); DBUG_RETURN(MI_FOUND_WRONG_KEY);
} }
if ((flag=_mi_key_cmp(keyinfo->seg,t_buff,key,key_len,comp_flag, if ((flag=ha_key_cmp(keyinfo->seg,t_buff,key,key_len,comp_flag,
&not_used)) >= 0) &not_used)) >= 0)
break; break;
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
...@@ -262,7 +262,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, ...@@ -262,7 +262,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
{ {
/* my_flag is raw comparison result to be changed according to /* my_flag is raw comparison result to be changed according to
SEARCH_NO_FIND,SEARCH_LAST and HA_REVERSE_SORT flags. SEARCH_NO_FIND,SEARCH_LAST and HA_REVERSE_SORT flags.
flag is the value returned by _mi_key_cmp and as treated as final */ flag is the value returned by ha_key_cmp and as treated as final */
int flag=0, my_flag=-1; int flag=0, my_flag=-1;
uint nod_flag, length, len, matched, cmplen, kseg_len; uint nod_flag, length, len, matched, cmplen, kseg_len;
uint prefix_len,suffix_len; uint prefix_len,suffix_len;
...@@ -351,7 +351,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, ...@@ -351,7 +351,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
DBUG_PRINT("loop",("page: '%.*s%.*s'",prefix_len,t_buff+seg_len_pack,suffix_len,vseg)); DBUG_PRINT("loop",("page: '%.*s%.*s'",prefix_len,t_buff+seg_len_pack,suffix_len,vseg));
{ {
uchar *from=vseg+suffix_len; uchar *from=vseg+suffix_len;
MI_KEYSEG *keyseg; HA_KEYSEG *keyseg;
uint l; uint l;
for (keyseg=keyinfo->seg+1 ; keyseg->type ; keyseg++ ) for (keyseg=keyinfo->seg+1 ; keyseg->type ; keyseg++ )
...@@ -423,7 +423,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, ...@@ -423,7 +423,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
else if (key_len_left>0) else if (key_len_left>0)
{ {
uint not_used; uint not_used;
if ((flag = _mi_key_cmp(keyinfo->seg+1,vseg, if ((flag = ha_key_cmp(keyinfo->seg+1,vseg,
k,key_len_left,nextflag,&not_used)) >= 0) k,key_len_left,nextflag,&not_used)) >= 0)
break; break;
} }
...@@ -674,7 +674,7 @@ uint _mi_get_static_key(register MI_KEYDEF *keyinfo, uint nod_flag, ...@@ -674,7 +674,7 @@ uint _mi_get_static_key(register MI_KEYDEF *keyinfo, uint nod_flag,
uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
register uchar **page_pos, register uchar *key) register uchar **page_pos, register uchar *key)
{ {
reg1 MI_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
uchar *start_key,*page=*page_pos; uchar *start_key,*page=*page_pos;
uint length; uint length;
...@@ -807,7 +807,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, ...@@ -807,7 +807,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
register uchar **page_pos, register uchar *key) register uchar **page_pos, register uchar *key)
{ {
reg1 MI_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
uchar *start_key,*page=*page_pos,*page_end,*from,*from_end; uchar *start_key,*page=*page_pos,*page_end,*from,*from_end;
uint length,tmp; uint length,tmp;
...@@ -1006,7 +1006,7 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, ...@@ -1006,7 +1006,7 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
uint _mi_keylength(MI_KEYDEF *keyinfo, register uchar *key) uint _mi_keylength(MI_KEYDEF *keyinfo, register uchar *key)
{ {
reg1 MI_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
uchar *start; uchar *start;
if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY))) if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
...@@ -1272,7 +1272,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key, ...@@ -1272,7 +1272,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
uchar *org_key, uchar *prev_key, uchar *key, uchar *org_key, uchar *prev_key, uchar *key,
MI_KEY_PARAM *s_temp) MI_KEY_PARAM *s_temp)
{ {
reg1 MI_KEYSEG *keyseg; reg1 HA_KEYSEG *keyseg;
int length; int length;
uint key_length,ref_length,org_key_length=0, uint key_length,ref_length,org_key_length=0,
length_pack,new_key_length,diff_flag,pack_marker; length_pack,new_key_length,diff_flag,pack_marker;
......
...@@ -33,8 +33,8 @@ static uint unique_key=HA_NOSAME,key_cacheing=0,opt_unique=0; ...@@ -33,8 +33,8 @@ static uint unique_key=HA_NOSAME,key_cacheing=0,opt_unique=0;
static uint silent; static uint silent;
static MI_COLUMNDEF recinfo[4]; static MI_COLUMNDEF recinfo[4];
static MI_KEYDEF keyinfo[10]; static MI_KEYDEF keyinfo[10];
static MI_KEYSEG keyseg[10]; static HA_KEYSEG keyseg[10];
static MI_KEYSEG uniqueseg[10]; static HA_KEYSEG uniqueseg[10];
static int run_test(const char *filename); static int run_test(const char *filename);
static void get_options(int argc, char *argv[]); static void get_options(int argc, char *argv[]);
......
...@@ -55,7 +55,7 @@ static uint use_blob=0; ...@@ -55,7 +55,7 @@ static uint use_blob=0;
static uint16 key1[1001],key3[5000]; static uint16 key1[1001],key3[5000];
static char record[300],record2[300],key[100],key2[100], static char record[300],record2[300],key[100],key2[100],
read_record[300],read_record2[300],read_record3[300]; read_record[300],read_record2[300],read_record3[300];
static MI_KEYSEG glob_keyseg[MYISAM_KEYS][MAX_PARTS]; static HA_KEYSEG glob_keyseg[MYISAM_KEYS][MAX_PARTS];
/* Test program */ /* Test program */
...@@ -1006,7 +1006,7 @@ static void put_blob_in_record(char *blob_pos, char **blob_buffer) ...@@ -1006,7 +1006,7 @@ static void put_blob_in_record(char *blob_pos, char **blob_buffer)
static void copy_key(MI_INFO *info,uint inx,uchar *rec,uchar *key_buff) static void copy_key(MI_INFO *info,uint inx,uchar *rec,uchar *key_buff)
{ {
MI_KEYSEG *keyseg; HA_KEYSEG *keyseg;
for (keyseg=info->s->keyinfo[inx].seg ; keyseg->type ; keyseg++) for (keyseg=info->s->keyinfo[inx].seg ; keyseg->type ; keyseg++)
{ {
......
...@@ -59,7 +59,7 @@ int main(int argc,char **argv) ...@@ -59,7 +59,7 @@ int main(int argc,char **argv)
uint i=0; uint i=0;
MI_KEYDEF keyinfo[10]; MI_KEYDEF keyinfo[10];
MI_COLUMNDEF recinfo[10]; MI_COLUMNDEF recinfo[10];
MI_KEYSEG keyseg[10][2]; HA_KEYSEG keyseg[10][2];
MY_INIT(argv[0]); MY_INIT(argv[0]);
get_options(argc,argv); get_options(argc,argv);
......
...@@ -70,7 +70,7 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record) ...@@ -70,7 +70,7 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
{ {
const byte *pos, *end; const byte *pos, *end;
ha_checksum crc=0; ha_checksum crc=0;
MI_KEYSEG *keyseg; HA_KEYSEG *keyseg;
for (keyseg=def->seg ; keyseg < def->end ; keyseg++) for (keyseg=def->seg ; keyseg < def->end ; keyseg++)
{ {
...@@ -122,7 +122,7 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b, ...@@ -122,7 +122,7 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b,
my_bool null_are_equal) my_bool null_are_equal)
{ {
const byte *pos_a, *pos_b, *end; const byte *pos_a, *pos_b, *end;
MI_KEYSEG *keyseg; HA_KEYSEG *keyseg;
for (keyseg=def->seg ; keyseg < def->end ; keyseg++) for (keyseg=def->seg ; keyseg < def->end ; keyseg++)
{ {
......
...@@ -764,7 +764,7 @@ int _mi_ck_write_tree(register MI_INFO *info, uint keynr, uchar *key, ...@@ -764,7 +764,7 @@ int _mi_ck_write_tree(register MI_INFO *info, uint keynr, uchar *key,
static int keys_compare(bulk_insert_param *param, uchar *key1, uchar *key2) static int keys_compare(bulk_insert_param *param, uchar *key1, uchar *key2)
{ {
uint not_used; uint not_used;
return _mi_key_cmp(param->info->s->keyinfo[param->keynr].seg, return ha_key_cmp(param->info->s->keyinfo[param->keynr].seg,
key1, key2, USE_WHOLE_KEY, SEARCH_SAME, key1, key2, USE_WHOLE_KEY, SEARCH_SAME,
&not_used); &not_used);
} }
......
...@@ -1062,7 +1062,7 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name) ...@@ -1062,7 +1062,7 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name)
{ {
uint key,keyseg_nr,field,start; uint key,keyseg_nr,field,start;
reg3 MI_KEYDEF *keyinfo; reg3 MI_KEYDEF *keyinfo;
reg2 MI_KEYSEG *keyseg; reg2 HA_KEYSEG *keyseg;
reg4 const char *text; reg4 const char *text;
char buff[160],length[10],*pos,*end; char buff[160],length[10],*pos,*end;
enum en_fieldtype type; enum en_fieldtype type;
......
...@@ -96,7 +96,7 @@ typedef struct st_mi_state_info ...@@ -96,7 +96,7 @@ typedef struct st_mi_state_info
#define MI_STATE_EXTRA_SIZE ((MI_MAX_KEY+MI_MAX_KEY_BLOCK_SIZE)*MI_STATE_KEY_SIZE + MI_MAX_KEY*MI_MAX_KEY_SEG*MI_STATE_KEYSEG_SIZE) #define MI_STATE_EXTRA_SIZE ((MI_MAX_KEY+MI_MAX_KEY_BLOCK_SIZE)*MI_STATE_KEY_SIZE + MI_MAX_KEY*MI_MAX_KEY_SEG*MI_STATE_KEYSEG_SIZE)
#define MI_KEYDEF_SIZE (2+ 5*2) #define MI_KEYDEF_SIZE (2+ 5*2)
#define MI_UNIQUEDEF_SIZE (2+1+1) #define MI_UNIQUEDEF_SIZE (2+1+1)
#define MI_KEYSEG_SIZE (6+ 2*2 + 4*2) #define HA_KEYSEG_SIZE (6+ 2*2 + 4*2)
#define MI_COLUMNDEF_SIZE (2*3+1) #define MI_COLUMNDEF_SIZE (2*3+1)
#define MI_BASE_INFO_SIZE (5*8 + 8*4 + 4 + 4*2 + 16) #define MI_BASE_INFO_SIZE (5*8 + 8*4 + 4 + 4*2 + 16)
#define MI_INDEX_BLOCK_MARGIN 16 /* Safety margin for .MYI tables */ #define MI_INDEX_BLOCK_MARGIN 16 /* Safety margin for .MYI tables */
...@@ -156,7 +156,7 @@ typedef struct st_mi_isam_share { /* Shared between opens */ ...@@ -156,7 +156,7 @@ typedef struct st_mi_isam_share { /* Shared between opens */
MI_BASE_INFO base; MI_BASE_INFO base;
MI_KEYDEF *keyinfo; /* Key definitions */ MI_KEYDEF *keyinfo; /* Key definitions */
MI_UNIQUEDEF *uniqueinfo; /* unique definitions */ MI_UNIQUEDEF *uniqueinfo; /* unique definitions */
MI_KEYSEG *keyparts; /* key part info */ HA_KEYSEG *keyparts; /* key part info */
MI_COLUMNDEF *rec; /* Pointer to field information */ MI_COLUMNDEF *rec; /* Pointer to field information */
MI_PACK pack; /* Data about packed records */ MI_PACK pack; /* Data about packed records */
MI_BLOB *blobs; /* Pointer to blobs */ MI_BLOB *blobs; /* Pointer to blobs */
...@@ -355,7 +355,7 @@ struct st_myisam_info { ...@@ -355,7 +355,7 @@ struct st_myisam_info {
#define PACK_TYPE_SELECTED 1 /* Bits in field->pack_type */ #define PACK_TYPE_SELECTED 1 /* Bits in field->pack_type */
#define PACK_TYPE_SPACE_FIELDS 2 #define PACK_TYPE_SPACE_FIELDS 2
#define PACK_TYPE_ZERO_FILL 4 #define PACK_TYPE_ZERO_FILL 4
#define MI_FOUND_WRONG_KEY 32738 /* Impossible value from _mi_key_cmp */ #define MI_FOUND_WRONG_KEY 32738 /* Impossible value from ha_key_cmp */
#define MI_MAX_KEY_BLOCK_SIZE (MI_MAX_KEY_BLOCK_LENGTH/MI_MIN_KEY_BLOCK_LENGTH) #define MI_MAX_KEY_BLOCK_SIZE (MI_MAX_KEY_BLOCK_LENGTH/MI_MIN_KEY_BLOCK_LENGTH)
#define MI_BLOCK_SIZE(key_length,data_pointer,key_pointer) ((((key_length+data_pointer+key_pointer)*4+key_pointer+2)/myisam_block_size+1)*myisam_block_size) #define MI_BLOCK_SIZE(key_length,data_pointer,key_pointer) ((((key_length+data_pointer+key_pointer)*4+key_pointer+2)/myisam_block_size+1)*myisam_block_size)
...@@ -475,7 +475,7 @@ extern void _mi_kpointer(MI_INFO *info,uchar *buff,my_off_t pos); ...@@ -475,7 +475,7 @@ extern void _mi_kpointer(MI_INFO *info,uchar *buff,my_off_t pos);
extern my_off_t _mi_dpos(MI_INFO *info, uint nod_flag,uchar *after_key); extern my_off_t _mi_dpos(MI_INFO *info, uint nod_flag,uchar *after_key);
extern my_off_t _mi_rec_pos(MYISAM_SHARE *info, uchar *ptr); extern my_off_t _mi_rec_pos(MYISAM_SHARE *info, uchar *ptr);
extern void _mi_dpointer(MI_INFO *info, uchar *buff,my_off_t pos); extern void _mi_dpointer(MI_INFO *info, uchar *buff,my_off_t pos);
extern int _mi_key_cmp(MI_KEYSEG *keyseg, uchar *a,uchar *b, extern int ha_key_cmp(HA_KEYSEG *keyseg, uchar *a,uchar *b,
uint key_length,uint nextflag,uint *diff_length); uint key_length,uint nextflag,uint *diff_length);
extern uint _mi_get_static_key(MI_KEYDEF *keyinfo,uint nod_flag,uchar * *page, extern uint _mi_get_static_key(MI_KEYDEF *keyinfo,uint nod_flag,uchar * *page,
uchar *key); uchar *key);
...@@ -515,7 +515,7 @@ extern my_bool _mi_rec_check(MI_INFO *info,const char *from); ...@@ -515,7 +515,7 @@ extern my_bool _mi_rec_check(MI_INFO *info,const char *from);
extern int _mi_write_part_record(MI_INFO *info,my_off_t filepos,ulong length, extern int _mi_write_part_record(MI_INFO *info,my_off_t filepos,ulong length,
my_off_t next_filepos,byte **record, my_off_t next_filepos,byte **record,
ulong *reclength,int *flag); ulong *reclength,int *flag);
extern void _mi_print_key(FILE *stream,MI_KEYSEG *keyseg,const uchar *key, extern void _mi_print_key(FILE *stream,HA_KEYSEG *keyseg,const uchar *key,
uint length); uint length);
extern my_bool _mi_read_pack_info(MI_INFO *info,pbool fix_keys); extern my_bool _mi_read_pack_info(MI_INFO *info,pbool fix_keys);
extern int _mi_read_pack_record(MI_INFO *info,my_off_t filepos,byte *buf); extern int _mi_read_pack_record(MI_INFO *info,my_off_t filepos,byte *buf);
...@@ -606,8 +606,8 @@ char *mi_state_info_read(char *ptr, MI_STATE_INFO *state); ...@@ -606,8 +606,8 @@ char *mi_state_info_read(char *ptr, MI_STATE_INFO *state);
uint mi_state_info_read_dsk(File file, MI_STATE_INFO *state, my_bool pRead); uint mi_state_info_read_dsk(File file, MI_STATE_INFO *state, my_bool pRead);
uint mi_base_info_write(File file, MI_BASE_INFO *base); uint mi_base_info_write(File file, MI_BASE_INFO *base);
char *my_n_base_info_read(char *ptr, MI_BASE_INFO *base); char *my_n_base_info_read(char *ptr, MI_BASE_INFO *base);
int mi_keyseg_write(File file, const MI_KEYSEG *keyseg); int mi_keyseg_write(File file, const HA_KEYSEG *keyseg);
char *mi_keyseg_read(char *ptr, MI_KEYSEG *keyseg); char *mi_keyseg_read(char *ptr, HA_KEYSEG *keyseg);
uint mi_keydef_write(File file, MI_KEYDEF *keydef); uint mi_keydef_write(File file, MI_KEYDEF *keydef);
char *mi_keydef_read(char *ptr, MI_KEYDEF *keydef); char *mi_keydef_read(char *ptr, MI_KEYDEF *keydef);
uint mi_uniquedef_write(File file, MI_UNIQUEDEF *keydef); uint mi_uniquedef_write(File file, MI_UNIQUEDEF *keydef);
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
MBR_DATA(a,b) Data reference is the same MBR_DATA(a,b) Data reference is the same
Returns 0 on success. Returns 0 on success.
*/ */
int rtree_key_cmp(MI_KEYSEG *keyseg, uchar *b, uchar *a, uint key_length, int rtree_key_cmp(HA_KEYSEG *keyseg, uchar *b, uchar *a, uint key_length,
uint nextflag) uint nextflag)
{ {
for (; (int) key_length > 0; keyseg += 2 ) for (; (int) key_length > 0; keyseg += 2 )
...@@ -186,7 +186,7 @@ int rtree_key_cmp(MI_KEYSEG *keyseg, uchar *b, uchar *a, uint key_length, ...@@ -186,7 +186,7 @@ int rtree_key_cmp(MI_KEYSEG *keyseg, uchar *b, uchar *a, uint key_length,
/* /*
Calculates rectangle volume Calculates rectangle volume
*/ */
double rtree_rect_volume(MI_KEYSEG *keyseg, uchar *a, uint key_length) double rtree_rect_volume(HA_KEYSEG *keyseg, uchar *a, uint key_length)
{ {
double res = 1; double res = 1;
for (; (int)key_length > 0; keyseg += 2) for (; (int)key_length > 0; keyseg += 2)
...@@ -269,7 +269,7 @@ double rtree_rect_volume(MI_KEYSEG *keyseg, uchar *a, uint key_length) ...@@ -269,7 +269,7 @@ double rtree_rect_volume(MI_KEYSEG *keyseg, uchar *a, uint key_length)
/* /*
Creates an MBR as an array of doubles. Creates an MBR as an array of doubles.
*/ */
int rtree_d_mbr(MI_KEYSEG *keyseg, uchar *a, uint key_length, double *res) int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
{ {
for (; (int)key_length > 0; keyseg += 2) for (; (int)key_length > 0; keyseg += 2)
{ {
...@@ -366,7 +366,7 @@ Creates common minimal bounding rectungle ...@@ -366,7 +366,7 @@ Creates common minimal bounding rectungle
for two input rectagnles a and b for two input rectagnles a and b
Result is written to c Result is written to c
*/ */
int rtree_combine_rect(MI_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c, int rtree_combine_rect(HA_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c,
uint key_length) uint key_length)
{ {
...@@ -466,7 +466,7 @@ int rtree_combine_rect(MI_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c, ...@@ -466,7 +466,7 @@ int rtree_combine_rect(MI_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c,
/* /*
Calculates overlapping area of two MBRs a & b Calculates overlapping area of two MBRs a & b
*/ */
double rtree_overlapping_area(MI_KEYSEG *keyseg, uchar* a, uchar* b, double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
uint key_length) uint key_length)
{ {
double res = 1; double res = 1;
...@@ -559,7 +559,7 @@ double rtree_overlapping_area(MI_KEYSEG *keyseg, uchar* a, uchar* b, ...@@ -559,7 +559,7 @@ double rtree_overlapping_area(MI_KEYSEG *keyseg, uchar* a, uchar* b,
/* /*
Calculates MBR_AREA(a+b) - MBR_AREA(a) Calculates MBR_AREA(a+b) - MBR_AREA(a)
*/ */
double rtree_area_increase(MI_KEYSEG *keyseg, uchar* a, uchar* b, double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
uint key_length, double *ab_area) uint key_length, double *ab_area)
{ {
double a_area = 1; double a_area = 1;
...@@ -675,7 +675,7 @@ double rtree_area_increase(MI_KEYSEG *keyseg, uchar* a, uchar* b, ...@@ -675,7 +675,7 @@ double rtree_area_increase(MI_KEYSEG *keyseg, uchar* a, uchar* b,
/* /*
Calculates key page total MBR = MBR(key1) + MBR(key2) + ... Calculates key page total MBR = MBR(key1) + MBR(key2) + ...
*/ */
int rtree_page_mbr(MI_INFO *info, MI_KEYSEG *keyseg, uchar *page_buf, int rtree_page_mbr(MI_INFO *info, HA_KEYSEG *keyseg, uchar *page_buf,
uchar *c, uint key_length) uchar *c, uint key_length)
{ {
uint inc = 0; uint inc = 0;
......
...@@ -18,16 +18,16 @@ ...@@ -18,16 +18,16 @@
#ifndef _rt_mbr_h #ifndef _rt_mbr_h
#define _rt_mbr_h #define _rt_mbr_h
int rtree_key_cmp(MI_KEYSEG *keyseg, uchar *a, uchar *b, uint key_length, int rtree_key_cmp(HA_KEYSEG *keyseg, uchar *a, uchar *b, uint key_length,
uint nextflag); uint nextflag);
int rtree_combine_rect(MI_KEYSEG *keyseg,uchar *, uchar *, uchar*, int rtree_combine_rect(HA_KEYSEG *keyseg,uchar *, uchar *, uchar*,
uint key_length); uint key_length);
double rtree_rect_volume(MI_KEYSEG *keyseg, uchar*, uint key_length); double rtree_rect_volume(HA_KEYSEG *keyseg, uchar*, uint key_length);
int rtree_d_mbr(MI_KEYSEG *keyseg, uchar *a, uint key_length, double *res); int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res);
double rtree_overlapping_area(MI_KEYSEG *keyseg, uchar *a, uchar *b, double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar *a, uchar *b,
uint key_length); uint key_length);
double rtree_area_increase(MI_KEYSEG *keyseg, uchar *a, uchar *b, double rtree_area_increase(HA_KEYSEG *keyseg, uchar *a, uchar *b,
uint key_length, double *ab_area); uint key_length, double *ab_area);
int rtree_page_mbr(MI_INFO *info, MI_KEYSEG *keyseg, uchar *page_buf, int rtree_page_mbr(MI_INFO *info, HA_KEYSEG *keyseg, uchar *page_buf,
uchar* c, uint key_length); uchar* c, uint key_length);
#endif /* _rt_mbr_h */ #endif /* _rt_mbr_h */
...@@ -47,7 +47,7 @@ int run_test(const char *filename) ...@@ -47,7 +47,7 @@ int run_test(const char *filename)
MI_CREATE_INFO create_info; MI_CREATE_INFO create_info;
MI_COLUMNDEF recinfo[20]; MI_COLUMNDEF recinfo[20];
MI_KEYDEF keyinfo[20]; MI_KEYDEF keyinfo[20];
MI_KEYSEG keyseg[20]; HA_KEYSEG keyseg[20];
int silent=0; int silent=0;
int opt_unique=0; int opt_unique=0;
......
...@@ -33,7 +33,7 @@ static int sp_mbr_from_wkb(uchar (*wkb), uint size, uint n_dims, double *mbr); ...@@ -33,7 +33,7 @@ static int sp_mbr_from_wkb(uchar (*wkb), uint size, uint n_dims, double *mbr);
uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key, uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
const byte *record, my_off_t filepos) const byte *record, my_off_t filepos)
{ {
MI_KEYSEG *keyseg; HA_KEYSEG *keyseg;
MI_KEYDEF *keyinfo = &info->s->keyinfo[keynr]; MI_KEYDEF *keyinfo = &info->s->keyinfo[keynr];
uint len = 0; uint len = 0;
byte *pos; byte *pos;
......
...@@ -56,7 +56,7 @@ int run_test(const char *filename) ...@@ -56,7 +56,7 @@ int run_test(const char *filename)
MI_CREATE_INFO create_info; MI_CREATE_INFO create_info;
MI_COLUMNDEF recinfo[20]; MI_COLUMNDEF recinfo[20];
MI_KEYDEF keyinfo[20]; MI_KEYDEF keyinfo[20];
MI_KEYSEG keyseg[20]; HA_KEYSEG keyseg[20];
int silent=0; int silent=0;
int create_flag=0; int create_flag=0;
......
...@@ -23,7 +23,7 @@ static int queue_key_cmp(void *keyseg, byte *a, byte *b) ...@@ -23,7 +23,7 @@ static int queue_key_cmp(void *keyseg, byte *a, byte *b)
MI_INFO *aa=((MYRG_TABLE *)a)->table; MI_INFO *aa=((MYRG_TABLE *)a)->table;
MI_INFO *bb=((MYRG_TABLE *)b)->table; MI_INFO *bb=((MYRG_TABLE *)b)->table;
uint not_used; uint not_used;
int ret= _mi_key_cmp((MI_KEYSEG *)keyseg, aa->lastkey, bb->lastkey, int ret= ha_key_cmp((HA_KEYSEG *)keyseg, aa->lastkey, bb->lastkey,
USE_WHOLE_KEY, SEARCH_FIND, &not_used); USE_WHOLE_KEY, SEARCH_FIND, &not_used);
return ret < 0 ? -1 : ret > 0 ? 1 : 0; return ret < 0 ? -1 : ret > 0 ? 1 : 0;
} /* queue_key_cmp */ } /* queue_key_cmp */
......
...@@ -67,7 +67,7 @@ Returns <0, 0, >0 acording to which is bigger ...@@ -67,7 +67,7 @@ Returns <0, 0, >0 acording to which is bigger
Key_length specifies length of key to use. Number-keys can't be splited Key_length specifies length of key to use. Number-keys can't be splited
If flag <> SEARCH_FIND compare also position If flag <> SEARCH_FIND compare also position
*/ */
int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
register uchar *b, uint key_length, uint nextflag, register uchar *b, uint key_length, uint nextflag,
uint *diff_pos) uint *diff_pos)
{ {
...@@ -393,7 +393,7 @@ Returns <0, 0, >0 acording to which is bigger ...@@ -393,7 +393,7 @@ Returns <0, 0, >0 acording to which is bigger
Key_length specifies length of key to use. Number-keys can't be splited Key_length specifies length of key to use. Number-keys can't be splited
If flag <> SEARCH_FIND compare also position If flag <> SEARCH_FIND compare also position
*/ */
int hp_rb_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, int hp_rb_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
register uchar *b, uint key_length, uint nextflag, register uchar *b, uint key_length, uint nextflag,
uint *diff_pos) uint *diff_pos)
{ {
......
...@@ -36,7 +36,7 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked) ...@@ -36,7 +36,7 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
uint key,parts,mem_per_row=0; uint key,parts,mem_per_row=0;
ulong max_rows; ulong max_rows;
HP_KEYDEF *keydef; HP_KEYDEF *keydef;
MI_KEYSEG *seg; HA_KEYSEG *seg;
for (key=parts=0 ; key < table->keys ; key++) for (key=parts=0 ; key < table->keys ; key++)
{ {
...@@ -48,9 +48,9 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked) ...@@ -48,9 +48,9 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
} }
if (!(keydef=(HP_KEYDEF*) my_malloc(table->keys*sizeof(HP_KEYDEF)+ if (!(keydef=(HP_KEYDEF*) my_malloc(table->keys*sizeof(HP_KEYDEF)+
parts*sizeof(MI_KEYSEG),MYF(MY_WME)))) parts*sizeof(HA_KEYSEG),MYF(MY_WME))))
return my_errno; return my_errno;
seg=my_reinterpret_cast(MI_KEYSEG*) (keydef+table->keys); seg=my_reinterpret_cast(HA_KEYSEG*) (keydef+table->keys);
for (key=0 ; key < table->keys ; key++) for (key=0 ; key < table->keys ; key++)
{ {
KEY *pos=table->key_info+key; KEY *pos=table->key_info+key;
......
...@@ -993,7 +993,7 @@ int ha_myisam::create(const char *name, register TABLE *table, ...@@ -993,7 +993,7 @@ int ha_myisam::create(const char *name, register TABLE *table,
KEY *pos; KEY *pos;
MI_KEYDEF *keydef; MI_KEYDEF *keydef;
MI_COLUMNDEF *recinfo,*recinfo_pos; MI_COLUMNDEF *recinfo,*recinfo_pos;
MI_KEYSEG *keyseg; HA_KEYSEG *keyseg;
uint options=table->db_options_in_use; uint options=table->db_options_in_use;
DBUG_ENTER("ha_myisam::create"); DBUG_ENTER("ha_myisam::create");
...@@ -1002,7 +1002,7 @@ int ha_myisam::create(const char *name, register TABLE *table, ...@@ -1002,7 +1002,7 @@ int ha_myisam::create(const char *name, register TABLE *table,
&recinfo,(table->fields*2+2)*sizeof(MI_COLUMNDEF), &recinfo,(table->fields*2+2)*sizeof(MI_COLUMNDEF),
&keydef, table->keys*sizeof(MI_KEYDEF), &keydef, table->keys*sizeof(MI_KEYDEF),
&keyseg, &keyseg,
((table->key_parts + table->keys) * sizeof(MI_KEYSEG)), ((table->key_parts + table->keys) * sizeof(HA_KEYSEG)),
0))) 0)))
DBUG_RETURN(1); DBUG_RETURN(1);
......
...@@ -3942,7 +3942,7 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param, ...@@ -3942,7 +3942,7 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
if (table->keys) if (table->keys)
{ // Get keys for ni_create { // Get keys for ni_create
bool using_unique_constraint=0; bool using_unique_constraint=0;
MI_KEYSEG *seg= (MI_KEYSEG*) sql_calloc(sizeof(*seg) * HA_KEYSEG *seg= (HA_KEYSEG*) sql_calloc(sizeof(*seg) *
keyinfo->key_parts); keyinfo->key_parts);
if (!seg) if (!seg)
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment