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

« back to all changes in this revision

Viewing changes to storage/ndb/include/ndbapi/NdbOperation.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 NdbOperation_H
 
17
#define NdbOperation_H
 
18
 
 
19
#include <ndb_types.h>
 
20
#include "ndbapi_limits.h"
 
21
#include "NdbError.hpp"
 
22
#include "NdbReceiver.hpp"
 
23
#include "NdbDictionary.hpp"
 
24
#include "Ndb.hpp"
 
25
 
 
26
class Ndb;
 
27
class NdbApiSignal;
 
28
class NdbRecAttr;
 
29
class NdbOperation;
 
30
class NdbTransaction;
 
31
class NdbColumnImpl;
 
32
class NdbBlob;
 
33
 
 
34
/**
 
35
 * @class NdbOperation
 
36
 * @brief Class of operations for use in transactions.  
 
37
 */
 
38
class NdbOperation
 
39
{
 
40
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
41
  friend class Ndb;
 
42
  friend class NdbTransaction;
 
43
  friend class NdbScanOperation;
 
44
  friend class NdbScanReceiver;
 
45
  friend class NdbScanFilter;
 
46
  friend class NdbScanFilterImpl;
 
47
  friend class NdbReceiver;
 
48
  friend class NdbBlob;
 
49
#endif
 
50
 
 
51
public:
 
52
  /** 
 
53
   * @name Define Standard Operation Type
 
54
   * @{
 
55
   */
 
56
 
 
57
  /**
 
58
   * Different access types (supported by sub-classes of NdbOperation)
 
59
   */
 
60
 
 
61
  enum Type {
 
62
    PrimaryKeyAccess     ///< Read, insert, update, or delete using pk
 
63
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
64
    = 0                  // NdbOperation
 
65
#endif
 
66
    ,UniqueIndexAccess   ///< Read, update, or delete using unique index
 
67
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
68
    = 1                  // NdbIndexOperation
 
69
#endif
 
70
    ,TableScan          ///< Full table scan
 
71
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
72
    = 2                  // NdbScanOperation
 
73
#endif
 
74
    ,OrderedIndexScan   ///< Ordered index scan
 
75
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
76
    = 3                  // NdbIndexScanOperation
 
77
#endif
 
78
  };
 
79
  
 
80
  /**
 
81
   * Lock when performing read
 
82
   */
 
83
 
 
84
  enum LockMode {
 
85
    LM_Read                 ///< Read with shared lock
 
86
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
87
    = 0
 
88
#endif
 
89
    ,LM_Exclusive           ///< Read with exclusive lock
 
90
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
91
    = 1
 
92
#endif
 
93
    ,LM_CommittedRead       ///< Ignore locks, read last committed value
 
94
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
95
    = 2,
 
96
    LM_Dirty = 2,
 
97
#endif
 
98
    LM_SimpleRead = 3       ///< Read with shared lock, but release lock directly
 
99
  };
 
100
 
 
101
  /**
 
102
   * How should transaction be handled if operation fails.
 
103
   *
 
104
   * If AO_IgnoreError, a failure in one operation will not abort the
 
105
   * transaction, and NdbTransaction::execute() will return 0 (success). Use
 
106
   * NdbOperation::getNdbError() to check for errors from individual
 
107
   * operations.
 
108
   *
 
109
   * If AbortOnError, a failure in one operation will abort the transaction
 
110
   * and cause NdbTransaction::execute() to return -1.
 
111
   * 
 
112
   * Abort option can be set on execute(), or in the individual operation.
 
113
   * Setting AO_IgnoreError or AbortOnError in execute() overrides the settings
 
114
   * on individual operations. Setting DefaultAbortOption in execute() (the
 
115
   * default) causes individual operation settings to be used.
 
116
   *
 
117
   * For READ, default is AO_IgnoreError
 
118
   *     DML,  default is AbortOnError
 
119
   * CommittedRead does _only_ support AO_IgnoreError
 
120
   */
 
121
  enum AbortOption {
 
122
    DefaultAbortOption = -1,///< Use default as specified by op-type
 
123
    AbortOnError = 0,       ///< Abort transaction on failed operation
 
124
    AO_IgnoreError = 2      ///< Transaction continues on failed operation
 
125
  };
 
126
 
 
127
  /**
 
128
   * Define the NdbOperation to be a standard operation of type insertTuple.
 
129
   * When calling NdbTransaction::execute, this operation 
 
130
   * adds a new tuple to the table.
 
131
   *
 
132
   * @return 0 if successful otherwise -1.
 
133
   */           
 
134
  virtual int                   insertTuple();
 
135
                
 
136
  /**
 
137
   * Define the NdbOperation to be a standard operation of type updateTuple.
 
138
   * When calling NdbTransaction::execute, this operation 
 
139
   * updates a tuple in the table.
 
140
   *
 
141
   * @return 0 if successful otherwise -1.
 
142
   */  
 
143
  virtual int                   updateTuple();
 
144
 
 
145
  /**
 
146
   * Define the NdbOperation to be a standard operation of type writeTuple.
 
147
   * When calling NdbTransaction::execute, this operation 
 
148
   * writes a tuple to the table.
 
149
   * If the tuple exists, it updates it, otherwise an insert takes place.
 
150
   *
 
151
   * @return 0 if successful otherwise -1.
 
152
   */  
 
153
  virtual int                   writeTuple();
 
154
 
 
155
  /**
 
156
   * Define the NdbOperation to be a standard operation of type deleteTuple.
 
157
   * When calling NdbTransaction::execute, this operation 
 
158
   * delete a tuple.
 
159
   *
 
160
   * @return 0 if successful otherwise -1.
 
161
   */
 
162
  virtual int                   deleteTuple();
 
163
                
 
164
  /**
 
165
   * Define the NdbOperation to be a standard operation of type readTuple.
 
166
   * When calling NdbTransaction::execute, this operation 
 
167
   * reads a tuple.
 
168
   *
 
169
   * @return 0 if successful otherwise -1.
 
170
   */
 
171
  virtual int                   readTuple(LockMode);
 
172
 
 
173
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
 
174
  /**
 
175
   * Define the NdbOperation to be a standard operation of type readTuple.
 
176
   * When calling NdbTransaction::execute, this operation 
 
177
   * reads a tuple.
 
178
   *
 
179
   * @return 0 if successful otherwise -1.
 
180
   */  
 
181
  virtual int                   readTuple();                            
 
182
 
 
183
  /**
 
184
   * Define the NdbOperation to be a standard operation of type 
 
185
   * readTupleExclusive.
 
186
   * When calling NdbTransaction::execute, this operation 
 
187
   * read a tuple using an exclusive lock.
 
188
   *
 
189
   * @return 0 if successful otherwise -1.
 
190
   */
 
191
  virtual int                   readTupleExclusive();
 
192
 
 
193
  /**
 
194
   * Define the NdbOperation to be a standard operation of type 
 
195
   * simpleRead.
 
196
   * When calling NdbTransaction::execute, this operation 
 
197
   * reads an existing tuple (using shared read lock), 
 
198
   * but releases lock immediately after read.
 
199
   *
 
200
   * @note  Using this operation twice in the same transaction
 
201
   *        may produce different results (e.g. if there is another
 
202
   *        transaction which updates the value between the
 
203
   *        simple reads).
 
204
   *
 
205
   * Note that simpleRead can read the value from any database node while
 
206
   * standard read always read the value on the database node which is 
 
207
   * primary for the record.
 
208
   *
 
209
   * @return 0 if successful otherwise -1.
 
210
   */
 
211
  virtual int                   simpleRead();
 
212
 
 
213
  /**
 
214
   * Define the NdbOperation to be a standard operation of type committedRead.
 
215
   * When calling NdbTransaction::execute, this operation 
 
216
   * read latest committed value of the record.
 
217
   *
 
218
   * This means that if another transaction is updating the 
 
219
   * record, then the current transaction will not wait.  
 
220
   * It will instead use the latest committed value of the 
 
221
   * record.
 
222
   * dirtyRead is a deprecated name for committedRead
 
223
   *
 
224
   * @return 0 if successful otherwise -1.
 
225
   * @depricated
 
226
   */
 
227
  virtual int                   dirtyRead();
 
228
 
 
229
  /**
 
230
   * Define the NdbOperation to be a standard operation of type committedRead.
 
231
   * When calling NdbTransaction::execute, this operation 
 
232
   * read latest committed value of the record.
 
233
   *
 
234
   * This means that if another transaction is updating the 
 
235
   * record, then the current transaction will not wait.  
 
236
   * It will instead use the latest committed value of the 
 
237
   * record.
 
238
   *
 
239
   * @return 0 if successful otherwise -1.
 
240
   */
 
241
  virtual int                   committedRead();
 
242
 
 
243
  /**
 
244
   * Define the NdbOperation to be a standard operation of type dirtyUpdate.
 
245
   * When calling NdbTransaction::execute, this operation 
 
246
   * updates without two-phase commit.
 
247
   *
 
248
   * @return 0 if successful otherwise -1.
 
249
   */
 
250
  virtual int                   dirtyUpdate();
 
251
 
 
252
  /**
 
253
   * Define the NdbOperation to be a standard operation of type dirtyWrite.
 
254
   * When calling NdbTransaction::execute, this operation 
 
255
   * writes without two-phase commit.
 
256
   *
 
257
   * @return 0 if successful otherwise -1.
 
258
   */
 
259
  virtual int                   dirtyWrite();
 
260
#endif
 
261
 
 
262
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
263
  /** @} *********************************************************************/
 
264
  /** 
 
265
   * @name Define Interpreted Program Operation Type
 
266
   * @{
 
267
   */
 
268
 
 
269
  /**
 
270
   * Update a tuple using an interpreted program.
 
271
   *
 
272
   * @return 0 if successful otherwise -1.
 
273
   */  
 
274
  virtual int                   interpretedUpdateTuple();
 
275
                
 
276
  /**
 
277
   * Delete a tuple using an interpreted program.
 
278
   *
 
279
   * @return 0 if successful otherwise -1.
 
280
   */
 
281
  virtual int                   interpretedDeleteTuple();
 
282
#endif
 
283
 
 
284
  /** @} *********************************************************************/
 
285
 
 
286
  /** 
 
287
   * @name Specify Search Conditions
 
288
   * @{
 
289
   */
 
290
  /**
 
291
   * Define a search condition with equality.
 
292
   * The condition is true if the attribute has the given value.
 
293
   * To set search conditions on multiple attributes,
 
294
   * use several equals (then all of them must be satisfied for the
 
295
   * tuple to be selected).
 
296
   *
 
297
   * @note For insertTuple() it is also allowed to define the
 
298
   *       search key by using setValue().
 
299
   *
 
300
   * @note There are 10 versions of equal() with
 
301
   *       slightly different parameters.
 
302
   *
 
303
   * @note  If attribute has fixed size, value must include all bytes.
 
304
   *        In particular a Char must be native-blank padded.
 
305
   *        If attribute has variable size, value must start with
 
306
   *        1 or 2 little-endian length bytes (2 if Long*).
 
307
   * 
 
308
   * @param   anAttrName   Attribute name 
 
309
   * @param   aValue       Attribute value.
 
310
   * @return               -1 if unsuccessful. 
 
311
   */
 
312
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
 
313
  int  equal(const char* anAttrName, const char* aValue, Uint32 len);
 
314
#endif
 
315
  int  equal(const char* anAttrName, const char* aValue);
 
316
  int  equal(const char* anAttrName, Int32 aValue);     
 
317
  int  equal(const char* anAttrName, Uint32 aValue);    
 
318
  int  equal(const char* anAttrName, Int64 aValue);     
 
319
  int  equal(const char* anAttrName, Uint64 aValue);
 
320
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
 
321
  int  equal(Uint32 anAttrId, const char* aValue, Uint32 len);
 
322
#endif
 
323
  int  equal(Uint32 anAttrId, const char* aValue);
 
324
  int  equal(Uint32 anAttrId, Int32 aValue);    
 
325
  int  equal(Uint32 anAttrId, Uint32 aValue);   
 
326
  int  equal(Uint32 anAttrId, Int64 aValue);    
 
327
  int  equal(Uint32 anAttrId, Uint64 aValue);
 
328
        
 
329
  /** @} *********************************************************************/
 
330
  /** 
 
331
   * @name Specify Attribute Actions for Operations
 
332
   * @{
 
333
   */
 
334
 
 
335
  /**
 
336
   * Defines a retrieval operation of an attribute value.
 
337
   * The NDB API allocate memory for the NdbRecAttr object that
 
338
   * will hold the returned attribute value. 
 
339
   *
 
340
   * @note Note that it is the applications responsibility
 
341
   *       to allocate enough memory for aValue (if non-NULL).
 
342
   *       The buffer aValue supplied by the application must be
 
343
   *       aligned appropriately.  The buffer is used directly
 
344
   *       (avoiding a copy penalty) only if it is aligned on a
 
345
   *       4-byte boundary and the attribute size in bytes
 
346
   *       (i.e. NdbRecAttr::attrSize times NdbRecAttr::arraySize is
 
347
   *       a multiple of 4).
 
348
   *
 
349
   * @note There are two versions of NdbOperation::getValue with
 
350
   *       slightly different parameters.
 
351
   *
 
352
   * @note This method does not fetch the attribute value from 
 
353
   *       the database!  The NdbRecAttr object returned by this method 
 
354
   *       is <em>not</em> readable/printable before the 
 
355
   *       transaction has been executed with NdbTransaction::execute.
 
356
   *
 
357
   * @param anAttrName  Attribute name 
 
358
   * @param aValue      If this is non-NULL, then the attribute value 
 
359
   *                    will be returned in this parameter.<br>
 
360
   *                    If NULL, then the attribute value will only 
 
361
   *                    be stored in the returned NdbRecAttr object.
 
362
   * @return            An NdbRecAttr object to hold the value of 
 
363
   *                    the attribute, or a NULL pointer 
 
364
   *                    (indicating error).
 
365
   */
 
366
  NdbRecAttr* getValue(const char* anAttrName, char* aValue = 0);
 
367
  NdbRecAttr* getValue(Uint32 anAttrId, char* aValue = 0);
 
368
  NdbRecAttr* getValue(const NdbDictionary::Column*, char* val = 0);
 
369
  
 
370
  /**
 
371
   * Define an attribute to set or update in query.
 
372
   *
 
373
   * To set a NULL value, use the following construct:
 
374
   * @code
 
375
   *   setValue("ATTR_NAME", (char*)NULL);
 
376
   * @endcode
 
377
   * 
 
378
   * There are a number of NdbOperation::setValue methods that 
 
379
   * take a certain type as input
 
380
   * (pass by value rather than passing a pointer). 
 
381
   * As the interface is currently implemented it is the responsibility 
 
382
   * of the application programmer to use the correct types.
 
383
   *
 
384
   * The NDB API will however check that the application sends
 
385
   * a correct length to the interface as given in the length parameter.  
 
386
   * The passing of char* as the value can contain any type or 
 
387
   * any type of array. 
 
388
   * If length is not provided or set to zero, 
 
389
   * then the API will assume that the pointer
 
390
   * is correct and not bother with checking it.
 
391
   *
 
392
   * @note For insertTuple() the NDB API will automatically detect that 
 
393
   *       it is supposed to use equal() instead. 
 
394
   *
 
395
   * @note For insertTuple() it is not necessary to use
 
396
   *       setValue() on key attributes before other attributes.
 
397
   *
 
398
   * @note There are 14 versions of NdbOperation::setValue with
 
399
   *       slightly different parameters.
 
400
   *
 
401
   * @note See note under equal() about value format and length.
 
402
   * 
 
403
   * @param anAttrName     Name (or Id) of attribute.
 
404
   * @param aValue         Attribute value to set.
 
405
   * @return               -1 if unsuccessful.
 
406
   */
 
407
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
 
408
  int  setValue(const char* anAttrName, const char* aValue, Uint32 len);
 
409
#endif
 
410
  int  setValue(const char* anAttrName, const char* aValue);
 
411
  int  setValue(const char* anAttrName, Int32 aValue);
 
412
  int  setValue(const char* anAttrName, Uint32 aValue);
 
413
  int  setValue(const char* anAttrName, Int64 aValue);
 
414
  int  setValue(const char* anAttrName, Uint64 aValue);
 
415
  int  setValue(const char* anAttrName, float aValue);
 
416
  int  setValue(const char* anAttrName, double aValue);
 
417
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
418
  int  setAnyValue(Uint32 aValue);
 
419
#endif
 
420
 
 
421
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
 
422
  int  setValue(Uint32 anAttrId, const char* aValue, Uint32 len);
 
423
#endif
 
424
  int  setValue(Uint32 anAttrId, const char* aValue);
 
425
  int  setValue(Uint32 anAttrId, Int32 aValue);
 
426
  int  setValue(Uint32 anAttrId, Uint32 aValue);
 
427
  int  setValue(Uint32 anAttrId, Int64 aValue);
 
428
  int  setValue(Uint32 anAttrId, Uint64 aValue);
 
429
  int  setValue(Uint32 anAttrId, float aValue);
 
430
  int  setValue(Uint32 anAttrId, double aValue);
 
431
 
 
432
  /**
 
433
   * This method replaces getValue/setValue for blobs.  It creates
 
434
   * a blob handle NdbBlob.  A second call with same argument returns
 
435
   * the previously created handle.  The handle is linked to the
 
436
   * operation and is maintained automatically.
 
437
   *
 
438
   * See NdbBlob for details.
 
439
   */
 
440
  virtual NdbBlob* getBlobHandle(const char* anAttrName);
 
441
  virtual NdbBlob* getBlobHandle(Uint32 anAttrId);
 
442
 
 
443
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
444
  /** @} *********************************************************************/
 
445
  /** 
 
446
   * @name Specify Interpreted Program Instructions
 
447
   * @{
 
448
   */
 
449
 
 
450
  /**
 
451
   * Interpreted program instruction: Add a value to an attribute.
 
452
   *
 
453
   * @note Destroys the contents of registers 6 and 7.
 
454
   *       (The instruction uses these registers for its operation.)
 
455
   *
 
456
   * @note There are four versions of NdbOperation::incValue with
 
457
   *       slightly different parameters.
 
458
   *
 
459
   * @param anAttrName     Attribute name.
 
460
   * @param aValue         Value to add.
 
461
   * @return               -1 if unsuccessful.
 
462
   */
 
463
  int   incValue(const char* anAttrName, Uint32 aValue);
 
464
  int   incValue(const char* anAttrName, Uint64 aValue);
 
465
  int   incValue(Uint32 anAttrId, Uint32 aValue);
 
466
  int   incValue(Uint32 anAttrId, Uint64 aValue);
 
467
 
 
468
  /**
 
469
   * Interpreted program instruction:
 
470
   * Subtract a value from an attribute in an interpreted operation.
 
471
   *
 
472
   * @note Destroys the contents of registers 6 and 7.
 
473
   *       (The instruction uses these registers for its operation.)
 
474
   *
 
475
   * @note There are four versions of NdbOperation::subValue with
 
476
   *       slightly different parameters.
 
477
   *
 
478
   * @param anAttrName    Attribute name.
 
479
   * @param aValue        Value to subtract.
 
480
   * @return              -1 if unsuccessful.
 
481
   */
 
482
  int   subValue(const char* anAttrName, Uint32 aValue);
 
483
  int   subValue(const char* anAttrName, Uint64 aValue);
 
484
  int   subValue(Uint32 anAttrId, Uint32 aValue);
 
485
  int   subValue(Uint32 anAttrId, Uint64 aValue);
 
486
 
 
487
  /**
 
488
   * Interpreted program instruction:
 
489
   * Define a jump label in an interpreted operation.
 
490
   *
 
491
   * @note The labels are automatically numbered starting with 0.  
 
492
   *       The parameter used by NdbOperation::def_label should 
 
493
   *       match the automatic numbering to make it easier to 
 
494
   *       debug the interpreted program.
 
495
   * 
 
496
   * @param labelNumber   Label number.
 
497
   * @return              -1 if unsuccessful.
 
498
   */
 
499
  int   def_label(int labelNumber);
 
500
 
 
501
  /**
 
502
   * Interpreted program instruction:
 
503
   * Add two registers into a third.
 
504
   *
 
505
   * @param RegSource1   First register.
 
506
   * @param RegSource2   Second register.
 
507
   * @param RegDest      Destination register where the result will be stored.
 
508
   * @return -1 if unsuccessful.
 
509
   */
 
510
  int   add_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest);
 
