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
#ifndef NdbIndexOperation_H
17
#define NdbIndexOperation_H
19
#include "NdbOperation.hpp"
25
* @class NdbIndexOperation
26
* @brief Class of index operations for use in transactions
28
class NdbIndexOperation : public NdbOperation
30
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
32
friend class NdbTransaction;
37
* @name Define Standard Operation
41
/** insert is not allowed */
45
* Define the NdbIndexOperation to be a standard operation of type readTuple.
46
* When calling NdbTransaction::execute, this operation
49
* @return 0 if successful otherwise -1.
51
int readTuple(LockMode);
53
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
55
* Define the NdbIndexOperation to be a standard operation of type readTuple.
56
* When calling NdbTransaction::execute, this operation
59
* @return 0 if successful otherwise -1.
64
* Define the NdbIndexOperation to be a standard operation of type
66
* When calling NdbTransaction::execute, this operation
67
* read a tuple using an exclusive lock.
69
* @return 0 if successful otherwise -1.
71
int readTupleExclusive();
74
* Define the NdbIndexOperation to be a standard operation of type simpleRead.
75
* When calling NdbTransaction::execute, this operation
76
* reads an existing tuple (using shared read lock),
77
* but releases lock immediately after read.
79
* @note Using this operation twice in the same transaction
80
* may produce different results (e.g. if there is another
81
* transaction which updates the value between the
84
* Note that simpleRead can read the value from any database node while
85
* standard read always read the value on the database node which is
86
* primary for the record.
88
* @return 0 if successful otherwise -1.
93
* Define the NdbOperation to be a standard operation of type committedRead.
94
* When calling NdbTransaction::execute, this operation
95
* read latest committed value of the record.
97
* This means that if another transaction is updating the
98
* record, then the current transaction will not wait.
99
* It will instead use the latest committed value of the
102
* @return 0 if successful otherwise -1.
110
* Define the NdbIndexOperation to be a standard operation of type
113
* When calling NdbTransaction::execute, this operation
114
* updates a tuple in the table.
116
* @return 0 if successful otherwise -1.
121
* Define the NdbIndexOperation to be a standard operation of type
124
* When calling NdbTransaction::execute, this operation
127
* @return 0 if successful otherwise -1.
132
* Get index object for this operation
134
const NdbDictionary::Index * getIndex() const;
136
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
138
* Define the NdbIndexOperation to be a standard operation of type
141
* When calling NdbTransaction::execute, this operation
142
* updates without two-phase commit.
144
* @return 0 if successful otherwise -1.
149
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
150
/** @} *********************************************************************/
152
* @name Define Interpreted Program Operation
157
* Update a tuple using an interpreted program.
159
* @return 0 if successful otherwise -1.
161
int interpretedUpdateTuple();
164
* Delete a tuple using an interpreted program.
166
* @return 0 if successful otherwise -1.
168
int interpretedDeleteTuple();
171
/** @} *********************************************************************/
174
NdbIndexOperation(Ndb* aNdb);
175
~NdbIndexOperation();
177
int receiveTCINDXREF(NdbApiSignal* aSignal);
179
// Overloaded methods from NdbCursorOperation
180
int indxInit(const class NdbIndexImpl* anIndex,
181
const class NdbTableImpl* aTable,
184
// Private attributes
185
const NdbIndexImpl* m_theIndex;
186
friend struct Ndb_free_list_t<NdbIndexOperation>;