本文整理汇总了C++中NdbScanOperation::getValue方法的典型用法代码示例。如果您正苦于以下问题:C++ NdbScanOperation::getValue方法的具体用法?C++ NdbScanOperation::getValue怎么用?C++ NdbScanOperation::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NdbScanOperation
的用法示例。
在下文中一共展示了NdbScanOperation::getValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: allocRows
int
HugoOperations::scanReadRecords(Ndb* pNdb, NdbScanOperation::LockMode lm,
int records){
allocRows(records);
NdbScanOperation * pOp = pTrans->getNdbScanOperation(tab.getName());
if(!pOp)
return -1;
if(pOp->readTuples(lm, 0, 1)){
return -1;
}
for(int a = 0; a<tab.getNoOfColumns(); a++){
if((rows[0]->attributeStore(a) =
pOp->getValue(tab.getColumn(a)->getName())) == 0) {
ERR(pTrans->getNdbError());
return NDBT_FAILED;
}
}
RsPair p = {pOp, records};
m_result_sets.push_back(p);
return 0;
}
示例2: scan_print
int scan_print(Ndb * myNdb)
{
// Scan all records exclusive and update
// them one by one
int retryAttempt = 0;
const int retryMax = 10;
int fetchedRows = 0;
int check;
NdbError err;
NdbTransaction *myTrans;
NdbScanOperation *myScanOp;
/* Result of reading attribute value, three columns:
REG_NO, BRAND, and COLOR
*/
NdbRecAttr * myRecAttr[3];
const NdbDictionary::Dictionary* myDict= myNdb->getDictionary();
const NdbDictionary::Table *myTable= myDict->getTable("api_scan");
if (myTable == NULL)
APIERROR(myDict->getNdbError());
/**
* Loop as long as :
* retryMax not reached
* failed operations due to TEMPORARY erros
*
* Exit loop;
* retyrMax reached
* Permanent error (return -1)
*/
while (true)
{
if (retryAttempt >= retryMax)
{
std::cout << "ERROR: has retried this operation " << retryAttempt
<< " times, failing!" << std::endl;
return -1;
}
myTrans = myNdb->startTransaction();
if (myTrans == NULL)
{
const NdbError err = myNdb->getNdbError();
if (err.status == NdbError::TemporaryError)
{
milliSleep(50);
retryAttempt++;
continue;
}
std::cout << err.message << std::endl;
return -1;
}
/*
* Define a scan operation.
* NDBAPI.
*/
myScanOp = myTrans->getNdbScanOperation(myTable);
if (myScanOp == NULL)
{
std::cout << myTrans->getNdbError().message << std::endl;
myNdb->closeTransaction(myTrans);
return -1;
}
/**
* Read without locks, without being placed in lock queue
*/
if( myScanOp->readTuples(NdbOperation::LM_CommittedRead) == -1)
{
std::cout << myTrans->getNdbError().message << std::endl;
myNdb->closeTransaction(myTrans);
return -1;
}
/**
* Define storage for fetched attributes.
* E.g., the resulting attributes of executing
* myOp->getValue("REG_NO") is placed in myRecAttr[0].
* No data exists in myRecAttr until transaction has commited!
*/
myRecAttr[0] = myScanOp->getValue("REG_NO");
myRecAttr[1] = myScanOp->getValue("BRAND");
myRecAttr[2] = myScanOp->getValue("COLOR");
if(myRecAttr[0] ==NULL || myRecAttr[1] == NULL || myRecAttr[2]==NULL)
{
std::cout << myTrans->getNdbError().message << std::endl;
myNdb->closeTransaction(myTrans);
return -1;
}
/**
* Start scan (NoCommit since we are only reading at this stage);
*/
if(myTrans->execute(NdbTransaction::NoCommit) != 0){
err = myTrans->getNdbError();
if(err.status == NdbError::TemporaryError){
std::cout << myTrans->getNdbError().message << std::endl;
myNdb->closeTransaction(myTrans);
//.........这里部分代码省略.........
示例3: 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;
//.........这里部分代码省略.........
示例4: code
int
select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
int parallelism,
Uint64* count_rows,
NdbOperation::LockMode lock) {
int retryAttempt = 0;
const int retryMax = 100;
int check;
NdbTransaction *pTrans;
NdbScanOperation *pOp;
const Uint32 codeWords= 1;
Uint32 codeSpace[ codeWords ];
NdbInterpretedCode code(NULL, // Table is irrelevant
&codeSpace[0],
codeWords);
if ((code.interpret_exit_last_row() != 0) ||
(code.finalise() != 0))
{
ERR(code.getNdbError());
return NDBT_FAILED;
}
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) {
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
return NDBT_FAILED;
}
pOp = pTrans->getNdbScanOperation(pTab->getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if( pOp->readTuples(NdbScanOperation::LM_Dirty) ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
check = pOp->setInterpretedCode(&code);
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
Uint64 tmp;
Uint32 row_size;
pOp->getValue(NdbDictionary::Column::ROW_COUNT, (char*)&tmp);
pOp->getValue(NdbDictionary::Column::ROW_SIZE, (char*)&row_size);
check = pTrans->execute(NdbTransaction::NoCommit);
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
Uint64 row_count = 0;
int eof;
while((eof = pOp->nextResult(true)) == 0) {
row_count += tmp;
}
if (eof == -1) {
const NdbError err = pTrans->getNdbError();
if (err.status == NdbError::TemporaryError) {
pNdb->closeTransaction(pTrans);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
pNdb->closeTransaction(pTrans);
if (count_rows != NULL) {
*count_rows = row_count;
}
//.........这里部分代码省略.........
示例5: while
inline
int
ScanInterpretTest::scanRead(Ndb* pNdb,
int records,
int parallelism,
ScanFilter& filter){
int retryAttempt = 0;
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) {
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;
}
if (filter.filterOp(pOp) != 0){
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;
NdbConnection* pInsTrans;
while((eof = pOp->nextResult(true)) == 0){
do {
rows++;
if (addRowToInsert(pNdb, pTrans) != 0){
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
} while((eof = pOp->nextResult(false)) == 0);
check = pTrans->execute(Commit);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
ERR(err);
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
}
if (eof == -1) {
const NdbError err = pTrans->getNdbError();
if (err.status == NdbError::TemporaryError){
ERR(err);
pNdb->closeTransaction(pTrans);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
//.........这里部分代码省略.........
示例6: 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;
}
//.........这里部分代码省略.........
示例7: 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++;
//.........这里部分代码省略.........
示例8: 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;
//.........这里部分代码省略.........
示例9: filter
//.........这里部分代码省略.........
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);
}
if(g_paramters[P_RESET].value == 1)
g_paramters[P_RESET].value = 2;
execute:
int rows = 0;
check = pTrans->execute(NoCommit);
assert(check == 0);
int fetch = g_paramters[P_FETCH].value;
while((check = pOp->nextResult(true)) == 0){
do {
rows++;
} while(!fetch && ((check = pOp->nextResult(false)) == 0));
if(check == -1){
err(pTrans->getNdbError());
return -1;
}
assert(check == 2);
}
if(check == -1){
err(pTrans->getNdbError());
return -1;
}
assert(check == 1);
if(g_paramters[P_RESET].value == 0)
{
pTrans->close();
pTrans = 0;
}
stop = NdbTick_CurrentMillisecond();
int time_passed= (int)(stop - start1);
sample_rows += rows;
sum_time+= time_passed;
tot_rows+= rows;
if(sample_rows >= tot)
{
int sample_time = (int)(stop - sample_start);
g_info << "Found " << sample_rows << " rows" << endl;
g_err.println("Time: %d ms = %u rows/sec", sample_time,
(1000*sample_rows)/sample_time);
sample_rows = 0;
sample_start = stop;
}
}
g_err.println("Avg time: %d ms = %u rows/sec", sum_time/tot_rows,
(1000*tot_rows)/sum_time);
return 0;
}
示例10: calc_var_column
int calc_var_column(const NdbDictionary::Table * t,
const NdbDictionary::Index * ix,
int col,
Ndb* ndb,
bool longvarchar,
bool ftScan,
bool ignoreData)
{
char buff[8052];
memset(buff, 0, sizeof(buff));
int sz=0;
NdbTransaction * trans = ndb->startTransaction();
if(trans==0)
abort();
NdbScanOperation * sop;
sop=trans->getNdbScanOperation(t);
sop->readTuples();
NdbRecAttr * attr=sop->getValue(col, buff);
int rows=0;
int charset_size=1;
bool no_data=false;
//Set charset cost (for binary and latin1 cost is 1)
const NdbDictionary::Column * c = t->getColumn(col);
const NdbDictionary::Column::Type type = c->getType();
if ((type == NdbDictionary::Column::Varchar) || (type == NdbDictionary::Column::Longvarchar))
{
CHARSET_INFO * cs2;
cs2= (CHARSET_INFO*)(c->getCharset());
if(cs2!=0)
{
if(strncmp(cs2->name, "utf8",4)==0)
{
charset_size=3;
printf( "---\tWARNING! cs2->name charset used, each character cost : %d bytes\n",charset_size);
}
if(strncmp(cs2->name, "ucs2",4)==0)
{
charset_size=2;
printf( "---\tWARNING! cs2->name charset used, each character cost : %d bytes\n",charset_size);
}
}
}
//Set var header size
int headerSize=longvarchar ? 2 : 1;
if(trans->execute(NdbTransaction::NoCommit,
NdbOperation::AbortOnError, 1) == -1)
{
no_data=true;
trans->close();
}
if(!no_data)
{
int check=0;
while( ((check = sop->nextResult(true)) == 0) && !ignoreData)
{
rows++;
if (verbose)
{
printf("attribut %d size = %d \n",rows,attr->isNULL()==1 ? 0 : attr->get_size_in_bytes());
}
if(attr->isNULL()==1)
{
sz+=0; //for the time being until we know for sure..
}
else
{ //attr->get_size_in_bytes return lengh of attr including header attr cost = (length-header*charset)
sz+=((attr->get_size_in_bytes() - headerSize)* charset_size);
}
if(rows==1024 && !ftScan)
break;
}
trans->close();
}
if(rows==0)
{
sz = (int)(((float)(t->getColumn(col)->getSizeInBytes()))* (float)((float)loadfactor/100));
printf("---\tWARNING! No reference data found for VAR*. Defaulting to max size (loadfactor=100 percent)..%d bytes \n",sz);
printf("\tConsider loading database with average data for exact measurement\n");
return sz+waste_sz(sz);
}
int tmpsz=(sz/rows)+headerSize;
sz=tmpsz + waste_sz(tmpsz);
//.........这里部分代码省略.........
示例11: scanReadRecords
//.........这里部分代码省略.........
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);
}
if (use_gci)
{
gci = pOp->getValue(NdbDictionary::Column::ROW_GCI);
}
check = pTrans->execute(NdbTransaction::NoCommit);
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
if (err.status == NdbError::TemporaryError) {
pNdb->closeTransaction(pTrans);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;