本文整理汇总了C++中NdbConnection::scanIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ NdbConnection::scanIndex方法的具体用法?C++ NdbConnection::scanIndex怎么用?C++ NdbConnection::scanIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NdbConnection
的用法示例。
在下文中一共展示了NdbConnection::scanIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: filter
int
run_scan(){
int iter = g_paramters[P_LOOPS].value;
NDB_TICKS start1, stop;
int sum_time= 0;
Uint32 sample_rows = 0;
int tot_rows = 0;
NDB_TICKS sample_start = NdbTick_CurrentMillisecond();
Uint32 tot = g_paramters[P_ROWS].value;
if(g_paramters[P_BOUND].value >= 2 || g_paramters[P_FILT].value == 2)
iter *= g_paramters[P_ROWS].value;
NdbScanOperation * pOp = 0;
NdbIndexScanOperation * pIOp = 0;
NdbConnection * pTrans = 0;
int check = 0;
for(int i = 0; i<iter; i++){
start1 = NdbTick_CurrentMillisecond();
pTrans = pTrans ? pTrans : g_ndb->startTransaction();
if(!pTrans){
g_err << "Failed to start transaction" << endl;
err(g_ndb->getNdbError());
return -1;
}
int par = g_paramters[P_PARRA].value;
int bat = g_paramters[P_BATCH].value;
NdbScanOperation::LockMode lm;
switch(g_paramters[P_LOCK].value){
case 0:
lm = NdbScanOperation::LM_CommittedRead;
break;
case 1:
lm = NdbScanOperation::LM_Read;
break;
case 2:
lm = NdbScanOperation::LM_Exclusive;
break;
default:
abort();
}
NdbScanOperation::ScanOptions options;
bzero(&options, sizeof(options));
options.optionsPresent=
NdbScanOperation::ScanOptions::SO_SCANFLAGS |
NdbScanOperation::ScanOptions::SO_PARALLEL |
NdbScanOperation::ScanOptions::SO_BATCH;
bool ord= g_paramters[P_ACCESS].value == 2;
bool mrr= (g_paramters[P_ACCESS].value != 0) &&
(g_paramters[P_BOUND].value == 3);
options.scan_flags|=
( ord ? NdbScanOperation::SF_OrderBy:0 ) |
( mrr ? NdbScanOperation::SF_MultiRange:0 );
options.parallel= par;
options.batch= bat;
switch(g_paramters[P_FILT].value){
case 0: // All
break;
case 1: // None
break;
case 2: // 1 row
default: {
assert(g_table->getNoOfPrimaryKeys() == 1); // only impl. so far
abort();
#if 0
int tot = g_paramters[P_ROWS].value;
int row = rand() % tot;
NdbInterpretedCode* ic= new NdbInterpretedCode(g_table);
NdbScanFilter filter(ic);
filter.begin(NdbScanFilter::AND);
filter.eq(0, row);
filter.end();
options.scan_flags|= NdbScanOperation::SF_Interpreted;
options.interpretedCode= ⁣
break;
#endif
}
}
if(g_paramters[P_ACCESS].value == 0){
pOp = pTrans->scanTable(g_table_record,
lm,
NULL, // Mask
&options,
sizeof(NdbScanOperation::ScanOptions));
assert(pOp);
} else {
pOp= pIOp= pTrans->scanIndex(g_index_record,
g_table_record,
lm,
//.........这里部分代码省略.........