~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to storage/ndb/include/kernel/signaldata/CreateIndx.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2003 MySQL AB
 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
#ifndef CREATE_INDX_HPP
 
17
#define CREATE_INDX_HPP
 
18
 
 
19
#include "SignalData.hpp"
 
20
#include <NodeBitmask.hpp>
 
21
#include <signaldata/DictTabInfo.hpp>
 
22
 
 
23
/**
 
24
 * CreateIndxReq.
 
25
 */
 
26
class CreateIndxReq {
 
27
  friend bool printCREATE_INDX_REQ(FILE*, const Uint32*, Uint32, Uint16);
 
28
 
 
29
public:
 
30
  enum RequestType {
 
31
    RT_UNDEFINED = 0,
 
32
    RT_USER = 1,
 
33
    RT_DICT_PREPARE = 1 << 4,
 
34
    RT_DICT_COMMIT = 0xC << 4,
 
35
    RT_DICT_ABORT = 0xF << 4,
 
36
    RT_TC = 5 << 8
 
37
  };
 
38
  STATIC_CONST( SignalLength = 8 );
 
39
  SECTION( ATTRIBUTE_LIST_SECTION = 0 );
 
40
  SECTION( INDEX_NAME_SECTION = 1 );
 
41
 
 
42
private:
 
43
  Uint32 m_connectionPtr;       // user "schema connection"
 
44
  Uint32 m_userRef;             // user block reference
 
45
  Uint32 m_requestInfo;
 
46
  Uint32 m_tableId;             // table to index
 
47
  Uint32 m_indexType;           // from DictTabInfo::TableType
 
48
  Uint32 m_indexId;             // index table id set by DICT
 
49
  Uint32 m_indexVersion;        // index table version set by DICT
 
50
  Uint32 m_online;              // alter online
 
51
  // extra
 
52
  Uint32 m_opKey;
 
53
 
 
54
public:
 
55
  Uint32 getUserRef() const {
 
56
    return m_userRef;
 
57
  }
 
58
  void setUserRef(Uint32 val) {
 
59
    m_userRef = val;
 
60
  }
 
61
  Uint32 getConnectionPtr() const {
 
62
    return m_connectionPtr;
 
63
  }
 
64
  void setConnectionPtr(Uint32 val) {
 
65
    m_connectionPtr = val;
 
66
  }
 
67
  CreateIndxReq::RequestType getRequestType() const {
 
68
    const Uint32 val = BitmaskImpl::getField(1, &m_requestInfo, 0, 16);
 
69
    return (CreateIndxReq::RequestType)val;
 
70
  }
 
71
  void setRequestType(CreateIndxReq::RequestType val) {
 
72
    m_requestInfo = (Uint32)val;
 
73
  }
 
74
  Uint32 getRequestFlag() const {
 
75
    return BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
 
76
  };
 
77
  void addRequestFlag(Uint32 val) {
 
78
    val |= BitmaskImpl::getField(1, &m_requestInfo, 16, 16);
 
79
    BitmaskImpl::setField(1, &m_requestInfo, 16, 16, val);
 
80
  };
 
81
  Uint32 getTableId() const {
 
82
    return m_tableId;
 
83
  }
 
84
  void setTableId(Uint32 val) {
 
85
    m_tableId = val;
 
86
  }
 
87
  DictTabInfo::TableType getIndexType() const {
 
88
    return (DictTabInfo::TableType)m_indexType;
 
89
  }
 
90
  void setIndexType(DictTabInfo::TableType val) {
 
91
    m_indexType = (Uint32)val;
 
92
  }
 
93
  Uint32 getIndexId() const {
 
94
    return m_indexId;
 
95
  }
 
96
  void setIndexId(Uint32 val) {
 
97
    m_indexId = val;
 
98
  }
 
99
  Uint32 getOnline() const {
 
100
    return m_online;
 
101
  }
 
102
  void setOnline(Uint32 val) {
 
103
    m_online = val;
 
104
  }
 
105
  Uint32 getIndexVersion() const {
 
106
    return m_indexVersion;
 
107
  }
 
108
  void setIndexVersion(Uint32 val) {
 
109
    m_indexVersion = val;
 
110
  }
 
111
  Uint32 getOpKey() const {
 
112
    return m_opKey;
 
113
  }
 
114
  void setOpKey(Uint32 val) {
 
115
    m_opKey = val;
 
116
  }
 
117
};
 