511
 
 
512
  /**
 
513
   * Interpreted program instruction:
 
514
   * Substract RegSource2 from RegSource1 and put the result in RegDest.
 
515
   *
 
516
   * @param RegSource1   First register.
 
517
   * @param RegSource2   Second register.
 
518
   * @param RegDest      Destination register where the result will be stored.
 
519
   * @return             -1 if unsuccessful.
 
520
   */
 
521
  int   sub_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest);
 
522
 
 
523
  /**
 
524
   * Interpreted program instruction:
 
525
   * Load a constant into a register.
 
526
   *
 
527
   * @param RegDest      Destination register.
 
528
   * @param Constant     Value to load.
 
529
   * @return             -1 if unsuccessful.
 
530
   */
 
531
  int   load_const_u32(Uint32 RegDest, Uint32 Constant);
 
532
  int   load_const_u64(Uint32 RegDest, Uint64 Constant);
 
533
 
 
534
  /**
 
535
   * Interpreted program instruction:
 
536
   * Load NULL value into a register.
 
537
   *
 
538
   * @param RegDest      Destination register.
 
539
   * @return             -1 if unsuccessful.
 
540
   */ 
 
541
  int   load_const_null(Uint32 RegDest);
 
542
 
 
543
  /**
 
544
   * Interpreted program instruction:
 
545
   * Read an attribute into a register.
 
546
   *
 
547
   * @param anAttrName   Attribute name.
 
548
   * @param RegDest      Destination register.
 
549
   * @return             -1 if unsuccessful.
 
550
   */
 
