本文整理汇总了C++中NdbTransaction::getNdbIndexScanOperation方法的典型用法代码示例。如果您正苦于以下问题:C++ NdbTransaction::getNdbIndexScanOperation方法的具体用法?C++ NdbTransaction::getNdbIndexScanOperation怎么用?C++ NdbTransaction::getNdbIndexScanOperation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NdbTransaction
的用法示例。
在下文中一共展示了NdbTransaction::getNdbIndexScanOperation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scanReadRecords
int scanReadRecords(Ndb* pNdb,
const NdbDictionary::Table* pTab,
const NdbDictionary::Index* pIdx,
int parallel,
int _lock,
bool headers,
bool useHexFormat,
char delimiter, bool order, bool descending) {
int retryAttempt = 0;
const int retryMax = 100;
int check;
NdbTransaction *pTrans;
NdbScanOperation *pOp;
NdbIndexScanOperation * pIOp= 0;
NDBT_ResultRow * row = new NDBT_ResultRow(*pTab, delimiter);
while (true) {
if (retryAttempt >= retryMax) {
ndbout << "ERROR: has retried this operation " << retryAttempt
<< " times, failing!" << endl;
return -1;
}
pTrans = pNdb->startTransaction();
if (pTrans == NULL) {
const NdbError err = pNdb->getNdbError();
if (err.status == NdbError::TemporaryError) {
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
return -1;
}
pOp = (!pIdx) ? pTrans->getNdbScanOperation(pTab->getName()) :
pIOp=pTrans->getNdbIndexScanOperation(pIdx->getName(), pTab->getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return -1;
}
int rs;
unsigned scan_flags = 0;
if (_tup) scan_flags |= NdbScanOperation::SF_TupScan;
switch(_lock + (3 * order)) {
case 1:
rs = pOp->readTuples(NdbScanOperation::LM_Read, scan_flags, parallel);
break;
case 2:
rs = pOp->readTuples(NdbScanOperation::LM_Exclusive, scan_flags, parallel);
break;
case 3:
rs = pIOp->readTuples(NdbScanOperation::LM_CommittedRead, 0, parallel,
true, descending);
break;
case 4:
rs = pIOp->readTuples(NdbScanOperation::LM_Read, 0, parallel, true, descending);
break;
case 5:
rs = pIOp->readTuples(NdbScanOperation::LM_Exclusive, 0, parallel, true, descending);
break;
case 0:
default:
rs = pOp->readTuples(NdbScanOperation::LM_CommittedRead, scan_flags, parallel);
break;
}
if( rs != 0 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return -1;
}
if(0) {
NdbScanFilter sf(pOp);
#if 0
sf.begin(NdbScanFilter::AND);
sf.le(0, (Uint32)10);
sf.end();
#elif 0
sf.begin(NdbScanFilter::OR);
sf.begin(NdbScanFilter::AND);
sf.ge(0, (Uint32)10);
sf.lt(0, (Uint32)20);
sf.end();
sf.begin(NdbScanFilter::AND);
sf.ge(0, (Uint32)30);
sf.lt(0, (Uint32)40);
sf.end();
sf.end();
#elif 1
sf.begin(NdbScanFilter::AND);
//.........这里部分代码省略.........