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 UTIL_TRANSACTIONS_HPP
17
#define UTIL_TRANSACTIONS_HPP
21
typedef int (ReadCallBackFn)(NDBT_ResultRow*);
23
class UtilTransactions {
25
UtilTransactions(const NdbDictionary::Table&,
26
const NdbDictionary::Index* idx = 0);
27
UtilTransactions(Ndb* ndb,
28
const char * tableName, const char * indexName = 0);
30
int closeTransaction(Ndb*);
33
NdbScanOperation::ScanFlag,
41
// Delete all records from the table using a scan
45
// Delete all records from the table using a scan
57
int* count_rows = NULL,
58
NdbOperation::LockMode lm = NdbOperation::LM_CommittedRead,
59
NdbConnection* pTrans = NULL);
60
int scanReadRecords(Ndb*,
62
NdbOperation::LockMode lm,
66
ReadCallBackFn* fn = NULL);
68
const char* indexName,
70
bool transactional = false);
72
int copyTableData(Ndb*,
73
const char* destName);
76
* Compare this table with other_table
78
* return 0 - on equality
82
int compare(Ndb*, const char * other_table, int flags);
85
static int takeOverAndDeleteRecord(Ndb*,
88
int addRowToDelete(Ndb* pNdb,
89
NdbConnection* pDelTrans,
90
NdbOperation* pOrgOp);
93
int addRowToInsert(Ndb* pNdb,
94
NdbConnection* pInsTrans,
96
const char* insertTabName);
99
int verifyUniqueIndex(Ndb*,
100
const NdbDictionary::Index *,
102
bool transactional = false);
104
int scanAndCompareUniqueIndex(Ndb* pNdb,
105
const NdbDictionary::Index *,
109
int readRowFromTableAndIndex(Ndb* pNdb,
110
NdbConnection* pTrans,
111
const NdbDictionary::Index *,
112
NDBT_ResultRow& row );
114
int verifyOrderedIndex(Ndb*,
115
const NdbDictionary::Index *,
117
bool transactional = false);
120
int get_values(NdbOperation* op, NDBT_ResultRow& dst);
121
int equal(const NdbDictionary::Table*, NdbOperation*, const NDBT_ResultRow&);
122
int equal(const NdbDictionary::Index*, NdbOperation*, const NDBT_ResultRow&);
125
int m_defaultClearMethod;
126
const NdbDictionary::Table& tab;
127
const NdbDictionary::Index* idx;
128
NdbConnection* pTrans;
130
NdbOperation* getOperation(NdbConnection*,
131
NdbOperation::OperationType);
132
NdbScanOperation* getScanOperation(NdbConnection*);