drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
key_part_info.h
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2008 Sun Microsystems, Inc.
5 * Copyright (C) 2013 Stewart Smith
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#pragma once
23
24#include <drizzled/message/table.pb.h>
25
26namespace drizzled {
27
28/* This structure describes a key part.
29 There is one key part per field in a key.
30 */
32{
33public:
34 Field *field;
35 unsigned int offset; /* offset in record (from 0) */
36 unsigned int null_offset; /* Offset to null_bit in record */
37 /* Length of key part in bytes, excluding NULL flag and length bytes */
38 uint16_t length;
39 /*
40 Number of bytes required to store the keypart value. This may be
41 different from the "length" field as it also counts
42 - possible NULL-flag byte (see HA_KEY_NULL_LENGTH) [if null_bit != 0,
43 the first byte stored at offset is 1 if null, 0 if non-null; the
44 actual value is stored from offset+1].
45 - possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length.
46 */
47 uint16_t store_length;
48 uint16_t key_type;
49private:
50public:
51 uint16_t getKeyType() const
52 {
53 return key_type;
54 }
55 uint16_t fieldnr; /* Fieldnum in UNIREG (1,2,3,...) */
56 uint16_t key_part_flag; /* 0 or HA_REVERSE_SORT */
57 uint8_t type;
58 uint8_t null_bit; /* Position to null_bit */
59};
60
61} /* namespace drizzled */
TODO: Rename this file - func.h is stupid.