本文整理汇总了C++中NdbScanOperation::interpret_exit_ok方法的典型用法代码示例。如果您正苦于以下问题:C++ NdbScanOperation::interpret_exit_ok方法的具体用法?C++ NdbScanOperation::interpret_exit_ok怎么用?C++ NdbScanOperation::interpret_exit_ok使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NdbScanOperation
的用法示例。
在下文中一共展示了NdbScanOperation::interpret_exit_ok方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sf
int
UtilTransactions::selectCount(Ndb* pNdb,
int parallelism,
int* count_rows,
NdbOperation::LockMode lm,
NdbConnection* pTrans){
int retryAttempt = 0;
const int retryMax = 100;
int check;
NdbScanOperation *pOp;
if(!pTrans)
pTrans = pNdb->startTransaction();
while (true){
if (retryAttempt >= retryMax){
g_info << "ERROR: has retried this operation " << retryAttempt
<< " times, failing!" << endl;
return NDBT_FAILED;
}
pOp = getScanOperation(pTrans);
if (pOp == NULL) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
if( pOp->readTuples(lm) ) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
if(0){
NdbScanFilter sf(pOp);
sf.begin(NdbScanFilter::OR);
sf.eq(2, (Uint32)30);
sf.end();
} else {
check = pOp->interpret_exit_ok();
if( check == -1 ) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
int eof;
int rows = 0;
while((eof = pOp->nextResult()) == 0){
rows++;
}
if (eof == -1) {
const NdbError err = pTrans->getNdbError();
if (err.status == NdbError::TemporaryError){
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
closeTransaction(pNdb);
return NDBT_FAILED;
}
closeTransaction(pNdb);
if (count_rows != NULL){
*count_rows = rows;
}
return NDBT_OK;
}
return NDBT_FAILED;
}
示例2: row
int
UtilTransactions::scanAndCompareUniqueIndex(Ndb* pNdb,
const NdbDictionary::Index* pIndex,
int parallelism,
bool transactional){
int retryAttempt = 0;
const int retryMax = 100;
int check;
NdbScanOperation *pOp;
NDBT_ResultRow row(tab);
parallelism = 1;
while (true){
restart:
if (retryAttempt >= retryMax){
g_info << "ERROR: has retried this operation " << retryAttempt
<< " times, failing!" << endl;
return NDBT_FAILED;
}
pTrans = pNdb->startTransaction();
if (pTrans == NULL) {
const NdbError err = pNdb->getNdbError();
if (err.status == NdbError::TemporaryError){
ERR(err);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
return NDBT_FAILED;
}
pOp = pTrans->getNdbScanOperation(tab.getName());
if (pOp == NULL) {
const NdbError err = pNdb->getNdbError();
closeTransaction(pNdb);
ERR(err);
if (err.status == NdbError::TemporaryError){
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
return NDBT_FAILED;
}
int rs;
if(transactional){
rs = pOp->readTuples(NdbScanOperation::LM_Read, 0, parallelism);
} else {
rs = pOp->readTuples(NdbScanOperation::LM_CommittedRead, 0, parallelism);
}
if( rs != 0 ) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
check = pOp->interpret_exit_ok();
if( check == -1 ) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
// Read all attributes
for (int a = 0; a < tab.getNoOfColumns(); a++){
if ((row.attributeStore(a) =
pOp->getValue(tab.getColumn(a)->getName())) == 0) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
if (err.status == NdbError::TemporaryError){
ERR(err);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
closeTransaction(pNdb);
return NDBT_FAILED;
}
int eof;
int rows = 0;
//.........这里部分代码省略.........
示例3: utilTrans
inline
int
ScanInterpretTest::scanReadVerify(Ndb* pNdb,
int records,
int parallelism,
ScanFilter& filter){
int retryAttempt = 0;
const int retryMax = 100;
int check;
NdbConnection *pTrans;
NdbScanOperation *pOp;
while (true){
if (retryAttempt >= retryMax){
ndbout << "ERROR: has retried this operation " << retryAttempt
<< " times, failing!" << endl;
return NDBT_FAILED;
}
pTrans = pNdb->startTransaction();
if (pTrans == NULL) {
const NdbError err = pNdb->getNdbError();
if (err.status == NdbError::TemporaryError){
ERR(err);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
return NDBT_FAILED;
}
pOp = pTrans->getNdbScanOperation(tab.getName());
if (pOp == NULL) { if (pOp->getValue("KOL2") == 0){
ERR(pNdb->getNdbError());
return NDBT_FAILED;
}
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if( pOp->readTuples(NdbScanOperation::LM_Read, 0, parallelism) ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
check = pOp->interpret_exit_ok();
if (check == -1) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
// Read all attributes
for(int a = 0; a<tab.getNoOfColumns(); a++){
if((row.attributeStore(a) =
pOp->getValue(tab.getColumn(a)->getName())) == 0) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
}
check = pTrans->execute(NoCommit);
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
int eof;
int rows = 0;
int rowsNoExist = 0;
int rowsExist = 0;
int existingRecordsNotFound = 0;
int nonExistingRecordsFound = 0;
NdbConnection* pExistTrans;
NdbConnection* pNoExistTrans;
while((eof = pOp->nextResult(true)) == 0){
pExistTrans = pNdb->startTransaction();
if (pExistTrans == NULL) {
const NdbError err = pNdb->getNdbError();
ERR(err);
return NDBT_FAILED;
}
pNoExistTrans = pNdb->startTransaction();
if (pNoExistTrans == NULL) {
const NdbError err = pNdb->getNdbError();
ERR(err);
return NDBT_FAILED;
}
//.........这里部分代码省略.........
示例4: if
int
UtilTransactions::verifyOrderedIndex(Ndb* pNdb,
const NdbDictionary::Index* pIndex,
int parallelism,
bool transactional){
int retryAttempt = 0;
const int retryMax = 100;
int check;
NdbScanOperation *pOp;
NdbIndexScanOperation * iop = 0;
NDBT_ResultRow scanRow(tab);
NDBT_ResultRow pkRow(tab);
NDBT_ResultRow indexRow(tab);
const char * indexName = pIndex->getName();
int res;
parallelism = 1;
while (true){
if (retryAttempt >= retryMax){
g_info << "ERROR: has retried this operation " << retryAttempt
<< " times, failing!" << endl;
return NDBT_FAILED;
}
pTrans = pNdb->startTransaction();
if (pTrans == NULL) {
const NdbError err = pNdb->getNdbError();
if (err.status == NdbError::TemporaryError){
ERR(err);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
return NDBT_FAILED;
}
pOp = pTrans->getNdbScanOperation(tab.getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
if( pOp->readTuples(NdbScanOperation::LM_Read, 0, parallelism) ) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
check = pOp->interpret_exit_ok();
if( check == -1 ) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
if(get_values(pOp, scanRow))
{
abort();
}
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
if (err.status == NdbError::TemporaryError){
ERR(err);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
closeTransaction(pNdb);
return NDBT_FAILED;
}
int eof;
int rows = 0;
while(check == 0 && (eof = pOp->nextResult()) == 0){
rows++;
bool null_found= false;
for(int a = 0; a<(int)pIndex->getNoOfColumns(); a++){
const NdbDictionary::Column * col = pIndex->getColumn(a);
if (scanRow.attributeStore(col->getName())->isNULL())
{
null_found= true;
break;
}
}
// Do pk lookup
NdbOperation * pk = pTrans->getNdbOperation(tab.getName());
//.........这里部分代码省略.........
示例5: while
inline
int
ScanFunctions::scanReadFunctions(Ndb* pNdb,
int records,
int parallelism,
ActionType action,
bool exclusive){
int retryAttempt = 0;
const int retryMax = 100;
int sleepTime = 10;
int check;
NdbConnection *pTrans = 0;
NdbScanOperation *pOp = 0;
while (true){
if (retryAttempt >= retryMax){
g_err << "ERROR: has retried this operation " << retryAttempt
<< " times, failing!" << endl;
return NDBT_FAILED;
}
pTrans = pNdb->startTransaction();
if (pTrans == NULL) {
const NdbError err = pNdb->getNdbError();
if (err.status == NdbError::TemporaryError){
ERR(err);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
return NDBT_FAILED;
}
// Execute the scan without defining a scan operation
pOp = pTrans->getNdbScanOperation(tab.getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if( pOp->readTuples(exclusive ?
NdbScanOperation::LM_Exclusive :
NdbScanOperation::LM_Read) ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if (action == OnlyOpenScanOnce){
// Call openScan one more time when it's already defined
if( pOp->readTuples(NdbScanOperation::LM_Read) ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
}
if (action==EqualAfterOpenScan){
check = pOp->equal(tab.getColumn(0)->getName(), 10);
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
}
check = pOp->interpret_exit_ok();
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
for(int a = 0; a<tab.getNoOfColumns(); a++){
if(pOp->getValue(tab.getColumn(a)->getName()) == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
}
check = pTrans->execute(NoCommit);
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
int abortCount = records / 10;
bool abortTrans = (action==CloseWithoutStop);
int eof;
int rows = 0;
eof = pOp->nextResult();
while(eof == 0){
rows++;
//.........这里部分代码省略.........
示例6: while
int
HugoTransactions::scanReadRecords(Ndb* pNdb,
int records,
int abortPercent,
int parallelism,
NdbOperation::LockMode lm,
int scan_flags)
{
int retryAttempt = 0;
int check, a;
NdbScanOperation *pOp;
while (true){
if (retryAttempt >= m_retryMax){
g_err << "ERROR: has retried this operation " << retryAttempt
<< " times, failing!" << endl;
return NDBT_FAILED;
}
pTrans = pNdb->startTransaction();
if (pTrans == NULL) {
const NdbError err = pNdb->getNdbError();
if (err.status == NdbError::TemporaryError){
ERR(err);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
return NDBT_FAILED;
}
pOp = getScanOperation(pTrans);
if (pOp == NULL) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
if( pOp ->readTuples(lm, scan_flags, parallelism) ) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
check = pOp->interpret_exit_ok();
if( check == -1 ) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
for(a = 0; a<tab.getNoOfColumns(); a++){
if((row.attributeStore(a) =
pOp->getValue(tab.getColumn(a)->getName())) == 0) {
ERR(pTrans->getNdbError());
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
check = pTrans->execute(NoCommit, AbortOnError);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
if (err.status == NdbError::TemporaryError){
ERR(err);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
closeTransaction(pNdb);
return NDBT_FAILED;
}
// Abort after 1-100 or 1-records rows
int ranVal = rand();
int abortCount = ranVal % (records == 0 ? 100 : records);
bool abortTrans = false;
if (abort > 0){
// Abort if abortCount is less then abortPercent
if (abortCount < abortPercent)
abortTrans = true;
}
int eof;
int rows = 0;
while((eof = pOp->nextResult(true)) == 0){
rows++;
if (calc.verifyRowValues(&row) != 0){
closeTransaction(pNdb);
return NDBT_FAILED;
}
if (abortCount == rows && abortTrans == true){
ndbout << "Scan is aborted" << endl;
//.........这里部分代码省略.........
示例7: filter
//.........这里部分代码省略.........
case 2: { // 1 row
default:
assert(g_table->getNoOfPrimaryKeys() == 1); // only impl. so far
int tot = g_paramters[P_ROWS].value;
int row = rand() % tot;
#if 0
fix_eq_bound(pIOp, row);
#else
pIOp->setBound((Uint32)0, NdbIndexScanOperation::BoundEQ, &row);
#endif
if(g_paramters[P_RESET].value == 2)
goto execute;
break;
}
case 3: { // read multi
int multi = g_paramters[P_MULTI].value;
int tot = g_paramters[P_ROWS].value;
for(; multi > 0 && i < iter; --multi, i++)
{
int row = rand() % tot;
pIOp->setBound((Uint32)0, NdbIndexScanOperation::BoundEQ, &row);
pIOp->end_of_bound(i);
}
if(g_paramters[P_RESET].value == 2)
goto execute;
break;
}
}
}
assert(pOp);
switch(g_paramters[P_FILT].value){
case 0: // All
check = pOp->interpret_exit_ok();
break;
case 1: // None
check = pOp->interpret_exit_nok();
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;
NdbScanFilter filter(pOp) ;
filter.begin(NdbScanFilter::AND);
fix_eq(filter, pOp, row);
filter.end();
break;
#endif
}
}
if(check != 0){
err(pOp->getNdbError());
return -1;
}
assert(check == 0);
if(g_paramters[P_RESET].value == 1)
g_paramters[P_RESET].value = 2;
for(int i = 0; i<g_table->getNoOfColumns(); i++){
pOp->getValue(i);
}
示例8: scanReadRecords
//.........这里部分代码省略.........
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);
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();
sf.begin(NdbScanFilter::OR);
sf.begin(NdbScanFilter::AND);
sf.ge(0, (Uint32)0);
sf.lt(0, (Uint32)50);
sf.end();
sf.begin(NdbScanFilter::AND);
sf.ge(0, (Uint32)100);
sf.lt(0, (Uint32)200);
sf.end();
sf.end();
sf.end();
#endif
} else {
check = pOp->interpret_exit_ok();
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return -1;
}
}
bool disk= false;
for(int a = 0; a<pTab->getNoOfColumns(); a++)
{
const NdbDictionary::Column* col = pTab->getColumn(a);
if(col->getStorageType() == NdbDictionary::Column::StorageTypeDisk)
disk= true;
if (!nodata)
if((row->attributeStore(a) = pOp->getValue(col)) == 0)
{
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return -1;
}
}
NdbRecAttr * disk_ref= 0;
if(_dumpDisk && disk)
disk_ref = pOp->getValue(NdbDictionary::Column::DISK_REF);
NdbRecAttr * rowid= 0, *frag = 0, *gci = 0;
if (use_rowid)
{
frag = pOp->getValue(NdbDictionary::Column::FRAGMENT);
rowid = pOp->getValue(NdbDictionary::Column::ROWID);
示例9: runTestBug34107
int runTestBug34107(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
const NdbDictionary::Table * pTab = ctx->getTab();
Ndb* pNdb = GETNDB(step);
int i;
for (i = 0; i <= 1; i++) {
g_info << "bug34107:" << (i == 0 ? " small" : " too big") << endl;
NdbConnection* pTrans = pNdb->startTransaction();
if (pTrans == NULL){
ERR(pNdb->getNdbError());
return NDBT_FAILED;
}
NdbScanOperation* pOp = pTrans->getNdbScanOperation(pTab->getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if (pOp->readTuples() == -1) {
ERR(pOp->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
int n = i == 0 ? 10000 : 30000;
int k;
for (k = 0; k < n; k++) {
// inserts 1 word ATTRINFO
if (pOp->interpret_exit_ok() == -1) {
ERR(pOp->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
}
if (pTrans->execute(NoCommit) == -1) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
int ret;
while ((ret = pOp->nextResult()) == 0)
;
g_info << "ret=" << ret << " err=" << pOp->getNdbError().code << endl;
if (i == 0 && ret != 1) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if (i == 1 && ret != -1) {
g_err << "unexpected big filter success" << endl;
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if (i == 1 && pOp->getNdbError().code != 874) {
g_err << "unexpected big filter error code, wanted 874" << endl;
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
pNdb->closeTransaction(pTrans);
}
return NDBT_OK;
}