118
 
 
119
/**
 
120
 * CreateIndxConf.
 
121
 */
 
122
class CreateIndxConf {
 
123
  friend bool printCREATE_INDX_CONF(FILE*, const Uint32*, Uint32, Uint16);
 
124
 
 
125
public:
 
126
  STATIC_CONST( InternalLength = 3 );
 
127
  STATIC_CONST( SignalLength = 7 );
 
128
 
 
129
private:
 
130
  Uint32 m_connectionPtr;
 
131
  Uint32 m_userRef;
 
132
  Uint32 m_requestInfo;
 
133
  Uint32 m_tableId;
 
134
  Uint32 m_indexType;
 
135
  Uint32 m_indexId;
 
136
  Uint32 m_indexVersion;
 
137
 
 
138
public:
 
139
  Uint32 getUserRef() const {
 
140
    return m_userRef;
 
141
  }
 
142
  void setUserRef(Uint32 val) {
 
143
    m_userRef = val;
 
144
  }
 
145
  Uint32 getConnectionPtr() const {
 
146
    return m_connectionPtr;
 
147
  }
 
148
  void setConnectionPtr(Uint32 val) {
 
149
    m_connectionPtr = val;
 
150
  }
 
151
  CreateIndxReq::RequestType getRequestType() const {
 
152
    return (CreateIndxReq::RequestType)m_requestInfo;
 
153
  }
 
154
  void setRequestType(CreateIndxReq::RequestType val) {
 
155
    m_requestInfo = (Uint32)val;
 
156
  }
 
157
  Uint32 getTableId() const {
 
158
    return m_tableId;
 
159
  }
 
160
  void setTableId(Uint32 val) {
 
161
    m_tableId = val;
 
162
  }
 
163
  DictTabInfo::TableType getIndexType() const {
 
164
    return (DictTabInfo::TableType)m_indexType;
 
165
  }
 
166
  void setIndexType(DictTabInfo::TableType val) {
 
167
    m_indexType = (Uint32)val;
 
168
  }
 
169
  Uint32 getIndexId() const {
 
170
    return m_indexId;
 
171
  }
 
172
  void setIndexId(Uint32 val) {
 
173
    m_indexId = val;
 
174
  }
 
175
  Uint32 getIndexVersion() const {
 
176
    return m_indexVersion;
 
177
  }
 
178
  void setIndexVersion(Uint32 val) {
 
179
    m_indexVersion = val;
 
180
  }
 
181
};
 
182
 
 
183
/**
 
184
 * CreateIndxRef.
 
185
 */
 
