MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdbIndexOperation.cpp
1 /*
2  Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "API.hpp"
19 #include <AttributeHeader.hpp>
20 #include <signaldata/TcIndx.hpp>
21 #include <signaldata/TcKeyReq.hpp>
22 #include <signaldata/IndxKeyInfo.hpp>
23 #include <signaldata/IndxAttrInfo.hpp>
24 
25 NdbIndexOperation::NdbIndexOperation(Ndb* aNdb) :
26  NdbOperation(aNdb, NdbOperation::UniqueIndexAccess),
27  m_theIndex(NULL)
28 {
29  m_tcReqGSN = GSN_TCINDXREQ;
30  m_attrInfoGSN = GSN_INDXATTRINFO;
31  m_keyInfoGSN = GSN_INDXKEYINFO;
32 
36  theReceiver.init(NdbReceiver::NDB_INDEX_OPERATION, false, this);
37 }
38 
39 NdbIndexOperation::~NdbIndexOperation()
40 {
41 }
42 
43 /*****************************************************************************
44  * int indxInit();
45  *
46  * Return Value: Return 0 : init was successful.
47  * Return -1: In all other case.
48  * Remark: Initiates operation record after allocation.
49  *****************************************************************************/
50 int
51 NdbIndexOperation::indxInit(const NdbIndexImpl * anIndex,
52  const NdbTableImpl * aTable,
53  NdbTransaction* myConnection,
54  bool useRec)
55 {
56  NdbOperation::init(aTable, myConnection, useRec);
57 
58  switch (anIndex->m_type) {
60  break;
63  setErrorCodeAbort(4003);
64  return -1;
65  default:
66  DBUG_ASSERT(0);
67  break;
68  }
69  m_theIndex = anIndex;
70  m_accessTable = anIndex->m_table;
71  theNoOfTupKeyLeft = m_accessTable->getNoOfPrimaryKeys();
72  return 0;
73 }
74 
76 {
77  switch(lm) {
78  case LM_Read:
79  return readTuple();
80  break;
81  case LM_Exclusive:
82  return readTupleExclusive();
83  break;
84  case LM_CommittedRead:
85  return readTuple();
86  break;
87  case LM_SimpleRead:
88  return readTuple();
89  break;
90  default:
91  return -1;
92  };
93 }
94 
96 {
97  setErrorCode(4200);
98  return -1;
99 }
100 
102 {
103  // First check that index is unique
104 
105  return NdbOperation::readTuple();
106 }
107 
109 {
110  // First check that index is unique
111 
113 }
114 
116 {
117  // First check that index is unique
118 
119  return NdbOperation::readTuple();
120 }
121 
123 {
124  // First check that index is unique
125 
126  return NdbOperation::readTuple();
127 }
128 
130 {
131  // First check that index is unique
132 
133  return NdbOperation::readTuple();
134 }
135 
137 {
138  // First check that index is unique
139 
140  return NdbOperation::updateTuple();
141 }
142 
144 {
145  // First check that index is unique
146 
147  return NdbOperation::deleteTuple();
148 }
149 
151 {
152  // First check that index is unique
153 
154  return NdbOperation::dirtyUpdate();
155 }
156 
158 {
159  // First check that index is unique
160 
162 }
163 
165 {
166  // First check that index is unique
167 
169 }
170 
173 {
174  return m_theIndex;
175 }
176 
177 /***************************************************************************
178 int receiveTCINDXREF( NdbApiSignal* aSignal)
179 
180 Return Value: Return 0 : send was succesful.
181  Return -1: In all other case.
182 Parameters: aSignal: the signal object that contains the TCINDXREF signal from TC.
183 Remark: Handles the reception of the TCKEYREF signal.
184 ***************************************************************************/
185 int
186 NdbIndexOperation::receiveTCINDXREF(const NdbApiSignal* aSignal)
187 {
188  return receiveTCKEYREF(aSignal);
189 }//NdbIndexOperation::receiveTCINDXREF()