diff options
author | monty@mysql.com/narttu.mysql.fi <> | 2007-10-11 18:07:40 +0300 |
---|---|---|
committer | monty@mysql.com/narttu.mysql.fi <> | 2007-10-11 18:07:40 +0300 |
commit | 7887babe69412b6f33f6cb782f468e9b58695fb9 (patch) | |
tree | 2f3bb6c8948945094ff740b1991e2d9b80a55ec3 /include/my_handler.h | |
parent | 9473b90fd5c16a2043b70d869721e80b1d9916f7 (diff) | |
download | mariadb-git-7887babe69412b6f33f6cb782f468e9b58695fb9.tar.gz |
Moved a lot of old bug fixes and safe cleanups from Maria 5.1 tree to 5.1
- Reserver namespace and place in frm for TABLE_CHECKSUM and PAGE_CHECKSUM create options
- Added syncing of directory when creating .frm files
- Portability fixes
- Added missing cast that could cause bugs
- Code cleanups
- Made some bit functions inline
- Moved things out of myisam.h to my_handler.h to make them more accessable
- Renamed some myisam variables and defines to make them more globaly usable (as they are used outside of MyISAM)
- Fixed bugs in error conditions
- Use compiler time asserts instead of run time
- Fixed indentation
HA_EXTRA_PREPARE_FOR_DELETE -> HA_EXTRA_PREPARE_FOR_DROP as the old name was wrong
(Added a define for old value to ensure we don't break any old code)
Added HA_EXTRA_PREPARE_FOR_RENAME as a signal for rename (before we used a DROP signal which is wrong)
- Initialize error messages early to get better errors when mysqld or an engine fails to start
- Fix windows bug that query_performance_frequency was not initialized if registry code failed
- thread_stack -> my_thread_stack_size
Diffstat (limited to 'include/my_handler.h')
-rw-r--r-- | include/my_handler.h | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/include/my_handler.h b/include/my_handler.h index d7cd0567f9c..dabe73bd138 100644 --- a/include/my_handler.h +++ b/include/my_handler.h @@ -18,10 +18,30 @@ #ifndef _my_handler_h #define _my_handler_h -#include "my_base.h" -#include "m_ctype.h" #include "myisampack.h" +/* + There is a hard limit for the maximum number of keys as there are only + 8 bits in the index file header for the number of keys in a table. + This means that 0..255 keys can exist for a table. The idea of + HA_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on + a MyISAM table for which one has more keys than MyISAM is normally + compiled for. If you don't have this, you will get a core dump when + running myisamchk compiled for 128 keys on a table with 255 keys. +*/ + +#define HA_MAX_POSSIBLE_KEY 255 /* For myisamchk */ +/* + The following defines can be increased if necessary. + But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH. +*/ + +#define HA_MAX_KEY_LENGTH 1000 /* Max length in bytes */ +#define HA_MAX_KEY_SEG 16 /* Max segments for key */ + +#define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24+ 6+6) +#define HA_MAX_KEY_BUFF (HA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8) + typedef struct st_HA_KEYSEG /* Key-portion */ { CHARSET_INFO *charset; @@ -38,33 +58,35 @@ typedef struct st_HA_KEYSEG /* Key-portion */ } HA_KEYSEG; #define get_key_length(length,key) \ -{ if ((uchar) *(key) != 255) \ - length= (uint) (uchar) *((key)++); \ +{ if (*(uchar*) (key) != 255) \ + length= (uint) *(uchar*) ((key)++); \ else \ - { length=mi_uint2korr((key)+1); (key)+=3; } \ + { length= mi_uint2korr((key)+1); (key)+=3; } \ } #define get_key_length_rdonly(length,key) \ -{ if ((uchar) *(key) != 255) \ - length= ((uint) (uchar) *((key))); \ +{ if (*(uchar*) (key) != 255) \ + length= ((uint) *(uchar*) ((key))); \ else \ - { length=mi_uint2korr((key)+1); } \ + { length= mi_uint2korr((key)+1); } \ } #define get_key_pack_length(length,length_pack,key) \ -{ if ((uchar) *(key) != 255) \ - { length= (uint) (uchar) *((key)++); length_pack=1; }\ +{ if (*(uchar*) (key) != 255) \ + { length= (uint) *(uchar*) ((key)++); length_pack= 1; }\ else \ - { length=mi_uint2korr((key)+1); (key)+=3; length_pack=3; } \ + { length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \ } #define store_key_length_inc(key,length) \ { if ((length) < 255) \ - { *(key)++=(length); } \ + { *(key)++= (length); } \ else \ { *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \ } +#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3) + #define get_rec_bits(bit_ptr, bit_ofs, bit_len) \ (((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \ ((1 << (bit_len)) - 1)) @@ -81,12 +103,20 @@ typedef struct st_HA_KEYSEG /* Key-portion */ #define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \ set_rec_bits(0, bit_ptr, bit_ofs, bit_len) -extern int mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint , +extern int ha_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint , my_bool, my_bool); extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, register uchar *b, uint key_length, uint nextflag, uint *diff_pos); extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a); +extern void my_handler_error_register(void); +extern void my_handler_error_unregister(void); +/* + Inside an in-memory data record, memory pointers to pieces of the + record (like BLOBs) are stored in their native byte order and in + this amount of bytes. +*/ +#define portable_sizeof_char_ptr 8 #endif /* _my_handler_h */ |