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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16
#ifndef HUGO_OPERATIONS_HPP
17
#define HUGO_OPERATIONS_HPP
20
#include <HugoCalculator.hpp>
21
#include <UtilTransactions.hpp>
24
class HugoOperations : public UtilTransactions {
26
HugoOperations(const NdbDictionary::Table&,
27
const NdbDictionary::Index* idx = 0);
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();
37
void setTransactionId(Uint64);
39
int pkInsertRecord(Ndb*,
42
int updatesValue = 0);
44
int pkWriteRecord(Ndb*,
47
int updatesValue = 0);
49
int pkWritePartialRecord(Ndb*,
53
int pkReadRecord(Ndb*,
56
NdbOperation::LockMode lm = NdbOperation::LM_Read);
58
int pkUpdateRecord(Ndb*,
61
int updatesValue = 0);
63
int pkDeleteRecord(Ndb*,
67
int execute_Commit(Ndb*,
68
AbortOption ao = AbortOnError);
69
int execute_NoCommit(Ndb*,
70
AbortOption ao = AbortOnError);
71
int execute_Rollback(Ndb*);
73
int saveCopyOfRecord(int numRecords = 1);
74
int compareRecordToCopy(int numRecords = 1);
76
BaseString getRecordStr(int recordNum);
77
int getRecordGci(int recordNum);
79
int setValueForAttr(NdbOperation*,
84
int equalForAttr(NdbOperation*,
88
int equalForRow(NdbOperation*, int rowid);
90
int setValues(NdbOperation*, int rowId, int updateId);
92
int verifyUpdatesValue(int updatesValue, int _numRows = 0);
94
int indexReadRecords(Ndb*, const char * idxName, int recordNo,
95
bool exclusive = false,
98
int indexUpdateRecord(Ndb*,
102
int updatesValue = 0);
104
int scanReadRecords(Ndb*, NdbScanOperation::LockMode =
105
NdbScanOperation::LM_CommittedRead,
108
NdbIndexScanOperation* pIndexScanOp;
110
NDBT_ResultRow& get_row(Uint32 idx) { return *rows[idx];}
112
int execute_async(Ndb*, NdbTransaction::ExecType, NdbOperation::AbortOption = NdbOperation::AbortOnError);
113
int execute_async_prepare(Ndb*, NdbTransaction::ExecType, NdbOperation::AbortOption = NdbOperation::AbortOnError);
115
int wait_async(Ndb*, int timeout = -1);
118
void allocRows(int rows);
121
Vector<NDBT_ResultRow*> rows;
124
Vector<BaseString> savedRecords;
126
struct RsPair { NdbScanOperation* m_result_set; int records; };
127
Vector<RsPair> m_result_sets;
128
Vector<RsPair> m_executed_result_sets;
132
friend void HugoOperations_async_callback(int, NdbTransaction*, void*);
133
void callback(int res, NdbTransaction*);