21 #include <mysqld_error.h>
23 #include <ndb_global.h>
28 #include <HugoOperations.hpp>
29 #include <../../src/ndbapi/NdbApiSignal.hpp>
30 #include <kernel/signaldata/ScanTab.hpp>
31 #include <kernel/signaldata/QueryTree.hpp>
32 #include <kernel/AttributeHeader.hpp>
38 static const char* _dbname =
"TEST_DB";
40 static struct my_option my_long_options[] =
42 NDB_STD_OPTS(
"spj_test"),
43 {
"database",
'd',
"Name of database table is in",
44 (uchar**) &_dbname, (uchar**) &_dbname, 0,
45 GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
46 {
"scan",
's',
"Table scan followed by key lookup",
47 (uchar**) &_scan, (uchar**) &_scan, 0,
48 GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
49 { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
58 op->theTotalCurrAI_Len = 0;
59 op->attrInfoRemain = 0;
60 op->theFirstATTRINFO = 0;
61 op->insertATTRINFOData_NdbRecord((
const char*)src, 4*len);
65 ScanTabReq::setViaSPJFlag(req->requestInfo, 1);
78 int main(
int argc,
char** argv)
82 const char *load_default_groups[]= {
"mysql_cluster",0 };
83 load_defaults(
"my",load_default_groups,&argc,&argv);
86 opt_debug=
"d:t:O,/tmp/ndb_desc.trace";
88 if ((ho_error=handle_options(&argc, &argv, my_long_options,
89 ndb_std_get_one_option)))
90 return NDBT_ProgramExit(NDBT_WRONGARGS);
95 ndbout <<
"Unable to connect to management server." << endl;
96 return NDBT_ProgramExit(NDBT_FAILED);
102 ndbout <<
"Cluster nodes not ready in 30 seconds." << endl;
103 return NDBT_ProgramExit(NDBT_FAILED);
106 Ndb MyNdb(&con, _dbname);
107 if(MyNdb.init() != 0){
108 ERR(MyNdb.getNdbError());
109 return NDBT_ProgramExit(NDBT_FAILED);
116 ndbout_c(
"Failed to retreive table: \"%s\"", argv[0]);
121 ndbout_c(
"Retreived %s", argv[0]);
127 ndbout_c(
"Failed to retreive index PRIMARY for table: \"%s\"", argv[0]);
132 ndbout_c(
"Retreived index PRIMARY for table %s", argv[0]);
139 bool scanindexchild =
false;
169 QueryPattern::col(0),
228 DABits::NI_HAS_PARENT | DABits::NI_KEY_LINKED |
229 DABits::NI_ATTR_INTERPRET | DABits::NI_ATTR_PARAMS,
234 QueryPattern::col(0),
241 QueryPattern::paramHeader(0),
293 DABits::NI_HAS_PARENT | DABits::NI_KEY_LINKED |
294 DABits::NI_ATTR_INTERPRET | DABits::NI_ATTR_LINKED,
299 QueryPattern::col(0),
324 DABits::PI_ATTR_LIST,
336 scanindexchild =
true;
343 DABits::NI_LINKED_ATTR,
350 DABits::NI_HAS_PARENT | DABits::NI_KEY_LINKED,
355 QueryPattern::data(1),
383 Uint32 n0 = (request[1] >> 16);
384 Uint32 n1 = (request[1 + n0] >> 16);
385 request[0] = ((1 + n0 + n1) << 16) | 2;
390 if (scanindexchild ==
false)
401 NdbScanFilterImpl::setIsLinkedFlag(pOp);
402 NdbScanFilterImpl::set(pOp, request, NDB_ARRAY_SIZE(request));
405 while (
true) NdbSleep_SecSleep(1);
407 return NDBT_ProgramExit(NDBT_OK);