21 #include "my_global.h"
30 #ifndef CHARSET_INFO_DEFINED
31 #define CHARSET_INFO_DEFINED
43 #define HASH_OVERHEAD (sizeof(char*)*2)
48 typedef uint my_hash_value_type;
49 typedef uchar *(*my_hash_get_key)(
const uchar *,
size_t*,my_bool);
50 typedef void (*my_hash_free_key)(
void *);
53 size_t key_offset,key_length;
58 my_hash_get_key get_key;
64 typedef uint HASH_SEARCH_STATE;
66 #define my_hash_init(A,B,C,D,E,F,G,H) \
67 _my_hash_init(A,0,B,C,D,E,F,G,H)
68 #define my_hash_init2(A,B,C,D,E,F,G,H,I) \
69 _my_hash_init(A,B,C,D,E,F,G,H,I)
71 ulong default_array_elements,
size_t key_offset,
72 size_t key_length, my_hash_get_key get_key,
73 void (*free_element)(
void*),
75 void my_hash_free(
HASH *tree);
76 void my_hash_reset(
HASH *hash);
77 uchar *my_hash_element(
HASH *hash, ulong idx);
78 uchar *my_hash_search(
const HASH *info,
const uchar *key,
size_t length);
79 uchar *my_hash_search_using_hash_value(
const HASH *info,
80 my_hash_value_type hash_value,
81 const uchar *key,
size_t length);
82 my_hash_value_type my_calc_hash(
const HASH *info,
83 const uchar *key,
size_t length);
84 uchar *my_hash_first(
const HASH *info,
const uchar *key,
size_t length,
85 HASH_SEARCH_STATE *state);
86 uchar *my_hash_first_from_hash_value(
const HASH *info,
87 my_hash_value_type hash_value,
90 HASH_SEARCH_STATE *state);
91 uchar *my_hash_next(
const HASH *info,
const uchar *key,
size_t length,
92 HASH_SEARCH_STATE *state);
93 my_bool my_hash_insert(
HASH *info,
const uchar *data);
94 my_bool my_hash_delete(
HASH *hash, uchar *
record);
95 my_bool my_hash_update(
HASH *hash, uchar *
record, uchar *old_key,
96 size_t old_key_length);
97 void my_hash_replace(
HASH *hash, HASH_SEARCH_STATE *state, uchar *new_row);
98 my_bool my_hash_check(
HASH *hash);
100 #define my_hash_clear(H) memset((H), 0, sizeof(*(H)))
101 #define my_hash_inited(H) ((H)->blength != 0)
102 #define my_hash_init_opt(A,B,C,D,E,F,G,H) \
103 (!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G,H))