~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to include/my_handler.h

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#ifndef _my_handler_h
19
19
#define _my_handler_h
20
20
 
21
 
#include "my_base.h"
22
 
#include "m_ctype.h"
23
21
#include "myisampack.h"
24
22
 
 
23
#ifdef  __cplusplus
 
24
extern "C" {
 
25
#endif
 
26
 
 
27
/*
 
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.
 
35
*/
 
36
 
 
37
#define HA_MAX_POSSIBLE_KEY         255         /* For myisamchk */
 
38
/*
 
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.
 
41
*/
 
42
 
 
43
#define HA_MAX_KEY_LENGTH           1332        /* Max length in bytes */
 
44
#define HA_MAX_KEY_SEG              16          /* Max segments for key */
 
45
 
 
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)
 
48
 
25
49
typedef struct st_HA_KEYSEG             /* Key-portion */
26
50
{
27
51
  CHARSET_INFO *charset;
38
62
} HA_KEYSEG;
39
63
 
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)++); \
43
67
  else \
44
 
  { length=mi_uint2korr((key)+1); (key)+=3; } \
 
68
  { length= mi_uint2korr((key)+1); (key)+=3; } \
45
69
}
46
70
 
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))); \
50
74
  else \
51
 
  { length=mi_uint2korr((key)+1); } \
 
75
  { length= mi_uint2korr((key)+1); } \
52
76
}
53
77
 
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; }\
57
81
  else \
58
 
  { length=mi_uint2korr((key)+1); (key)+=3; length_pack=3; } \
 
82
  { length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \
59
83
}
60
84
 
61
85
#define store_key_length_inc(key,length) \
62
86
{ if ((length) < 255) \
63
 
  { *(key)++=(length); } \
 
87
  { *(key)++= (length); } \
64
88
  else \
65
89
  { *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
66
90
}
67
91
 
 
92
#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3)
 
93
 
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)
83
109
 
84
 
extern int mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
85
 
                           my_bool, my_bool);
86
 
extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
87
 
                      register uchar *b, uint key_length, uint nextflag,
88
 
                      uint *diff_pos);
 
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);
89
115
 
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);
 
119
/*
 
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.
 
123
*/
 
124
#define portable_sizeof_char_ptr 8
 
125
#ifdef  __cplusplus
 
126
}
 
127
#endif
91
128
 
92
129
#endif /* _my_handler_h */