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-1301 USA */
15
16#ifndef KEY_INCLUDED
17#define KEY_INCLUDED
18
19class Field;
20class String;
21struct TABLE;
22typedef struct st_bitmap MY_BITMAP;
23typedef struct st_key KEY;
24typedef struct st_key_part_info KEY_PART_INFO;
25
26int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field,
27 uint *key_length, uint *keypart);
28void key_copy(uchar *to_key, const uchar *from_record, KEY *key_info,
29 uint key_length, bool with_zerofill= FALSE);
30void key_restore(uchar *to_record, const uchar *from_key, KEY *key_info,
31 uint key_length);
32bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length);
33void key_unpack(String *to, TABLE *table, KEY *key);
34void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
35 bool prefix_key);
36bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields);
37int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length);
38ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key);
39bool key_buf_cmp(KEY *key_info, uint used_key_parts,
40 const uchar *key1, const uchar *key2);
41extern "C" int key_rec_cmp(void *key_info, uchar *a, uchar *b);
42int key_tuple_cmp(KEY_PART_INFO *part, uchar *key1, uchar *key2, uint tuple_length);
43
44#endif /* KEY_INCLUDED */
45