1 /* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License as published by
5    the Free Software Foundation; version 2 of the License.
6 
7    This program is distributed in the hope that it will be useful,
8    but WITHOUT ANY WARRANTY; without even the implied warranty of
9    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10    GNU General Public License for more details.
11 
12    You should have received a copy of the GNU General Public License
13    along with this program; if not, write to the Free Software
14    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1335  USA */
15 
16 #ifndef KEY_INCLUDED
17 #define KEY_INCLUDED
18 
19 class Field;
20 class String;
21 struct TABLE;
22 typedef struct st_bitmap MY_BITMAP;
23 typedef struct st_key KEY;
24 typedef struct st_key_part_info KEY_PART_INFO;
25 
26 int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field,
27                  uint *key_length, uint *keypart);
28 void key_copy(uchar *to_key, const uchar *from_record, KEY *key_info,
29               uint key_length, bool with_zerofill= FALSE);
30 void key_restore(uchar *to_record, const uchar *from_key, KEY *key_info,
31                  uint key_length);
32 bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length);
33 void key_unpack(String *to, TABLE *table, KEY *key);
34 void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
35                   bool prefix_key);
36 bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields);
37 int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length);
38 ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key);
39 bool key_buf_cmp(KEY *key_info, uint used_key_parts,
40                  const uchar *key1, const uchar *key2);
41 extern "C" int key_rec_cmp(void *key_info, uchar *a, uchar *b);
42 int key_tuple_cmp(KEY_PART_INFO *part, uchar *key1, uchar *key2, uint tuple_length);
43 
44 #endif /* KEY_INCLUDED */
45