1 /* Copyright (c) 2003, 2005-2007 MySQL AB
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.
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.
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 Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #ifndef CREATE_INDX_HPP
17 #define CREATE_INDX_HPP
19 #include "SignalData.hpp"
20 #include <NodeBitmask.hpp>
21 #include <signaldata/DictTabInfo.hpp>
27 friend bool printCREATE_INDX_REQ(FILE*, const Uint32
*, Uint32
, Uint16
);
33 RT_DICT_PREPARE
= 1 << 4,
34 RT_DICT_COMMIT
= 0xC << 4,
35 RT_DICT_ABORT
= 0xF << 4,
38 STATIC_CONST( SignalLength
= 8 );
39 SECTION( ATTRIBUTE_LIST_SECTION
= 0 );
40 SECTION( INDEX_NAME_SECTION
= 1 );
43 Uint32 m_connectionPtr
; // user "schema connection"
44 Uint32 m_userRef
; // user block reference
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
55 Uint32
getUserRef() const {
58 void setUserRef(Uint32 val
) {
61 Uint32
getConnectionPtr() const {
62 return m_connectionPtr
;
64 void setConnectionPtr(Uint32 val
) {
65 m_connectionPtr
= val
;
67 CreateIndxReq::RequestType
getRequestType() const {
68 const Uint32 val
= BitmaskImpl::getField(1, &m_requestInfo
, 0, 16);
69 return (CreateIndxReq::RequestType
)val
;
71 void setRequestType(CreateIndxReq::RequestType val
) {
72 m_requestInfo
= (Uint32
)val
;
74 Uint32
getRequestFlag() const {
75 return BitmaskImpl::getField(1, &m_requestInfo
, 16, 16);
77 void addRequestFlag(Uint32 val
) {
78 val
|= BitmaskImpl::getField(1, &m_requestInfo
, 16, 16);
79 BitmaskImpl::setField(1, &m_requestInfo
, 16, 16, val
);
81 Uint32
getTableId() const {
84 void setTableId(Uint32 val
) {
87 DictTabInfo::TableType
getIndexType() const {
88 return (DictTabInfo::TableType
)m_indexType
;
90 void setIndexType(DictTabInfo::TableType val
) {
91 m_indexType
= (Uint32
)val
;
93 Uint32
getIndexId() const {
96 void setIndexId(Uint32 val
) {
99 Uint32
getOnline() const {
102 void setOnline(Uint32 val
) {
105 Uint32
getIndexVersion() const {
106 return m_indexVersion
;
108 void setIndexVersion(Uint32 val
) {
109 m_indexVersion
= val
;
111 Uint32
getOpKey() const {
114 void setOpKey(Uint32 val
) {
122 class CreateIndxConf
{
123 friend bool printCREATE_INDX_CONF(FILE*, const Uint32
*, Uint32
, Uint16
);
126 STATIC_CONST( InternalLength
= 3 );
127 STATIC_CONST( SignalLength
= 7 );
130 Uint32 m_connectionPtr
;
132 Uint32 m_requestInfo
;
136 Uint32 m_indexVersion
;
139 Uint32
getUserRef() const {
142 void setUserRef(Uint32 val
) {
145 Uint32
getConnectionPtr() const {
146 return m_connectionPtr
;
148 void setConnectionPtr(Uint32 val
) {
149 m_connectionPtr
= val
;
151 CreateIndxReq::RequestType
getRequestType() const {
152 return (CreateIndxReq::RequestType
)m_requestInfo
;
154 void setRequestType(CreateIndxReq::RequestType val
) {
155 m_requestInfo
= (Uint32
)val
;
157 Uint32
getTableId() const {
160 void setTableId(Uint32 val
) {
163 DictTabInfo::TableType
getIndexType() const {
164 return (DictTabInfo::TableType
)m_indexType
;
166 void setIndexType(DictTabInfo::TableType val
) {
167 m_indexType
= (Uint32
)val
;
169 Uint32
getIndexId() const {
172 void setIndexId(Uint32 val
) {
175 Uint32
getIndexVersion() const {
176 return m_indexVersion
;
178 void setIndexVersion(Uint32 val
) {
179 m_indexVersion
= val
;
186 struct CreateIndxRef
{
187 friend bool printCREATE_INDX_REF(FILE*, const Uint32
*, Uint32
, Uint16
);
190 STATIC_CONST( SignalLength
= CreateIndxReq::SignalLength
+ 3 );
196 IndexOnDiskAttributeError
= 756,
197 TriggerNotFound
= 4238,
198 TriggerExists
= 4239,
199 IndexNameTooLong
= 4241,
200 TooManyIndexes
= 4242,
202 AttributeNullable
= 4246,
203 BadRequestType
= 4247,
205 InvalidPrimaryTable
= 4249,
206 InvalidIndexType
= 4250,
208 AllocationError
= 4252,
209 CreateIndexTableFailed
= 4253,
210 DuplicateAttributes
= 4258,
212 TableIsTemporary
= 776,
213 TableIsNotTemporary
= 777,
214 NoLoggingTemporaryIndex
= 778
217 CreateIndxConf m_conf
;
219 //Uint32 m_connectionPtr;
220 //Uint32 m_requestInfo;
222 //Uint32 m_indexType;
224 //Uint32 m_indexVersion;
229 Uint32 masterNodeId
; // If NotMaster
232 CreateIndxConf
* getConf() {
235 const CreateIndxConf
* getConf() const {
238 Uint32
getUserRef() const {
239 return m_conf
.getUserRef();
241 void setUserRef(Uint32 val
) {
242 m_conf
.setUserRef(val
);
244 Uint32
getConnectionPtr() const {
245 return m_conf
.getConnectionPtr();
247 void setConnectionPtr(Uint32 val
) {
248 m_conf
.setConnectionPtr(val
);
250 CreateIndxReq::RequestType
getRequestType() const {
251 return m_conf
.getRequestType();
253 void setRequestType(CreateIndxReq::RequestType val
) {
254 m_conf
.setRequestType(val
);
256 Uint32
getTableId() const {
257 return m_conf
.getTableId();
259 void setTableId(Uint32 val
) {
260 m_conf
.setTableId(val
);
262 DictTabInfo::TableType
getIndexType() const {
263 return m_conf
.getIndexType();
265 void setIndexType(DictTabInfo::TableType val
) {
266 m_conf
.setIndexType(val
);
268 Uint32
getIndexId() const {
269 return m_conf
.getIndexId();
271 void setIndexId(Uint32 val
) {
272 m_conf
.setIndexId(val
);
274 Uint32
getIndexVersion() const {
275 return m_conf
.getIndexVersion();
277 void setIndexVersion(Uint32 val
) {
278 m_conf
.setIndexVersion(val
);
280 CreateIndxRef::ErrorCode
getErrorCode() const {
281 return (CreateIndxRef::ErrorCode
)m_errorCode
;
283 void setErrorCode(CreateIndxRef::ErrorCode val
) {
284 m_errorCode
= (Uint32
)val
;
286 Uint32
getErrorLine() const {
289 void setErrorLine(Uint32 val
) {
292 Uint32
getErrorNode() const {
295 void setErrorNode(Uint32 val
) {