1
by brian
clean slate |
1 |
/* Copyright (C) 2002-2006 MySQL AB
|
2 |
||
3 |
This library is free software; you can redistribute it and/or
|
|
4 |
modify it under the terms of the GNU Library General Public
|
|
5 |
License as published by the Free Software Foundation; version 2
|
|
6 |
of the License.
|
|
7 |
||
8 |
This library is distributed in the hope that it will be useful,
|
|
9 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11 |
Library General Public License for more details.
|
|
12 |
||
13 |
You should have received a copy of the GNU Library General Public
|
|
14 |
License along with this library; if not, write to the Free
|
|
1802.10.2
by Monty Taylor
Update all of the copyright headers to include the correct address. |
15 |
Software Foundation, Inc., 51 Franklin Place - Suite 330, Boston,
|
16 |
MA 02110-1301, USA */
|
|
1
by brian
clean slate |
17 |
|
1122.2.10
by Monty Taylor
Fixed all of the include guards. |
18 |
#ifndef PLUGIN_MYISAM_MY_HANDLER_H
|
19 |
#define PLUGIN_MYISAM_MY_HANDLER_H
|
|
1
by brian
clean slate |
20 |
|
1241.9.61
by Monty Taylor
No more mystrings in drizzled/ |
21 |
#include "drizzled/charset_info.h" |
992.1.25
by Monty Taylor
Moved myisam to new plugin system. |
22 |
#include <plugin/myisam/myisampack.h> |
1
by brian
clean slate |
23 |
|
24 |
/*
|
|
25 |
There is a hard limit for the maximum number of keys as there are only
|
|
26 |
8 bits in the index file header for the number of keys in a table.
|
|
27 |
This means that 0..255 keys can exist for a table. The idea of
|
|
28 |
HA_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
|
|
29 |
a MyISAM table for which one has more keys than MyISAM is normally
|
|
30 |
compiled for. If you don't have this, you will get a core dump when
|
|
31 |
running myisamchk compiled for 128 keys on a table with 255 keys.
|
|
32 |
*/
|
|
33 |
||
34 |
#define HA_MAX_POSSIBLE_KEY 255 /* For myisamchk */ |
|
35 |
/*
|
|
36 |
The following defines can be increased if necessary.
|
|
37 |
But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
|
|
38 |
*/
|
|
39 |
||
40 |
#define HA_MAX_KEY_LENGTH 1332 /* Max length in bytes */ |
|
41 |
#define HA_MAX_KEY_SEG 16 /* Max segments for key */ |
|
42 |
||
43 |
#define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24+ 6+6)
|
|
44 |
#define HA_MAX_KEY_BUFF (HA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8)
|
|
45 |
||
46 |
typedef struct st_HA_KEYSEG /* Key-portion */ |
|
47 |
{
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
48 |
const drizzled::CHARSET_INFO *charset; |
205
by Brian Aker
uint32 -> uin32_t |
49 |
uint32_t start; /* Start of key in record */ |
50 |
uint32_t null_pos; /* position to NULL indicator */ |
|
206
by Brian Aker
Removed final uint dead types. |
51 |
uint16_t bit_pos; /* Position to bit part */ |
52 |
uint16_t flag; |
|
53 |
uint16_t length; /* Keylength */ |
|
54 |
uint8_t type; /* Type of key (for sort) */ |
|
55 |
uint8_t language; |
|
56 |
uint8_t null_bit; /* bitmask to test for NULL */ |
|
57 |
uint8_t bit_start,bit_end; /* if bit field */ |
|
58 |
uint8_t bit_length; /* Length of bit part */ |
|
1
by brian
clean slate |
59 |
} HA_KEYSEG; |
60 |
||
61 |
#define get_key_length(length,key) \
|
|
481
by Brian Aker
Remove all of uchar. |
62 |
{ if (*(unsigned char*) (key) != 255) \
|
63 |
length= (uint) *(unsigned char*) ((key)++); \
|
|
1
by brian
clean slate |
64 |
else \
|
65 |
{ length= mi_uint2korr((key)+1); (key)+=3; } \
|
|
66 |
}
|
|
67 |
||
68 |
#define get_key_length_rdonly(length,key) \
|
|
481
by Brian Aker
Remove all of uchar. |
69 |
{ if (*(unsigned char*) (key) != 255) \
|
70 |
length= ((uint) *(unsigned char*) ((key))); \
|
|
1
by brian
clean slate |
71 |
else \
|
72 |
{ length= mi_uint2korr((key)+1); } \
|
|
73 |
}
|
|
74 |
||
75 |
#define get_key_pack_length(length,length_pack,key) \
|
|
481
by Brian Aker
Remove all of uchar. |
76 |
{ if (*(unsigned char*) (key) != 255) \
|
77 |
{ length= (uint) *(unsigned char*) ((key)++); length_pack= 1; }\
|
|
1
by brian
clean slate |
78 |
else \
|
79 |
{ length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \
|
|
80 |
}
|
|
81 |
||
82 |
#define store_key_length_inc(key,length) \
|
|
83 |
{ if ((length) < 255) \
|
|
84 |
{ *(key)++= (length); } \
|
|
85 |
else \
|
|
86 |
{ *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
|
|
87 |
}
|
|
88 |
||
89 |
#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3)
|
|
90 |
||
91 |
#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \
|
|
206
by Brian Aker
Removed final uint dead types. |
92 |
(((((uint16_t) (bit_ptr)[1] << 8) | (uint16_t) (bit_ptr)[0]) >> (bit_ofs)) & \
|
1
by brian
clean slate |
93 |
((1 << (bit_len)) - 1))
|
94 |
||
95 |
#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
|
|
96 |
{ \
|
|
97 |
(bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \
|
|
98 |
((bits) << (bit_ofs)); \
|
|
99 |
if ((bit_ofs) + (bit_len) > 8) \
|
|
100 |
(bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \
|
|
101 |
((bits) >> (8 - (bit_ofs))); \
|
|
102 |
}
|
|
103 |
||
104 |
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
|
|
105 |
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
|
|
106 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
107 |
extern int ha_compare_text(const drizzled::CHARSET_INFO * const, unsigned char *, uint, unsigned char *, uint, bool, bool); |
1
by brian
clean slate |
108 |
|
481
by Brian Aker
Remove all of uchar. |
109 |
extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, unsigned char *a); |
547
by Monty Taylor
Moved handler_error_messages array out of header file. Moved associated |
110 |
void my_handler_error_register(void); |
481
by Brian Aker
Remove all of uchar. |
111 |
extern int ha_key_cmp(HA_KEYSEG *keyseg, unsigned char *a,unsigned char *b, |
482
by Brian Aker
Remove uint. |
112 |
uint32_t key_length,uint32_t nextflag,uint32_t *diff_length); |
77.1.7
by Monty Taylor
Heap builds clean. |
113 |
|
1
by brian
clean slate |
114 |
/*
|
115 |
Inside an in-memory data record, memory pointers to pieces of the
|
|
116 |
record (like BLOBs) are stored in their native byte order and in
|
|
117 |
this amount of bytes.
|
|
118 |
*/
|
|
119 |
#define portable_sizeof_char_ptr 8
|
|
120 |
||
1122.2.10
by Monty Taylor
Fixed all of the include guards. |
121 |
#endif /* PLUGIN_MYISAM_MY_HANDLER_H */ |