551
  int   read_attr(const char* anAttrName, Uint32 RegDest);
 
552
 
 
553
  /**
 
554
   * Interpreted program instruction:
 
555
   * Write an attribute from a register. 
 
556
   *
 
557
   * @param anAttrName   Attribute name.
 
558
   * @param RegSource    Source register.
 
559
   * @return             -1 if unsuccessful.
 
560
   */
 
561
  int   write_attr(const char* anAttrName, Uint32 RegSource);
 
562
 
 
563
  /**
 
564
   * Interpreted program instruction:
 
565
   * Read an attribute into a register.
 
566
   *
 
567
   * @param anAttrId the attribute id.
 
568
   * @param RegDest the destination register.
 
569
   * @return -1 if unsuccessful.
 
570
   */
 
571
  int   read_attr(Uint32 anAttrId, Uint32 RegDest);
 
572
 
 
573
  /**
 
574
   * Interpreted program instruction:
 
575
   * Write an attribute from a register. 
 
576
   *
 
577
   * @param anAttrId the attribute id.
 
578
   * @param RegSource the source register.
 
579
   * @return -1 if unsuccessful.
 
580
   */
 
581
  int   write_attr(Uint32 anAttrId, Uint32 RegSource);
 
582
 
 
583
  /**
 
584
   * Interpreted program instruction:
 
585
   * Define a search condition. Last two letters in the function name 
 
586
   * describes the search condition.
 
587
   * The condition compares RegR with RegL and therefore appears
 
588
   * to be reversed.
 
589
   *
 
590
   * - ge RegR >= RegL
 
591
   * - gt RegR >  RegL
 
592
   * - le RegR <= RegL
 
593
   * - lt RegR <  RegL
 
594
   * - eq RegR =  RegL
 
595
   * - ne RegR <> RegL
 
596
   *
 
597
   * @param RegLvalue left value. 
 
598
   * @param RegRvalue right value.
 
599
   * @param Label the label to jump to.
 
600
   * @return -1 if unsuccessful.
 
601
   */
 
