1
/* Copyright (C) 2003 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
16
#include <ndb_global.h>
17
#include <NdbIndexOperation.hpp>
19
#include <NdbTransaction.hpp>
20
#include "NdbApiSignal.hpp"
21
#include <AttributeHeader.hpp>
22
#include <signaldata/TcIndx.hpp>
23
#include <signaldata/TcKeyReq.hpp>
24
#include <signaldata/IndxKeyInfo.hpp>
25
#include <signaldata/IndxAttrInfo.hpp>
27
NdbIndexOperation::NdbIndexOperation(Ndb* aNdb) :
28
NdbOperation(aNdb, NdbOperation::UniqueIndexAccess),
31
m_tcReqGSN = GSN_TCINDXREQ;
32
m_attrInfoGSN = GSN_INDXATTRINFO;
33
m_keyInfoGSN = GSN_INDXKEYINFO;
36
* Change receiver type
38
theReceiver.init(NdbReceiver::NDB_INDEX_OPERATION, this);
41
NdbIndexOperation::~NdbIndexOperation()
45
/*****************************************************************************
48
* Return Value: Return 0 : init was successful.
49
* Return -1: In all other case.
50
* Remark: Initiates operation record after allocation.
51
*****************************************************************************/
53
NdbIndexOperation::indxInit(const NdbIndexImpl * anIndex,
54
const NdbTableImpl * aTable,
55
NdbTransaction* myConnection)
57
NdbOperation::init(aTable, myConnection);
59
switch (anIndex->m_type) {
60
case(NdbDictionary::Index::UniqueHashIndex):
62
case(NdbDictionary::Index::Undefined):
63
case(NdbDictionary::Index::OrderedIndex):
64
setErrorCodeAbort(4003);
71
m_accessTable = anIndex->m_table;
72
theNoOfTupKeyLeft = m_accessTable->getNoOfPrimaryKeys();
76
int NdbIndexOperation::readTuple(NdbOperation::LockMode lm)
83
return readTupleExclusive();
85
case LM_CommittedRead:
96
int NdbIndexOperation::insertTuple()
102
int NdbIndexOperation::readTuple()
104
// First check that index is unique
106
return NdbOperation::readTuple();
109
int NdbIndexOperation::readTupleExclusive()
111
// First check that index is unique
113
return NdbOperation::readTupleExclusive();
116
int NdbIndexOperation::simpleRead()
118
// First check that index is unique
120
return NdbOperation::readTuple();
123
int NdbIndexOperation::dirtyRead()
125
// First check that index is unique
127
return NdbOperation::readTuple();
130
int NdbIndexOperation::committedRead()
132
// First check that index is unique
134
return NdbOperation::readTuple();
137
int NdbIndexOperation::updateTuple()
139
// First check that index is unique
141
return NdbOperation::updateTuple();
144
int NdbIndexOperation::deleteTuple()
146
// First check that index is unique
148
return NdbOperation::deleteTuple();
151
int NdbIndexOperation::dirtyUpdate()
153
// First check that index is unique
155
return NdbOperation::dirtyUpdate();
158
int NdbIndexOperation::interpretedUpdateTuple()
160
// First check that index is unique
162
return NdbOperation::interpretedUpdateTuple();
165
int NdbIndexOperation::interpretedDeleteTuple()
167
// First check that index is unique
169
return NdbOperation::interpretedDeleteTuple();
172
const NdbDictionary::Index*
173
NdbIndexOperation::getIndex() const
178
/***************************************************************************
179
int receiveTCINDXREF( NdbApiSignal* aSignal)
181
Return Value: Return 0 : send was succesful.
182
Return -1: In all other case.
183
Parameters: aSignal: the signal object that contains the TCINDXREF signal from TC.
184
Remark: Handles the reception of the TCKEYREF signal.
185
***************************************************************************/
187
NdbIndexOperation::receiveTCINDXREF( NdbApiSignal* aSignal)
189
return receiveTCKEYREF(aSignal);
190
}//NdbIndexOperation::receiveTCINDXREF()