18
18
#ifndef _my_handler_h
19
19
#define _my_handler_h
23
21
#include "myisampack.h"
28
There is a hard limit for the maximum number of keys as there are only
29
8 bits in the index file header for the number of keys in a table.
30
This means that 0..255 keys can exist for a table. The idea of
31
HA_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
32
a MyISAM table for which one has more keys than MyISAM is normally
33
compiled for. If you don't have this, you will get a core dump when
34
running myisamchk compiled for 128 keys on a table with 255 keys.
37
#define HA_MAX_POSSIBLE_KEY 255 /* For myisamchk */
39
The following defines can be increased if necessary.
40
But beware the dependency of HA_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
43
#define HA_MAX_KEY_LENGTH 1332 /* Max length in bytes */
44
#define HA_MAX_KEY_SEG 16 /* Max segments for key */
46
#define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24+ 6+6)
47
#define HA_MAX_KEY_BUFF (HA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8)
25
49
typedef struct st_HA_KEYSEG /* Key-portion */
27
51
CHARSET_INFO *charset;
40
64
#define get_key_length(length,key) \
41
{ if ((uchar) *(key) != 255) \
42
length= (uint) (uchar) *((key)++); \
65
{ if (*(const uchar*) (key) != 255) \
66
length= (uint) *(const uchar*) ((key)++); \
44
{ length=mi_uint2korr((key)+1); (key)+=3; } \
68
{ length= mi_uint2korr((key)+1); (key)+=3; } \
47
71
#define get_key_length_rdonly(length,key) \
48
{ if ((uchar) *(key) != 255) \
49
length= ((uint) (uchar) *((key))); \
72
{ if (*(const uchar*) (key) != 255) \
73
length= ((uint) *(const uchar*) ((key))); \
51
{ length=mi_uint2korr((key)+1); } \
75
{ length= mi_uint2korr((key)+1); } \
54
78
#define get_key_pack_length(length,length_pack,key) \
55
{ if ((uchar) *(key) != 255) \
56
{ length= (uint) (uchar) *((key)++); length_pack=1; }\
79
{ if (*(const uchar*) (key) != 255) \
80
{ length= (uint) *(const uchar*) ((key)++); length_pack= 1; }\
58
{ length=mi_uint2korr((key)+1); (key)+=3; length_pack=3; } \
82
{ length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \
61
85
#define store_key_length_inc(key,length) \
62
86
{ if ((length) < 255) \
63
{ *(key)++=(length); } \
87
{ *(key)++= (length); } \
65
89
{ *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
92
#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3)
68
94
#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \
69
95
(((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \
70
96
((1 << (bit_len)) - 1))
81
107
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
82
108
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
84
extern int mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
86
extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
87
register uchar *b, uint key_length, uint nextflag,
110
extern int ha_compare_text(CHARSET_INFO *, const uchar *, uint,
111
const uchar *, uint , my_bool, my_bool);
112
extern int ha_key_cmp(register HA_KEYSEG *keyseg, register const uchar *a,
113
register const uchar *b, uint key_length,
114
uint32 nextflag, uint *diff_pos);
90
extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a);
116
extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, const uchar *a);
117
extern void my_handler_error_register(void);
118
extern void my_handler_error_unregister(void);
120
Inside an in-memory data record, memory pointers to pieces of the
121
record (like BLOBs) are stored in their native byte order and in
122
this amount of bytes.
124
#define portable_sizeof_char_ptr 8
92
129
#endif /* _my_handler_h */