本文整理汇总了C++中ObScanner::next_row方法的典型用法代码示例。如果您正苦于以下问题:C++ ObScanner::next_row方法的具体用法?C++ ObScanner::next_row怎么用?C++ ObScanner::next_row使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObScanner
的用法示例。
在下文中一共展示了ObScanner::next_row方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buf
TEST(TestObScanner, get_row)
{
ObScanner scanner;
const int table_num = 10;
const int row_num = 20;
const int column_num = 10;
buffer table_name[table_num];
buffer row_key[row_num];
buffer column_name[column_num];
for (int i = 0; i < table_num; i++)
{
table_name[i].assigne("T").appende(i);
}
for (int i = 0; i < row_num; i++)
{
row_key[i].assigne("R").appende(i);
}
for (int i = 0; i < column_num; i++)
{
column_name[i].assigne("C").appende(i);
}
for (int i = 0; i < table_num; i++)
{
for (int j = 0; j < row_num; j++)
{
for (int k = 0; k < column_num; k++)
{
ObCellInfo cell;
cell.table_name_ = table_name[i].get_obstring();
cell.row_key_ = row_key[j].get_obstring();
cell.column_name_ = column_name[k].get_obstring();
cell.value_.set_int(1);
scanner.add_cell(cell);
}
}
}
ObScanner::RowIterator it = scanner.row_begin();
ASSERT_EQ(it == scanner.row_begin(), true);
for (int i = 0; i < table_num; i++)
{
for (int j = 0; j < row_num; j++)
{
ObCellInfo *row;
int64_t num = 0;
ASSERT_EQ(OB_SUCCESS, scanner.next_row());
ASSERT_EQ(OB_SUCCESS, scanner.get_row(&row, &num));
ASSERT_EQ(column_num, num);
}
}
ASSERT_EQ(OB_ITER_END, scanner.next_row());
buffer buf(1 << 21);
scanner.serialize(buf.ptre(), buf.capacity(), buf.length());
printf("%ld\n", buf.length());
ObScanner dscanner;
int64_t pos = 0;
dscanner.deserialize(buf.ptre(), buf.length(), pos);
for (int i = 0; i < table_num; i++)
{
for (int j = 0; j < row_num; j++)
{
ObCellInfo *row;
int64_t num = 0;
ASSERT_EQ(OB_SUCCESS, dscanner.next_row());
ASSERT_EQ(OB_SUCCESS, dscanner.get_row(&row, &num));
ASSERT_EQ(column_num, num);
}
}
ASSERT_EQ(OB_ITER_END, dscanner.next_row());
scanner.clear();
scanner.set_mem_size_limit(256);
int j = 0, k = 0;
int err = OB_SUCCESS;
for (; j < row_num; j++)
{
for (k = 0; k < column_num; k++)
{
ObCellInfo cell;
cell.table_name_ = table_name[0].get_obstring();
cell.row_key_ = row_key[j].get_obstring();
cell.column_name_ = column_name[k].get_obstring();
cell.value_.set_int(1);
if (OB_SUCCESS != (err = scanner.add_cell(cell)))
{
break;
}
}
if (OB_SUCCESS != err)
{
break;
}
}
if (OB_SUCCESS != err)
{
//.........这里部分代码省略.........