602
  int   branch_ge(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
 
603
  int   branch_gt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
 
604
  int   branch_le(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
 
605
  int   branch_lt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
 
606
  int   branch_eq(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
 
607
  int   branch_ne(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
 
608
 
 
609
  /**
 
610
   * Interpreted program instruction:
 
611
   * Jump to Label if RegLvalue is not NULL.
 
612
   *
 
613
   * @param RegLvalue the value to check.
 
614
   * @param Label the label to jump to.
 
615
   * @return -1 if unsuccessful. 
 
616
   */
 
617
  int   branch_ne_null(Uint32 RegLvalue, Uint32 Label);
 
618
 
 
619
  /**
 
620
   * Interpreted program instruction:
 
621
   * Jump to Label if RegLvalue is equal to NULL.
 
622
   *
 
623
   * @param  RegLvalue  Value to check.
 
624
   * @param  Label      Label to jump to.
 
625
   * @return -1 if unsuccessful. 
 
626
   */
 
627
  int   branch_eq_null(Uint32 RegLvalue, Uint32 Label);
 
628
 
 
629
  /**
 
630
   * Interpreted program instruction:
 
631
   * Jump to Label.
 
632
   *
 
633
   * @param  Label  Label to jump to.
 
634
   * @return -1 if unsuccessful.
 
635
   */
 
636
  int   branch_label(Uint32 Label);
 
637
 
 
638
  /**
 
639
   * Interpreted program instruction:  branch after memcmp
 
640
   * @param  ColId   Column to check
 
641
   * @param  Label   Label to jump to
 
642
   * @return -1 if unsuccessful
 
643
   */
 
644
  int branch_col_eq_null(Uint32 ColId, Uint32 Label);
 
645
  int branch_col_ne_null(Uint32 ColId, Uint32 Label);
 
646
 
 
647
  /**
 
648
   * Interpreted program instruction:  branch after memcmp
 
649
   * @param  ColId   column to check
 
650
   * @param  val     search value
 
651
   * @param  len     length of search value   
 
652
   * @param  nopad   force non-padded comparison for a Char column
 
653
   * @param  Label   label to jump to
 
654
   * @return -1 if unsuccessful
 
655
   */
 
656
  int branch_col_eq(Uint32 ColId, const void * val, Uint32 len, 
 
657
                    bool nopad, Uint32 Label);
 
658
  int branch_col_ne(Uint32 ColId, const void * val, Uint32 len, 
 
659
                    bool nopad, Uint32 Label);
 
660
  int branch_col_lt(Uint32 ColId, const void * val, Uint32 len, 
 
661
                    bool nopad, Uint32 Label);
 
662
  int branch_col_le(Uint32 ColId, const void * val, Uint32 len, 
 
663
                    bool nopad, Uint32 Label);
 
664
  int branch_col_gt(Uint32 ColId, const void * val, Uint32 len, 
 
665
                    bool nopad, Uint32 Label);
 
666
  int branch_col_ge(Uint32 ColId, const void * val, Uint32 len, 
 
667
                    bool nopad, Uint32 Label);
 
668
  /**
 
669
   * The argument is always plain char, even if the field is varchar
 
670
   * (changed in 5.0.22).
 
671
   */
 
672
  int branch_col_like(Uint32 ColId, const void *, Uint32 len, 
 
673
                      bool nopad, Uint32 Label);
 
674
  int branch_col_notlike(Uint32 ColId, const void *, Uint32 len, 
 
675
                         bool nopad, Uint32 Label);
 
676
  
 
677
  /**
 
678
   * Interpreted program instruction: Exit with Ok
 
679
   *
 
680
   * For scanning transactions,
 
681
   * end interpreted operation and return the row to the application.
 
682
   *
 
683
   * For non-scanning transactions,
 
684
   * exit interpreted program.
 
685
   *
 
686
   * @return -1 if unsuccessful.
 
687
   */
 
688
  int   interpret_exit_ok();
 
689
 
 
690
  /**
 
691
   * Interpreted program instruction: Exit with Not Ok
 
692
   *
 
693
   * For scanning transactions, 
 
694
   * continue with the next row without returning the current row.
 
695
   *
 
696
   * For non-scanning transactions,
 
697
   * abort the whole transaction.
 
698
   *
 
699
   * @note A method also exists without the error parameter.
 
700
   * 
 
701
   * @param ErrorCode   An error code given by the application programmer.
 
702
   * @return            -1 if unsuccessful.
 
703
   */
 
704
  int   interpret_exit_nok(Uint32 ErrorCode);
 
705
  int   interpret_exit_nok();
 
706
 
 
707
  
 
708
  /**
 
709
   * Interpreted program instruction:
 
710
   *
 
711
   * For scanning transactions, 
 
712
   * return this row, but no more from this fragment
 
713
   *
 
714
   * For non-scanning transactions,
 
715
   * abort the whole transaction.
 
716
   *
 
717
   * @return            -1 if unsuccessful.
 
718
   */
 
719
  int interpret_exit_last_row();
 
720
  
 
721
  /**
 
722
   * Interpreted program instruction:
 
723
   * Define a subroutine in an interpreted operation.
 
724
   *
 
725
   * @param SubroutineNumber the subroutine number.
 
726
   * @return -1 if unsuccessful.
 
727
   */
 
728
  int   def_subroutine(int SubroutineNumber);
 
729
 
 
730
  /**
 
731
   * Interpreted program instruction:
 
732
   * Call a subroutine.
 
733
   *
 
734
   * @param Subroutine the subroutine to call.
 
735
   * @return -1 if unsuccessful. 
 
736
   */
 
737
  int   call_sub(Uint32 Subroutine);
 
738
 
 
739
  /**
 
740
   * Interpreted program instruction:
 
741
   * End a subroutine.
 
742
   *
 
743
   * @return -1 if unsuccessful. 
 
744
   */
 
745
  int   ret_sub();
 
746
#endif
 
747
 
 
748
  /** @} *********************************************************************/
 
749
 
 
750
  /** 
 
751
   * @name Error Handling
 
752
   * @{
 
753
   */
 
754
 
 
755
  /**
 
756
   * Get the latest error code.
 
757
   *
 
758
   * @return error code.
 
759
   */
 
760
  const NdbError & getNdbError() const;
 
761
 
 
762
  /**
 
763
   * Get the method number where the error occured.
 
764
   * 
 
765
   * @return method number where the error occured.
 
766
   */
 
767
  int getNdbErrorLine();
 
768
 
 
769
  /**
 
770
   * Get table name of this operation.
 
771
   */
 
772
  const char* getTableName() const;
 
773
 
 
774
  /**
 
775
   * Get table object for this operation
 
776
   */
 
777
  const NdbDictionary::Table * getTable() const;
 
778
 
 
779
  /**
 
780
   * Get the type of access for this operation
 
781
   */
 
782
  Type getType() const;
 
783
 
 
784
  /** @} *********************************************************************/
 
785
 
 
786
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
787
  /**
 
788
   * Type of operation
 
789
   */
 
790
  enum OperationType { 
 
791
    ReadRequest = 0,              ///< Read operation
 
792
    UpdateRequest = 1,            ///< Update Operation
 
793
    InsertRequest = 2,            ///< Insert Operation
 
794
    DeleteRequest = 3,            ///< Delete Operation
 
795
    WriteRequest = 4,             ///< Write Operation
 
796
    ReadExclusive = 5,            ///< Read exclusive
 
797
    OpenScanRequest,              ///< Scan Operation
 
798
    OpenRangeScanRequest,         ///< Range scan operation
 
799
    NotDefined2,                  ///< Internal for debugging
 
800
    NotDefined                    ///< Internal for debugging
 
801
  };
 
802
#endif
 
803
 
 
804
  /**
 
805
   * Return lock mode for operation
 
806
   */
 
807
  LockMode getLockMode() const { return theLockMode; }
 
808
 
 
809
  /**
 
810
   * Get/set abort option
 
811
   */
 
812
  AbortOption getAbortOption() const;
 
813
  int setAbortOption(AbortOption);
 
814
  
 
815
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
816
  
 
817
  /**
 
818
   * Set/get partition key
 
819
   */
 
820
  void setPartitionId(Uint32 id);
 
821
  void setPartitionHash(Uint32 key);
 
822
  void setPartitionHash(const Uint64 *, Uint32 len);
 
823
  Uint32 getPartitionId() const;
 
824
#endif
 
825
protected:
 
826
  int handle_distribution_key(const Uint64 *, Uint32 len);
 
827
protected:
 
828
/******************************************************************************
 
829
 * These are the methods used to create and delete the NdbOperation objects.
 
830
 *****************************************************************************/
 
831
 
 
832
  bool                  needReply();
 
833
/******************************************************************************
 
834
 * These methods are service routines used by the other NDB API classes.
 
835
 *****************************************************************************/
 
836
//--------------------------------------------------------------
 
837
// Initialise after allocating operation to a transaction                     
 
838
//--------------------------------------------------------------
 
839
  int init(const class NdbTableImpl*, NdbTransaction* aCon);
 
840
  void initInterpreter();
 
841
 
 
842
  NdbOperation(Ndb* aNdb, Type aType = PrimaryKeyAccess);       
 
843
  virtual ~NdbOperation();
 
844
  void  next(NdbOperation*);            // Set next pointer                   
 
845
  NdbOperation*     next();             // Get next pointer                    
 
846
 
 
847
public:
 
848
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
849
  NdbTransaction* getNdbTransaction();
 
850
  const NdbOperation* next() const;
 
851
  const NdbRecAttr* getFirstRecAttr() const;
 
852
#endif
 
853
protected:
 
854
 
 
855
  enum OperationStatus
 
856
  { 
 
857
    Init,                       
 
858
    OperationDefined,
 
859
    TupleKeyDefined,
 
860
    GetValue,
 
861
    SetValue,
 
862
    ExecInterpretedValue,
 
863
    SetValueInterpreted,
 
864
    FinalGetValue,
 
865
    SubroutineExec,
 
866
    SubroutineEnd,
 
867
    WaitResponse,
 
868
    WaitCommitResponse,
 
869
    Finished,
 
870
    ReceiveFinished
 
871
  };
 
872
 
 
873
  OperationStatus   Status();                   // Read the status information
 
874
  
 
875
  void              Status(OperationStatus);    // Set the status information
 
876
 
 
877
  void              NdbCon(NdbTransaction*);    // Set reference to connection
 
878
                                                // object.
 
879
 
 
880
  virtual void      release();                  // Release all operations 
 
881
                                                // connected to
 
882
                                                // the operations object.      
 
883
  void              setStartIndicator();
 
884
 
 
885
/******************************************************************************
 
886
 * The methods below is the execution part of the NdbOperation
 
887
 * class. This is where the NDB signals are sent and received. The
 
888
 * operation can send TC[KEY/INDX]REQ, [INDX]ATTRINFO. 
 
889
 * It can receive TC[KEY/INDX]CONF, TC[KEY/INDX]REF, [INDX]ATTRINFO. 
 
890
 * When an operation is received in its fulness or a refuse message 
 
891
 * was sent, then the connection object is told about this situation.
 
892
 *****************************************************************************/
 
893
 
 
894
  int    doSend(int ProcessorId, Uint32 lastFlag);
 
895
  virtual int    prepareSend(Uint32  TC_ConnectPtr,
 
896
                             Uint64  TransactionId,
 
897
                             AbortOption);
 
898
  virtual void   setLastFlag(NdbApiSignal* signal, Uint32 lastFlag);
 
899
    
 
900
  int    prepareSendInterpreted();            // Help routine to prepare*
 
901
   
 
902
  int    receiveTCKEYREF(NdbApiSignal*); 
 
903
 
 
904
  int    checkMagicNumber(bool b = true); // Verify correct object
 
905
 
 
906
  int    checkState_TransId(NdbApiSignal* aSignal);
 
907
 
 
908
/******************************************************************************
 
909
 *      These are support methods only used locally in this class.
 
910
******************************************************************************/
 
911
 
 
912
  virtual int equal_impl(const NdbColumnImpl*,const char* aValue);
 
913
  virtual NdbRecAttr* getValue_impl(const NdbColumnImpl*, char* aValue = 0);
 
914
  int setValue(const NdbColumnImpl* anAttrObject, const char* aValue);
 
915
  NdbBlob* getBlobHandle(NdbTransaction* aCon, const NdbColumnImpl* anAttrObject);
 
916
  int incValue(const NdbColumnImpl* anAttrObject, Uint32 aValue);
 
917
  int incValue(const NdbColumnImpl* anAttrObject, Uint64 aValue);
 
918
  int subValue(const NdbColumnImpl* anAttrObject, Uint32 aValue);
 
919
  int subValue(const NdbColumnImpl* anAttrObject, Uint64 aValue);
 
920
  int read_attr(const NdbColumnImpl* anAttrObject, Uint32 RegDest);
 
921
  int write_attr(const NdbColumnImpl* anAttrObject, Uint32 RegSource);
 
922
  int branch_reg_reg(Uint32 type, Uint32, Uint32, Uint32);
 
923
  int branch_col(Uint32 type, Uint32, const void *, Uint32, bool, Uint32 Label);
 
924
  int branch_col_null(Uint32 type, Uint32 col, Uint32 Label);
 
925
  
 
926
  // Handle ATTRINFO signals   
 
927
  int insertATTRINFO(Uint32 aData);
 
928
  int insertATTRINFOloop(const Uint32* aDataPtr, Uint32 aLength);
 
929
  
 
930
  int insertKEYINFO(const char* aValue, 
 
931
                    Uint32 aStartPosition,      
 
932
                    Uint32 aKeyLenInByte);
 
933
  void reorderKEYINFO();
 
934
  
 
935
  virtual void setErrorCode(int aErrorCode);
 
936
  virtual void setErrorCodeAbort(int aErrorCode);
 
937
 
 
938
  void        handleFailedAI_ElemLen();    // When not all attribute data
 
939
                                           // were received
 
940
 
 
941
  int         incCheck(const NdbColumnImpl* anAttrObject);
 
942
  int         initial_interpreterCheck();
 
943
  int         intermediate_interpreterCheck();
 
944
  int         read_attrCheck(const NdbColumnImpl* anAttrObject);
 
945
  int         write_attrCheck(const NdbColumnImpl* anAttrObject);
 
946
  int         labelCheck();
 
947
  int         insertCall(Uint32 aCall);
 
948
  int         insertBranch(Uint32 aBranch);
 
949
 
 
950
  Uint32 ptr2int() { return theReceiver.getId(); };
 
951
 
 
952
  // get table or index key from prepared signals
 
953
  int getKeyFromTCREQ(Uint32* data, Uint32 & size);
 
954
 
 
955
  virtual void setReadLockMode(LockMode lockMode);
 
956
 
 
957
/******************************************************************************
 
958
 * These are the private variables that are defined in the operation objects.
 
959
 *****************************************************************************/
 
960
 
 
961
  Type m_type;
 
962
 
 
963
  NdbReceiver theReceiver;
 
964
 
 
965
  NdbError theError;                    // Errorcode           
 
966
  int      theErrorLine;                // Error line       
 
967
 
 
968
  Ndb*             theNdb;              // Point back to the Ndb object.
 
969
  NdbTransaction*   theNdbCon;          // Point back to the connection object.
 
970
  NdbOperation*    theNext;             // Next pointer to operation.
 
971
 
 
972
  union {
 
973
    NdbApiSignal* theTCREQ;             // The TC[KEY/INDX]REQ signal object
 
974
    NdbApiSignal* theSCAN_TABREQ;
 
975
  };
 
976
 
 
977
  NdbApiSignal*    theFirstATTRINFO;    // The first ATTRINFO signal object 
 
978
  NdbApiSignal*    theCurrentATTRINFO;  // The current ATTRINFO signal object  
 
979
  Uint32           theTotalCurrAI_Len;  // The total number of attribute info
 
980
                                        // words currently defined    
 
981
  Uint32           theAI_LenInCurrAI;   // The number of words defined in the
 
982
                                        // current ATTRINFO signal
 
983
  NdbApiSignal*    theLastKEYINFO;      // The first KEYINFO signal object 
 
984
 
 
985
  class NdbLabel*           theFirstLabel;
 
986
  class NdbLabel*           theLastLabel;
 
987
  class NdbBranch*          theFirstBranch;
 
988
  class NdbBranch*          theLastBranch;
 
989
  class NdbCall*            theFirstCall;
 
990
  class NdbCall*            theLastCall;
 
991
  class NdbSubroutine*    theFirstSubroutine;
 
992
  class NdbSubroutine*    theLastSubroutine;
 
993
  Uint32            theNoOfLabels;
 
994
  Uint32            theNoOfSubroutines;
 
995
 
 
996
  Uint32*           theKEYINFOptr;       // Pointer to where to write KEYINFO
 
997
  Uint32*           theATTRINFOptr;      // Pointer to where to write ATTRINFO
 
998
 
 
999
  const class NdbTableImpl* m_currentTable; // The current table
 
1000
  const class NdbTableImpl* m_accessTable;  // Index table (== current for pk)
 
1001
 
 
1002
  // Set to TRUE when a tuple key attribute has been defined. 
 
1003
  Uint32            theTupleKeyDefined[NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY][3];
 
1004
 
 
1005
  Uint32            theTotalNrOfKeyWordInSignal;     // The total number of
 
1006
                                                     // keyword in signal.
 
1007
 
 
1008
  Uint32            theTupKeyLen;       // Length of the tuple key in words
 
1009
                                        // left until done
 
1010
  Uint8 theNoOfTupKeyLeft;  // The number of tuple key attributes
 
1011
  OperationType theOperationType;        // Read Request, Update Req......   
 
1012
  
 
1013
  LockMode        theLockMode;     // Can be set to WRITE if read operation 
 
1014
  OperationStatus theStatus;       // The status of the operation.      
 
1015
  
 
1016
  Uint32         theMagicNumber;  // Magic number to verify that object 
 
1017
                                   // is correct
 
1018
  Uint32 theScanInfo;              // Scan info bits (take over flag etc)
 
1019
  Uint32 theDistributionKey;       // Distribution Key size if used
 
1020
 
 
1021
  Uint32 theSubroutineSize;        // Size of subroutines for interpretation
 
1022
  Uint32 theInitialReadSize;       // Size of initial reads for interpretation
 
1023
  Uint32 theInterpretedSize;       // Size of interpretation
 
1024
  Uint32 theFinalUpdateSize;       // Size of final updates for interpretation
 
1025
  Uint32 theFinalReadSize;         // Size of final reads for interpretation
 
1026
 
 
1027
  Uint8  theStartIndicator;      // Indicator of whether start operation
 
1028
  Uint8  theCommitIndicator;     // Indicator of whether commit operation
 
1029
  Uint8  theSimpleIndicator;     // Indicator of whether simple operation
 
1030
  Uint8  theDirtyIndicator;      // Indicator of whether dirty operation
 
1031
  Uint8  theInterpretIndicator;  // Indicator of whether interpreted operation
 
1032
  Int8  theDistrKeyIndicator_;    // Indicates whether distr. key is used
 
1033
  Uint8  m_no_disk_flag;          
 
1034
 
 
1035
  Uint16 m_tcReqGSN;
 
1036
  Uint16 m_keyInfoGSN;
 
1037
  Uint16 m_attrInfoGSN;
 
1038
 
 
1039
  // Blobs in this operation
 
1040
  NdbBlob* theBlobList;
 
1041
 
 
1042
  /*
 
1043
   * Abort option per operation, used by blobs.
 
1044
   * See also comments on enum AbortOption.
 
1045
   */
 
1046
  Int8 m_abortOption;
 
1047
 
 
1048
  /*
 
1049
   * For blob impl, option to not propagate error to trans level.
 
1050
   * Could be AO_IgnoreError variant if we want it public.
 
1051
   * Ignored unless AO_IgnoreError is also set.
 
1052
   */
 
1053
  Int8 m_noErrorPropagation;
 
1054
 
 
1055
  friend struct Ndb_free_list_t<NdbOperation>;
 
1056
};
 
1057
 
 
1058
#ifdef NDB_NO_DROPPED_SIGNAL
 
1059
#include <stdlib.h>
 
1060
#endif
 
1061
 
 
1062
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
 
1063
 
 
1064
inline
 
1065
int
 
1066
NdbOperation::checkMagicNumber(bool b)
 
1067
{
 
1068
  if (theMagicNumber != 0xABCDEF01){
 
1069
#ifdef NDB_NO_DROPPED_SIGNAL
 
1070
    if(b) abort();
 
1071
#endif
 
1072
    return -1;
 
1073
  }
 
1074
  return 0;
 
1075
}
 
1076
 
 
1077
inline
 
1078
void
 
1079
NdbOperation::setStartIndicator()
 
1080
{
 
1081
  theStartIndicator = 1;
 
1082
}
 
1083
 
 
1084
inline
 
1085
int
 
1086
NdbOperation::getNdbErrorLine()
 
1087
{
 
1088
  return theErrorLine;
 
1089
}
 
1090
 
 
1091
/******************************************************************************
 
1092
void next(NdbOperation* aNdbOperation);
 
1093
 
 
1094
Parameters:    aNdbOperation: Pointers to the NdbOperation object.
 
1095
Remark:        Set the next variable of the operation object.
 
1096
******************************************************************************/
 
1097
inline
 
1098
void
 
1099
NdbOperation::next(NdbOperation* aNdbOperation)
 
1100
{
 
1101
  theNext = aNdbOperation;
 
1102
}
 
1103
 
 
1104
/******************************************************************************
 
1105
NdbOperation* next();
 
1106
 
 
1107
Return Value:   Return  next pointer to NdbOperation object.
 
1108
Remark:         Get the next variable of the operation object.
 
1109
******************************************************************************/
 
1110
inline
 
1111
NdbOperation*
 
1112
NdbOperation::next()
 
1113
{
 
1114
  return theNext;
 
1115
}
 
1116
 
 
1117
inline
 
1118
const NdbOperation*
 
1119
NdbOperation::next() const 
 
1120
{
 
1121
  return theNext;
 
1122
}
 
1123
 
 
1124
inline
 
1125
const NdbRecAttr*
 
1126
NdbOperation::getFirstRecAttr() const 
 
1127
{
 
1128
  return theReceiver.theFirstRecAttr;
 
1129
}
 
1130
 
 
1131
/******************************************************************************
 
1132
Type getType()
 
1133
                                                                                
 
1134
Return Value    Return the Type.
 
1135
Remark:         Gets type of access.
 
1136
******************************************************************************/
 
1137
inline
 
1138
NdbOperation::Type
 
1139
NdbOperation::getType() const
 
1140
{
 
1141
  return m_type;
 
1142
}
 
1143
                                                                                
 
1144
/******************************************************************************
 
1145
OperationStatus  Status();
 
1146
 
 
1147
Return Value    Return the OperationStatus.     
 
1148
Parameters:     aStatus:  The status.
 
1149
Remark:         Sets Operation status. 
 
1150
******************************************************************************/
 
1151
inline
 
1152
NdbOperation::OperationStatus                   
 
1153
NdbOperation::Status()
 
1154
{
 
1155
  return theStatus;
 
1156
}
 
1157
 
 
1158
/******************************************************************************
 
1159
void  Status(OperationStatus aStatus);
 
1160
 
 
1161
Parameters:     aStatus: The status.
 
1162
Remark:         Sets Operation
 
1163
 status. 
 
1164
******************************************************************************/
 
1165
inline
 
1166
void                    
 
1167
NdbOperation::Status( OperationStatus aStatus )
 
1168
{
 
1169
  theStatus = aStatus;
 
1170
}
 
1171
 
 
1172
/******************************************************************************
 
1173
void NdbCon(NdbTransaction* aNdbCon);
 
1174
 
 
1175
Parameters:    aNdbCon: Pointers to NdbTransaction object.
 
1176
Remark:        Set the reference to the connection in the operation object.
 
1177
******************************************************************************/
 
1178
inline
 
1179
void
 
1180
NdbOperation::NdbCon(NdbTransaction* aNdbCon)
 
1181
{
 
1182
  theNdbCon = aNdbCon;
 
1183
}
 
1184
 
 
1185
inline
 
1186
int
 
1187
NdbOperation::equal(const char* anAttrName, const char* aValue, Uint32 len)
 
1188
{
 
1189
  return equal(anAttrName, aValue);
 
1190
}
 
1191
 
 
1192
inline
 
1193
int
 
1194
NdbOperation::equal(const char* anAttrName, Int32 aPar)
 
1195
{
 
1196
  return equal(anAttrName, (const char*)&aPar, (Uint32)4);
 
1197
}
 
1198
 
 
1199
inline
 
1200
int
 
1201
NdbOperation::equal(const char* anAttrName, Uint32 aPar)
 
1202
{
 
1203
  return equal(anAttrName, (const char*)&aPar, (Uint32)4);
 
1204
}
 
1205
 
 
1206
inline
 
1207
int
 
1208
NdbOperation::equal(const char* anAttrName, Int64 aPar)
 
1209
{
 
1210
  return equal(anAttrName, (const char*)&aPar, (Uint32)8);
 
1211
}
 
1212
 
 
1213
inline
 
1214
int
 
1215
NdbOperation::equal(const char* anAttrName, Uint64 aPar)
 
1216
{
 
1217
  return equal(anAttrName, (const char*)&aPar, (Uint32)8);
 
1218
}
 
1219
 
 
1220
inline
 
1221
int
 
1222
NdbOperation::equal(Uint32 anAttrId, const char* aValue, Uint32 len)
 
1223
{
 
1224
  return equal(anAttrId, aValue);
 
1225
}
 
1226
 
 
1227
inline
 
1228
int
 
1229
NdbOperation::equal(Uint32 anAttrId, Int32 aPar)
 
1230
{
 
1231
  return equal(anAttrId, (const char*)&aPar, (Uint32)4);
 
1232
}
 
1233
 
 
1234
inline
 
1235
int
 
1236
NdbOperation::equal(Uint32 anAttrId, Uint32 aPar)
 
1237
{
 
1238
  return equal(anAttrId, (const char*)&aPar, (Uint32)4);
 
1239
}
 
1240
 
 
1241
inline
 
1242
int
 
1243
NdbOperation::equal(Uint32 anAttrId, Int64 aPar)
 
1244
{
 
1245
  return equal(anAttrId, (const char*)&aPar, (Uint32)8);
 
1246
}
 
1247
 
 
1248
inline
 
1249
int
 
1250
NdbOperation::equal(Uint32 anAttrId, Uint64 aPar)
 
1251
{
 
1252
  return equal(anAttrId, (const char*)&aPar, (Uint32)8);
 
1253
}
 
1254
 
 
1255
inline
 
1256
int
 
1257
NdbOperation::setValue(const char* anAttrName, const char* aValue, Uint32 len)
 
1258
{
 
1259
  return setValue(anAttrName, aValue);
 
1260
}
 
1261
 
 
1262
inline
 
1263
int
 
1264
NdbOperation::setValue(const char* anAttrName, Int32 aPar)
 
1265
{
 
1266
  return setValue(anAttrName, (const char*)&aPar, (Uint32)4);
 
1267
}
 
1268
 
 
1269
inline
 
1270
int
 
1271
NdbOperation::setValue(const char* anAttrName, Uint32 aPar)
 
1272
{
 
1273
  return setValue(anAttrName, (const char*)&aPar, (Uint32)4);
 
1274
}
 
1275
 
 
1276
inline
 
1277
int
 
1278
NdbOperation::setValue(const char* anAttrName, Int64 aPar)
 
1279
{
 
1280
  return setValue(anAttrName, (const char*)&aPar, (Uint32)8);
 
1281
}
 
1282
 
 
1283
inline
 
1284
int
 
1285
NdbOperation::setValue(const char* anAttrName, Uint64 aPar)
 
1286
{
 
1287
  return setValue(anAttrName, (const char*)&aPar, (Uint32)8);
 
1288
}
 
1289
 
 
1290
inline
 
1291
int
 
1292
NdbOperation::setValue(const char* anAttrName, float aPar)
 
1293
{
 
1294
  return setValue(anAttrName, (const char*)&aPar, (Uint32)4);
 
1295
}
 
1296
 
 
1297
inline
 
1298
int
 
1299
NdbOperation::setValue(const char* anAttrName, double aPar)
 
1300
{
 
1301
  return setValue(anAttrName, (const char*)&aPar, (Uint32)8);
 
1302
}
 
1303
 
 
1304
inline
 
1305
int
 
1306
NdbOperation::setValue(Uint32 anAttrId, const char* aValue, Uint32 len)
 
1307
{
 
1308
  return setValue(anAttrId, aValue);
 
1309
}
 
1310
 
 
1311
inline
 
1312
int
 
1313
NdbOperation::setValue(Uint32 anAttrId, Int32 aPar)
 
1314
{
 
1315
  return setValue(anAttrId, (const char*)&aPar, (Uint32)4);
 
1316
}
 
1317
 
 
1318
inline
 
1319
int
 
1320
NdbOperation::setValue(Uint32 anAttrId, Uint32 aPar)
 
1321
{
 
1322
  return setValue(anAttrId, (const char*)&aPar, (Uint32)4);
 
1323
}
 
1324
 
 
1325
inline
 
1326
int
 
1327
NdbOperation::setValue(Uint32 anAttrId, Int64 aPar)
 
1328
{
 
1329
  return setValue(anAttrId, (const char*)&aPar, (Uint32)8);
 
1330
}
 
1331
 
 
1332
inline
 
1333
int
 
1334
NdbOperation::setValue(Uint32 anAttrId, Uint64 aPar)
 
1335
{
 
1336
  return setValue(anAttrId, (const char*)&aPar, (Uint32)8);
 
1337
}
 
1338
 
 
1339
inline
 
1340
int
 
1341
NdbOperation::setValue(Uint32 anAttrId, float aPar)
 
1342
{
 
1343
  return setValue(anAttrId, (char*)&aPar, (Uint32)4);
 
1344
}
 
1345
 
 
1346
inline
 
1347
int
 
1348
NdbOperation::setValue(Uint32 anAttrId, double aPar)
 
1349
{
 
1350
  return setValue(anAttrId, (const char*)&aPar, (Uint32)8);
 
1351
}
 
1352
 
 
1353
#endif // doxygen
 
1354
 
 
1355
#endif