~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to storage/ndb/test/include/HugoOperations.hpp

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2013-12-22 10:27:05 UTC
  • Revision ID: package-import@ubuntu.com-20131222102705-mndw7s12mz0szrcn
Tags: upstream-5.5.32
Import upstream version 5.5.32

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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA */
 
15
 
 
16
#ifndef HUGO_OPERATIONS_HPP
 
17
#define HUGO_OPERATIONS_HPP
 
18
 
 
19
#include <NDBT.hpp>
 
20
#include <HugoCalculator.hpp>
 
21
#include <UtilTransactions.hpp>
 
22
#include <Vector.hpp>
 
23
 
 
24
class HugoOperations : public UtilTransactions {
 
25
public:  
 
26
  HugoOperations(const NdbDictionary::Table&,
 
27
                 const NdbDictionary::Index* idx = 0);
 
28
 
 
29
  ~HugoOperations();
 
30
  int startTransaction(Ndb*, const NdbDictionary::Table *table= 0,
 
31
                       const char  *keyData= 0, Uint32 keyLen= 0);
 
32
  int setTransaction(NdbTransaction*,bool not_null_ok= false);
 
33
  int closeTransaction(Ndb*);
 
34
  NdbTransaction* getTransaction();
 
35
  void refresh();
 
36
 
 
37
  void setTransactionId(Uint64);
 
38
  
 
39
  int pkInsertRecord(Ndb*,
 
40
                     int recordNo,
 
41
                     int numRecords = 1,
 
42
                     int updatesValue = 0);
 
43
  
 
44
  int pkWriteRecord(Ndb*,
 
45
                    int recordNo,
 
46
                    int numRecords = 1,
 
47
                    int updatesValue = 0);
 
48
 
 
49
  int pkWritePartialRecord(Ndb*,
 
50
                           int recordNo,
 
51
                           int numRecords = 1);
 
52
  
 
53
  int pkReadRecord(Ndb*,
 
54
                   int recordNo,
 
55
                   int numRecords = 1,
 
56
                   NdbOperation::LockMode lm = NdbOperation::LM_Read);
 
57
  
 
58
  int pkUpdateRecord(Ndb*,
 
59
                     int recordNo,
 
60
                     int numRecords = 1,
 
61
                     int updatesValue = 0);
 
62
  
 
63
  int pkDeleteRecord(Ndb*,
 
64
                     int recordNo,
 
65
                     int numRecords = 1);
 
66
  
 
67
  int execute_Commit(Ndb*, 
 
68
                     AbortOption ao = AbortOnError);
 
69
  int execute_NoCommit(Ndb*,
 
70
                       AbortOption ao = AbortOnError);
 
71
  int execute_Rollback(Ndb*);
 
72
  
 
73
  int saveCopyOfRecord(int numRecords = 1);
 
74
  int compareRecordToCopy(int numRecords = 1);
 
75
 
 
76
  BaseString getRecordStr(int recordNum);
 
77
  int getRecordGci(int recordNum);
 
78
 
 
79
  int setValueForAttr(NdbOperation*,
 
80
                      int attrId, 
 
81
                      int rowId,
 
82
                      int updateId);
 
83
  
 
84
  int equalForAttr(NdbOperation*,
 
85
                   int attrId, 
 
86
                   int rowId);
 
87
 
 
88
  int equalForRow(NdbOperation*, int rowid);
 
89
  
 
90
  int setValues(NdbOperation*, int rowId, int updateId);
 
91
  
 
92
  int verifyUpdatesValue(int updatesValue, int _numRows = 0);
 
93
 
 
94
  int indexReadRecords(Ndb*, const char * idxName, int recordNo,
 
95
                       bool exclusive = false,
 
96
                       int records = 1);
 
97
  
 
98
  int indexUpdateRecord(Ndb*,
 
99
                        const char * idxName, 
 
100
                        int recordNo,
 
101
                        int numRecords = 1,
 
102
                        int updatesValue = 0);
 
103
 
 
104
  int scanReadRecords(Ndb*, NdbScanOperation::LockMode = 
 
105
                      NdbScanOperation::LM_CommittedRead, 
 
106
                      int numRecords = 1);
 
107
 
 
108
  NdbIndexScanOperation* pIndexScanOp;
 
109
 
 
110
  NDBT_ResultRow& get_row(Uint32 idx) { return *rows[idx];}
 
111
 
 
112
  int execute_async(Ndb*, NdbTransaction::ExecType, NdbOperation::AbortOption = NdbOperation::AbortOnError);
 
113
  int execute_async_prepare(Ndb*, NdbTransaction::ExecType, NdbOperation::AbortOption = NdbOperation::AbortOnError);
 
114
  
 
115
  int wait_async(Ndb*, int timeout = -1);
 
116
 
 
117
protected:
 
118
  void allocRows(int rows);
 
119
  void deallocRows();
 
120
 
 
121
  Vector<NDBT_ResultRow*> rows;
 
122
  HugoCalculator calc;
 
123
 
 
124
  Vector<BaseString> savedRecords;
 
125
 
 
126
  struct RsPair { NdbScanOperation* m_result_set; int records; };
 
127
  Vector<RsPair> m_result_sets;
 
128
  Vector<RsPair> m_executed_result_sets;
 
129
 
 
130
  int m_async_reply;
 
131
  int m_async_return;
 
132
  friend void HugoOperations_async_callback(int, NdbTransaction*, void*);
 
133
  void callback(int res, NdbTransaction*);
 
134
};
 
135
 
 
136
#endif