MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
KeyInfo.hpp
1 /*
2  Copyright (C) 2003-2008 MySQL AB
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #ifndef KEY_INFO_HPP
20 #define KEY_INFO_HPP
21 
22 #include "SignalData.hpp"
23 
24 class KeyInfo {
28  friend class DbUtil;
29  friend class NdbOperation;
30  friend class NdbScanOperation;
31  friend class NdbIndexScanOperation;
32  friend class Restore;
33 
37  friend class Dbtc;
38 
39 public:
40  STATIC_CONST( HeaderLength = 3 );
41  STATIC_CONST( DataLength = 20 );
42  STATIC_CONST( MaxSignalLength = HeaderLength + DataLength );
43 
44  /* IndexBound constants */
45  STATIC_CONST( PerBoundColumnOverhead = 2 );
46  /* Max number of key columns with max total key size */
47  STATIC_CONST( MaxWordsPerBoundRow = \
48  (PerBoundColumnOverhead * MAX_ATTRIBUTES_IN_INDEX) \
49  + MAX_KEY_SIZE_IN_WORDS );
50  /* Single key column with max total key size */
51  STATIC_CONST( MaxWordsPerBoundColumn = \
52  PerBoundColumnOverhead + MAX_KEY_SIZE_IN_WORDS );
53 
54 private:
55  Uint32 connectPtr;
56  Uint32 transId[2];
57  Uint32 keyData[DataLength];
58 };
59 
60 /*
61  The KEYINFO signal is used to send a stream of data defining keys for
62  primary key operations (TCKEYREQ) or ordered index scan bounds (SCAN_TABREQ).
63 
64  For TCKEYREQ, the first 8 words of the KEYINFO stream are actually stored
65  inside the TCKEYREQ signal, so for shorter keys, no KEYINFO signals are
66  needed. Otherwise as many consecutive KEYINFO signals as needed are sent with
67  max KeyInfo::Datalength words of data in each.
68 
69  For scan bounds for ordered indexes, the data sent consists of a sequence of
70  entries, each (2+N) words:
71  1 word of bound type (0:<= 1:< 2:>= 3:> 4:==)
72  1 word of AttributeHeader (containing attribute Id and byte length)
73  N words of attribute data (N = (length+3)>>2).
74  Additionally, it is possible to send multiple range bounds in a single
75  SCAN_TABREQ and associated KEYINFO stream (using NdbRecord Index scans and
76  multiple calls to setBound with different range numbers). In this case, the
77  first word of each range bound contains additional information:
78  bits 16-31 holds the length of this bound, in words of KEYINFO data,
79  and bits 4-15 holds a number RANGE_NO specified by the application that
80  can be read back from the RANGE_NO pseudo-column.
81 
82 */
83 #endif