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

« back to all changes in this revision

Viewing changes to storage/ndb/include/ndbapi/NdbIndexOperation.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 NdbIndexOperation_H
 
17
#define NdbIndexOperation_H
 
18
 
 
19
#include "NdbOperation.hpp"
 
20
 
 
21
class Index;
 
22
class NdbResultSet;
 
23
 
 
24
/**
 
25
 * @class NdbIndexOperation
 
26
 * @brief Class of index operations for use in transactions
 
27
 */
 
28
class NdbIndexOperation : public NdbOperation
 
29
{
 
30
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
31
  friend class Ndb;
 
32
  friend class NdbTransaction;
 
33
#endif
 
34
 
 
35
public:
 
36
  /**
 
37
   * @name Define Standard Operation
 
38
   * @{
 
39
   */
 
40
 
 
41
  /** insert is not allowed */
 
42
  int insertTuple();
 
43
 
 
44
  /**
 
45
   * Define the NdbIndexOperation to be a standard operation of type readTuple.
 
46
   * When calling NdbTransaction::execute, this operation
 
47
   * reads a tuple.
 
48
   *
 
49
   * @return 0 if successful otherwise -1.
 
50
   */
 
51
  int readTuple(LockMode);
 
52
 
 
53
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
 
54
  /**
 
55
   * Define the NdbIndexOperation to be a standard operation of type readTuple.
 
56
   * When calling NdbTransaction::execute, this operation
 
57
   * reads a tuple.
 
58
   *
 
59
   * @return 0 if successful otherwise -1.
 
60
   */
 
61
  int readTuple();
 
62
 
 
63
  /**
 
64
   * Define the NdbIndexOperation to be a standard operation of type
 
65
   * readTupleExclusive.
 
66
   * When calling NdbTransaction::execute, this operation
 
67
   * read a tuple using an exclusive lock.
 
68
   *
 
69
   * @return 0 if successful otherwise -1.
 
70
   */
 
71
  int readTupleExclusive();
 
72
 
 
73
  /**
 
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.
 
78
   *
 
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
 
82
   *        simple reads).
 
83
   *
 
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.
 
87
   *
 
88
   * @return 0 if successful otherwise -1.
 
89
   */
 
90
  int simpleRead();
 
91
 
 
92
  /**
 
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.
 
96
   *
 
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 
 
100
   * record.
 
101
   *
 
102
   * @return 0 if successful otherwise -1.
 
103
   */
 
104
  int dirtyRead();
 
105
 
 
106
  int committedRead();
 
107
#endif
 
108
 
 
109
  /**
 
110
   * Define the NdbIndexOperation to be a standard operation of type 
 
111
   * updateTuple.
 
112
   *
 
113
   * When calling NdbTransaction::execute, this operation
 
114
   * updates a tuple in the table.
 
115
   *
 
116
   * @return 0 if successful otherwise -1.
 
117
   */
 
118
  int updateTuple();
 
119
 
 
120
  /**
 
121
   * Define the NdbIndexOperation to be a standard operation of type 
 
122
   * deleteTuple.
 
123
   *
 
124
   * When calling NdbTransaction::execute, this operation
 
125
   * deletes a tuple.
 
126
   *
 
127
   * @return 0 if successful otherwise -1.
 
128
   */
 
129
  int deleteTuple();
 
130
 
 
131
  /**
 
132
   * Get index object for this operation
 
133
   */
 
134
  const NdbDictionary::Index * getIndex() const;
 
135
 
 
136
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
 
137
  /**
 
138
   * Define the NdbIndexOperation to be a standard operation of type 
 
139
   * dirtyUpdate.
 
140
   *
 
141
   * When calling NdbTransaction::execute, this operation
 
142
   * updates without two-phase commit.
 
143
   *
 
144
   * @return 0 if successful otherwise -1.
 
145
   */
 
146
  int dirtyUpdate();
 
147
#endif
 
148
 
 
149
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
150
  /** @} *********************************************************************/
 
151
  /**
 
152
   * @name Define Interpreted Program Operation 
 
153
   * @{
 
154
   */
 
155
 
 
156
  /**
 
157
   * Update a tuple using an interpreted program.
 
158
   *
 
159
   * @return 0 if successful otherwise -1.
 
160
   */
 
161
  int interpretedUpdateTuple();
 
162
 
 
163
  /**
 
164
   * Delete a tuple using an interpreted program.
 
165
   *
 
166
   * @return 0 if successful otherwise -1.
 
167
   */
 
168
  int interpretedDeleteTuple();
 
169
#endif
 
170
  
 
171
  /** @} *********************************************************************/
 
172
 
 
173
private:
 
174
  NdbIndexOperation(Ndb* aNdb);
 
175
  ~NdbIndexOperation();
 
176
 
 
177
  int receiveTCINDXREF(NdbApiSignal* aSignal);
 
178
 
 
179
  // Overloaded methods from NdbCursorOperation
 
180
  int indxInit(const class NdbIndexImpl* anIndex,
 
181
               const class NdbTableImpl* aTable, 
 
182
               NdbTransaction*);
 
183
 
 
184
  // Private attributes
 
185
  const NdbIndexImpl* m_theIndex;
 
186
  friend struct Ndb_free_list_t<NdbIndexOperation>;
 
187
};
 
188
 
 
189
#endif