Eneboo - Documentación para desarrolladores
|
00001 /* Copyright (C) 2002-2006 MySQL AB 00002 00003 This library is free software; you can redistribute it and/or 00004 modify it under the terms of the GNU Library General Public 00005 License as published by the Free Software Foundation; version 2 00006 of the License. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public 00014 License along with this library; if not, write to the Free 00015 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00016 MA 02111-1307, USA */ 00017 00018 #ifndef _my_handler_h 00019 #define _my_handler_h 00020 00021 #include "my_base.h" 00022 #include "m_ctype.h" 00023 #include "myisampack.h" 00024 00025 typedef struct st_HA_KEYSEG /* Key-portion */ 00026 { 00027 CHARSET_INFO *charset; 00028 uint32 start; /* Start of key in record */ 00029 uint32 null_pos; /* position to NULL indicator */ 00030 uint16 bit_pos; /* Position to bit part */ 00031 uint16 flag; 00032 uint16 length; /* Keylength */ 00033 uint8 type; /* Type of key (for sort) */ 00034 uint8 language; 00035 uint8 null_bit; /* bitmask to test for NULL */ 00036 uint8 bit_start,bit_end; /* if bit field */ 00037 uint8 bit_length; /* Length of bit part */ 00038 } HA_KEYSEG; 00039 00040 #define get_key_length(length,key) \ 00041 { if ((uchar) *(key) != 255) \ 00042 length= (uint) (uchar) *((key)++); \ 00043 else \ 00044 { length=mi_uint2korr((key)+1); (key)+=3; } \ 00045 } 00046 00047 #define get_key_length_rdonly(length,key) \ 00048 { if ((uchar) *(key) != 255) \ 00049 length= ((uint) (uchar) *((key))); \ 00050 else \ 00051 { length=mi_uint2korr((key)+1); } \ 00052 } 00053 00054 #define get_key_pack_length(length,length_pack,key) \ 00055 { if ((uchar) *(key) != 255) \ 00056 { length= (uint) (uchar) *((key)++); length_pack=1; }\ 00057 else \ 00058 { length=mi_uint2korr((key)+1); (key)+=3; length_pack=3; } \ 00059 } 00060 00061 #define store_key_length_inc(key,length) \ 00062 { if ((length) < 255) \ 00063 { *(key)++=(length); } \ 00064 else \ 00065 { *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \ 00066 } 00067 00068 #define get_rec_bits(bit_ptr, bit_ofs, bit_len) \ 00069 (((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \ 00070 ((1 << (bit_len)) - 1)) 00071 00072 #define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \ 00073 { \ 00074 (bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \ 00075 ((bits) << (bit_ofs)); \ 00076 if ((bit_ofs) + (bit_len) > 8) \ 00077 (bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \ 00078 ((bits) >> (8 - (bit_ofs))); \ 00079 } 00080 00081 #define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \ 00082 set_rec_bits(0, bit_ptr, bit_ofs, bit_len) 00083 00084 extern int mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint , 00085 my_bool, my_bool); 00086 extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, 00087 register uchar *b, uint key_length, uint nextflag, 00088 uint *diff_pos); 00089 00090 extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a); 00091 00092 #endif /* _my_handler_h */