186
struct CreateIndxRef {
 
187
  friend bool printCREATE_INDX_REF(FILE*, const Uint32*, Uint32, Uint16);
 
188
 
 
189
public:
 
190
  STATIC_CONST( SignalLength = CreateIndxReq::SignalLength + 3 );
 
191
  enum ErrorCode {
 
192
    NoError = 0,
 
193
    Busy = 701,
 
194
    BusyWithNR = 711,
 
195
    NotMaster = 702,
 
196
    IndexOnDiskAttributeError = 756,
 
197
    TriggerNotFound = 4238,
 
198
    TriggerExists = 4239,
 
199
    IndexNameTooLong = 4241,
 
200
    TooManyIndexes = 4242,
 
201
    IndexExists = 4244,
 
202
    AttributeNullable = 4246,
 
203
    BadRequestType = 4247,
 
204
    InvalidName = 4248,
 
205
    InvalidPrimaryTable = 4249,
 
206
    InvalidIndexType = 4250,
 
207
    NotUnique = 4251,
 
208
    AllocationError = 4252,
 
209
    CreateIndexTableFailed = 4253,
 
210
    DuplicateAttributes = 4258,
 
211
    SingleUser = 299,
 
212
    TableIsTemporary = 776,
 
213
    TableIsNotTemporary = 777,
 
214
    NoLoggingTemporaryIndex = 778
 
215
  };
 
216
 
 
217
  CreateIndxConf m_conf;
 
218
  //Uint32 m_userRef;
 
219
  //Uint32 m_connectionPtr;
 
220
  //Uint32 m_requestInfo;
 
221
  //Uint32 m_tableId;
 
222
  //Uint32 m_indexType;
 
223
  //Uint32 m_indexId;
 
224
  //Uint32 m_indexVersion;
 
225
  Uint32 m_errorCode;
 
226
  Uint32 m_errorLine;
 
227
  union {
 
228
    Uint32 m_errorNode;
 
229
    Uint32 masterNodeId; // If NotMaster
 
230
  };
 
231
public:
 
232
  CreateIndxConf* getConf() {
 
233
    return &m_conf;
 
234
  }
 
235
  const CreateIndxConf* getConf() const {
 
236
    return &m_conf;
 
237
  }
 
238
  Uint32 getUserRef() const {
 
239
    return m_conf.getUserRef();
 
240
  }
 
241
  void setUserRef(Uint32 val) {
 
242
    m_conf.setUserRef(val);
 
243
  }
 
244
  Uint32 getConnectionPtr() const {
 
245
    return m_conf.getConnectionPtr();
 
246
  }
 
247
  void setConnectionPtr(Uint32 val) {
 
248
    m_conf.setConnectionPtr(val);
 
249
  }
 
250
  CreateIndxReq::RequestType getRequestType() const {
 
251
    return m_conf.getRequestType();
 
252
  }
 
253
  void setRequestType(CreateIndxReq::RequestType val) {
 
254
    m_conf.setRequestType(val);
 
255
  }
 
256
  Uint32 getTableId() const {
 
257
    return m_conf.getTableId();
 
258
  }
 
259
  void setTableId(Uint32 val) {
 
260
    m_conf.setTableId(val);
 
261
  }
 
262
  DictTabInfo::TableType getIndexType() const {
 
263
    return m_conf.getIndexType();
 
264
  }
 
265
  void setIndexType(DictTabInfo::TableType val) {
 
266
    m_conf.setIndexType(val);
 
267
  }
 
268
  Uint32 getIndexId() const {
 
269
    return m_conf.getIndexId();
 
270
  }
 
271
  void setIndexId(Uint32 val) {
 
272
    m_conf.setIndexId(val);
 
273
  }
 
274
  Uint32 getIndexVersion() const {
 
275
    return m_conf.getIndexVersion();
 
276
  }
 
277
  void setIndexVersion(Uint32 val) {
 
278
    m_conf.setIndexVersion(val);
 
279
  }
 
280
  CreateIndxRef::ErrorCode getErrorCode() const {
 
281
    return (CreateIndxRef::ErrorCode)m_errorCode;
 
282
  }
 
283
  void setErrorCode(CreateIndxRef::ErrorCode val) {
 
284
    m_errorCode = (Uint32)val;
 
285
  }
 
286
  Uint32 getErrorLine() const {
 
287
    return m_errorLine;
 
288
  }
 
289
  void setErrorLine(Uint32 val) {
 
290
    m_errorLine = val;
 
291
  }
 
292
  Uint32 getErrorNode() const {
 
293
    return m_errorNode;
 
294
  }
 
295
  void setErrorNode(Uint32 val) {
 
296
    m_errorNode = val;
 
297
  }
 
298
};
 
299
 
 
300
#endif