本文整理汇总了C++中TableTuple::maxExportSerializationSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TableTuple::maxExportSerializationSize方法的具体用法?C++ TableTuple::maxExportSerializationSize怎么用?C++ TableTuple::maxExportSerializationSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableTuple
的用法示例。
在下文中一共展示了TableTuple::maxExportSerializationSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
size_t
DRTupleStream::computeOffsets(TableTuple &tuple,
size_t *rowHeaderSz)
{
// round-up columncount to next multiple of 8 and divide by 8
const int columnCount = tuple.sizeInValues();
int nullMaskLength = ((columnCount + 7) & -8) >> 3;
// row header is 32-bit length of row plus null mask
*rowHeaderSz = sizeof(int32_t) + nullMaskLength;
//Can return 0 for a single column varchar with null
size_t dataSz = tuple.maxExportSerializationSize();
return *rowHeaderSz + dataSz;
}
示例2: TableTuple
// helper to make a schema, a tuple and calculate EL size
size_t
TableTupleExportTest::maxElSize(std::vector<uint16_t> &keep_offsets,
bool useNullStrings)
{
TableTuple *tt;
TupleSchema *ts;
char buf[1024]; // tuple data
ts = TupleSchema::createTupleSchema(m_schema, keep_offsets);
tt = new TableTuple(buf, ts);
// if the tuple includes strings, add some content
// assuming all Export tuples were allocated for persistent
// storage and choosing set* api accordingly here.
if (ts->columnCount() > 6) {
NValue nv = ValueFactory::getStringValue("ABCDEabcde"); // 10 char
if (useNullStrings)
{
nv.free(); nv.setNull();
}
tt->setNValueAllocateForObjectCopies(6, nv, NULL);
nv.free();
}
if (ts->columnCount() > 7) {
NValue nv = ValueFactory::getStringValue("abcdeabcdeabcdeabcde"); // 20 char
if (useNullStrings)
{
nv.free(); nv.setNull();
}
tt->setNValueAllocateForObjectCopies(7, nv, NULL);
nv.free();
}
// The function under test!
size_t sz = tt->maxExportSerializationSize();
// and cleanup
tt->freeObjectColumns();
delete tt;
TupleSchema::freeTupleSchema(ts);
return sz;
}
示例3: throwFatalException
size_t
TupleStreamWrapper::computeOffsets(TableTuple &tuple,
size_t *rowHeaderSz)
{
// round-up columncount to next multiple of 8 and divide by 8
int columnCount = tuple.sizeInValues() + METADATA_COL_CNT;
int nullMaskLength = ((columnCount + 7) & -8) >> 3;
// row header is 32-bit length of row plus null mask
*rowHeaderSz = sizeof (int32_t) + nullMaskLength;
// metadata column width: 5 int64_ts plus CHAR(1).
size_t metadataSz = (sizeof (int64_t) * 5) + 1;
// returns 0 if corrupt tuple detected
size_t dataSz = tuple.maxExportSerializationSize();
if (dataSz == 0) {
throwFatalException("Invalid tuple passed to computeTupleMaxLength. Crashing System.");
}
return *rowHeaderSz + metadataSz + dataSz;
}