~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to include/my_handler.h

  • Committer: Stewart Smith
  • Date: 2008-07-13 08:00:16 UTC
  • mto: (210.1.1 drizzle)
  • mto: This revision was merged to the branch mainline in revision 211.
  • Revision ID: stewart@flamingspork.com-20080713080016-8qtjv9ypt42azzr6
CRC32() as UDF

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 <mystrings/m_ctype.h>
22
 
#include <storage/myisam/myisampack.h>
 
21
#include "myisampack.h"
23
22
#ifdef  __cplusplus
24
23
extern "C" {
25
24
#endif
48
47
 
49
48
typedef struct st_HA_KEYSEG             /* Key-portion */
50
49
{
51
 
  const CHARSET_INFO *charset;
52
 
  uint32_t start;                               /* Start of key in record */
53
 
  uint32_t null_pos;                    /* position to NULL indicator */
54
 
  uint16_t bit_pos;                       /* Position to bit part */
55
 
  uint16_t flag;
56
 
  uint16_t length;                      /* Keylength */
57
 
  uint8_t  type;                                /* Type of key (for sort) */
58
 
  uint8_t  language;
59
 
  uint8_t  null_bit;                    /* bitmask to test for NULL */
60
 
  uint8_t  bit_start,bit_end;           /* if bit field */
61
 
  uint8_t  bit_length;                    /* Length of bit part */
 
50
  CHARSET_INFO *charset;
 
51
  uint32 start;                         /* Start of key in record */
 
52
  uint32 null_pos;                      /* position to NULL indicator */
 
53
  uint16 bit_pos;                       /* Position to bit part */
 
54
  uint16 flag;
 
55
  uint16 length;                        /* Keylength */
 
56
  uint8  type;                          /* Type of key (for sort) */
 
57
  uint8  language;
 
58
  uint8  null_bit;                      /* bitmask to test for NULL */
 
59
  uint8  bit_start,bit_end;             /* if bit field */
 
60
  uint8  bit_length;                    /* Length of bit part */
62
61
} HA_KEYSEG;
63
62
 
64
63
#define get_key_length(length,key) \
65
 
{ if (*(unsigned char*) (key) != 255) \
66
 
    length= (uint) *(unsigned char*) ((key)++); \
 
64
{ if (*(uchar*) (key) != 255) \
 
65
    length= (uint) *(uchar*) ((key)++); \
67
66
  else \
68
67
  { length= mi_uint2korr((key)+1); (key)+=3; } \
69
68
}
70
69
 
71
70
#define get_key_length_rdonly(length,key) \
72
 
{ if (*(unsigned char*) (key) != 255) \
73
 
    length= ((uint) *(unsigned char*) ((key))); \
 
71
{ if (*(uchar*) (key) != 255) \
 
72
    length= ((uint) *(uchar*) ((key))); \
74
73
  else \
75
74
  { length= mi_uint2korr((key)+1); } \
76
75
}
77
76
 
78
77
#define get_key_pack_length(length,length_pack,key) \
79
 
{ if (*(unsigned char*) (key) != 255) \
80
 
  { length= (uint) *(unsigned char*) ((key)++); length_pack= 1; }\
 
78
{ if (*(uchar*) (key) != 255) \
 
79
  { length= (uint) *(uchar*) ((key)++); length_pack= 1; }\
81
80
  else \
82
81
  { length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \
83
82
}
92
91
#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3)
93
92
 
94
93
#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \
95
 
  (((((uint16_t) (bit_ptr)[1] << 8) | (uint16_t) (bit_ptr)[0]) >> (bit_ofs)) & \
 
94
  (((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \
96
95
   ((1 << (bit_len)) - 1))
97
96
 
98
97
#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
107
106
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
108
107
  set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
109
108
 
110
 
extern int ha_compare_text(const CHARSET_INFO * const, unsigned char *, uint, unsigned char *, uint, bool, bool);
 
109
extern int ha_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
 
110
                           my_bool, my_bool);
111
111
 
112
 
extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, unsigned char *a);
113
 
void my_handler_error_register(void);
114
 
void my_handler_error_unregister(void);
115
 
extern int ha_key_cmp(HA_KEYSEG *keyseg, unsigned char *a,unsigned char *b,
116
 
                      uint32_t key_length,uint32_t nextflag,uint32_t *diff_length);
 
112
extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a);
 
113
extern void my_handler_error_register(void);
 
114
extern void my_handler_error_unregister(void);
 
115
extern int ha_key_cmp(HA_KEYSEG *keyseg, uchar *a,uchar *b,
 
116
                      uint key_length,uint nextflag,uint *diff_length);
117
117
 
118
118
/*
119
119
  Inside an in-memory data record, memory pointers to pieces of the