本文整理汇总了C++中NdbScanOperation::getBlobHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ NdbScanOperation::getBlobHandle方法的具体用法?C++ NdbScanOperation::getBlobHandle怎么用?C++ NdbScanOperation::getBlobHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NdbScanOperation
的用法示例。
在下文中一共展示了NdbScanOperation::getBlobHandle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calc_blob_column
int calc_blob_column(const NdbDictionary::Table * t,
const NdbDictionary::Index * ix,
int col,
Ndb* ndb,
int & szRam,
int & szDisk,
bool ftScan)
{
NdbTransaction * trans = ndb->startTransaction();
NdbScanOperation * sop = trans->getNdbScanOperation(t);
sop->readTuples();
NdbBlob * blob = sop->getBlobHandle(col);
bool no_data=false;
if(trans->execute(NdbTransaction::NoCommit,
NdbOperation::AbortOnError, 1) == -1)
{
no_data=true;
sop->close();
trans->close();
}
unsigned long long len=0;
int rows=0;
int check=0;
const NdbDictionary::Column * c = t->getColumn(col);
int part_size= c->getPartSize();
if(!no_data)
{
while(((check = sop->nextResult(true)) == 0) && !ignoreData)
{
int isnull;
rows++;
blob->getNull(isnull);
if(isnull)
len=0;
else
blob->getLength(len);
/*
printf("blob is %llu\n", len);
if(len>256)
{
szRam+=(((len-256)/part_size) + 1)*part_size+256;
printf("len2=%llu, part-size=%d, len=%llu\n", (((len-256)/part_size) + 1)*part_size+256, part_size, len);
}
else
*/
szRam+=(int)len;
if(rows==1000 && !ftScan)
break;
}
sop->close();
trans->close();
}
if(rows==0)
{
if (c->getStorageType() == NdbDictionary::Column::StorageTypeDisk)
{
printf("---\tWARNING! No reference data found for BLOB/TEXT. "
"Defaulting to 256 bytes DataMemory, %d bytes Diskspace! \n",(part_size<=256 ? 0:part_size));
printf("\tConsider loading database with average data for exact"
" measurement. \n");
szRam=256;
szDisk=(part_size<=256 ? 0:part_size);
return 0;
}
else
{
printf("---\tWARNING! No reference data found for BLOB/TEXT. "
"Defaulting to %d bytes DataMemory ! \n", (part_size<=256 ? 256:part_size+256));
printf("\tConsider loading database with average data for exact"
" measurement. \n");
szRam=(part_size<=256 ? 256:part_size+256);
szDisk=0;
return 0;
}
}
if (c->getStorageType() == NdbDictionary::Column::StorageTypeDisk)
{
int averageSz=szRam/rows;
if((averageSz)>256)
{
szRam=256;
szDisk=((averageSz-256)/part_size) *part_size + (((averageSz-256)%part_size)==0 ? 0:part_size);
}
else
{
szRam=256;
szDisk=0;
}
}
else
{
//.........这里部分代码省略.........