19 #include "NDBT_Test.hpp"
20 #include "NDBT_ReturnCodes.h"
21 #include "HugoTransactions.hpp"
22 #include "UtilTransactions.hpp"
23 #include "NdbRestarter.hpp"
25 #include "ScanFilter.hpp"
26 #include "ScanInterpretTest.hpp"
30 int records = ctx->getNumRecords();
32 if (hugoTrans.loadTable(GETNDB(step), records) != 0){
39 int records = ctx->getNumRecords();
42 if (utilTrans.clearTable2(GETNDB(step), records) != 0){
49 int records = ctx->getNumRecords();
51 GETNDB(step)->getDictionary()->getTable(ctx->getProperty(
"ResultTabName",
"NULL"));
54 if (utilTrans.clearTable2(GETNDB(step), records) != 0){
61 int loops = ctx->getNumLoops();
62 int records = ctx->getNumRecords();
63 int parallelism = ctx->getProperty(
"Parallelism", 1);
69 if (hugoTrans.scanReadRecords(GETNDB(step), records, 0, parallelism) != 0){
78 int records = ctx->getNumRecords();
79 int parallelism = ctx->getProperty(
"Parallelism", 1);
81 NDBT_Table::discoverTableFromDb(GETNDB(step),
82 ctx->getProperty(
"ResultTabName",
"NULL"));
85 if (hugoTrans.scanReadRecords(GETNDB(step), records, 0, parallelism) != 0){
96 ctx->setProperty(
"ResultTabName", newTabName);
99 resTab.setName(newTabName);
101 if (GETNDB(step)->getDictionary()->createTable(resTab) != 0){
102 g_err << newTabName <<
" creation failed!"<< endl;
105 g_info << newTabName <<
" created!"<< endl;
111 int records = ctx->getNumRecords();
112 const char* resTabName = ctx->getProperty(
"ResultTabName",
"NULL");
113 if (strcmp(resTabName,
"NULL") == 0)
116 const NdbDictionary::Table* pResTab = NDBT_Table::discoverTableFromDb(GETNDB(step), resTabName);
121 if (interpretTest.scanRead(GETNDB(step),
130 int records = ctx->getNumRecords();
132 return scanWithFilter(ctx, step, filt);
136 return scanWithFilter(ctx, step, filt);
140 int records = ctx->getNumRecords();
141 const char* resTabName = ctx->getProperty(
"ResultTabName",
"NULL");
142 if (strcmp(resTabName,
"NULL") == 0)
145 const NdbDictionary::Table* pResTab = NDBT_Table::discoverTableFromDb(GETNDB(step), resTabName);
150 if (interpretTest.scanReadVerify(GETNDB(step),
159 int records = ctx->getNumRecords();
161 return scanVerifyWithFilter(ctx, step, filt);
165 return scanVerifyWithFilter(ctx, step, filt);
169 int loops = ctx->getNumLoops();
173 if (scanWithFilter(ctx, step, filt) != NDBT_OK)
175 if (runClearResTable(ctx, step) != NDBT_OK)
184 int loops = ctx->getNumLoops();
188 if (scanWithFilter(ctx, step, filt) != NDBT_OK)
190 if (scanVerifyWithFilter(ctx, step, filt) != NDBT_OK)
192 if (runClearResTable(ctx, step) != NDBT_OK)
200 int loops = ctx->getNumLoops();
201 int records = ctx->getNumRecords();
205 if (scanWithFilter(ctx, step, filt) != NDBT_OK)
207 if (runClearResTable(ctx, step) != NDBT_OK)
214 NDBT_TESTSUITE(testScanInterpreter);
215 TESTCASE(
"ScanLessThan",
216 "Read all records in table TX with attrX less "\
217 "than a value and store the resultset in TX_RES."\
218 "Then compare records in TX_RES with records in TX."){
221 INITIALIZER(runLoadTable);
222 INITIALIZER(runCreateResultTable);
223 STEP(runScanLessThan);
224 VERIFIER(runScanLessThanVerify);
225 FINALIZER(runClearTable);
226 FINALIZER(runClearResTable);
228 TESTCASE(
"ScanEqual",
229 "Read all records in table TX with attrX equal "\
230 "to a value and store the resultset in TX_RES."\
231 "Then compare records in TX_RES with records in TX."){
234 INITIALIZER(runLoadTable);
235 INITIALIZER(runCreateResultTable);
237 VERIFIER(runScanEqualVerify);
238 FINALIZER(runClearTable);
239 FINALIZER(runClearResTable);
241 TESTCASE(
"ScanEqualLoop",
242 "Scan all records in TX equal to a value."\
243 "Do this loop number of times"){
246 INITIALIZER(runLoadTable);
247 INITIALIZER(runCreateResultTable);
248 STEP(runScanEqualLoop);
249 FINALIZER(runClearTable);
250 FINALIZER(runClearResTable);
252 TESTCASE(
"ScanEqualVerifyLoop",
253 "Scan all records in TX equal to a value."\
254 "Verify record in TX_RES table"\
255 "Do this loop number of times"){
258 INITIALIZER(runLoadTable);
259 INITIALIZER(runCreateResultTable);
260 STEP(runScanEqualVerifyLoop);
261 FINALIZER(runClearTable);
262 FINALIZER(runClearResTable);
264 TESTCASE(
"ScanLessThanLoop",
265 "Scan all records in TX less than a value."\
266 "Do this loop number of times"){
269 INITIALIZER(runLoadTable);
270 INITIALIZER(runCreateResultTable);
271 STEP(runScanLessThanLoop);
272 FINALIZER(runClearTable);
273 FINALIZER(runClearResTable);
275 NDBT_TESTSUITE_END(testScanInterpreter);
277 int main(
int argc,
const char** argv){
279 NDBT_TESTSUITE_INSTANCE(testScanInterpreter);
280 return testScanInterpreter.execute(argc, argv);