当前位置: 首页>>代码示例>>C++>>正文


C++ TableIterator::next方法代码示例

本文整理汇总了C++中TableIterator::next方法的典型用法代码示例。如果您正苦于以下问题:C++ TableIterator::next方法的具体用法?C++ TableIterator::next怎么用?C++ TableIterator::next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TableIterator的用法示例。


在下文中一共展示了TableIterator::next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: compareTables

//Shouldn't this functionality go into table.h?
void ExecutionEngineTest::compareTables(Table *first, Table *second) {
    ASSERT_TRUE(first->columnCount() == second->columnCount());
    ASSERT_TRUE(first->indexCount() == second->indexCount());
    ASSERT_TRUE(first->activeTupleCount() == second->activeTupleCount());
    ASSERT_TRUE(first->databaseId() == second->databaseId());
    ASSERT_TRUE(first->name() == second->name());
    ASSERT_TRUE(first->tableType() == second->tableType());
    vector<TableIndex*> firstAllIndexes = first->allIndexes();
    vector<TableIndex*> secondAllIndexes = second->allIndexes();
    ASSERT_TRUE(firstAllIndexes.size() == secondAllIndexes.size());
    for (size_t ii = 0; ii < firstAllIndexes.size(); ii++) {
        ASSERT_TRUE(firstAllIndexes[ii]->equals(secondAllIndexes[ii]));
    }
    const TupleSchema *firstSchema = first->schema();
    const TupleSchema *secondSchema = second->schema();
    ASSERT_TRUE(firstSchema->equals(secondSchema));

    TableIterator firstTI = first->iterator();
    TableIterator secondTI = second->iterator();
    TableTuple firstTuple(firstSchema);
    TableTuple secondTuple(secondSchema);
    while(firstTI.next(firstTuple)) {
        ASSERT_TRUE(secondTI.next(secondTuple));
        ASSERT_TRUE(firstTuple.equals(secondTuple));
    }
}
开发者ID:MaOrKsSi,项目名称:voltdb,代码行数:27,代码来源:engine_test.cpp

示例2: tuple

TEST_F(TableTest, TupleInsert) {
    //
    // All of the values have already been inserted, we just
    // need to make sure that the data makes sense
    //
    TableIterator iterator = this->table->iterator();
    TableTuple tuple(table->schema());
    while (iterator.next(tuple)) {
        //printf("%s\n", tuple->debug(this->table).c_str());
        //
        // Make sure it is not deleted
        //
        EXPECT_EQ(true, tuple.isActive());
    }

    //
    // Make sure that if we insert one tuple, we only get one tuple
    //
    TableTuple &temp_tuple = this->table->tempTuple();
    ASSERT_EQ(true, tableutil::setRandomTupleValues(this->table, &temp_tuple));
    this->table->deleteAllTuples(true);
    ASSERT_EQ(0, this->table->activeTupleCount());
    ASSERT_EQ(true, this->table->insertTuple(temp_tuple));
    ASSERT_EQ(1, this->table->activeTupleCount());

    //
    // Then check to make sure that it has the same value and type
    //
    iterator = this->table->iterator();
    ASSERT_EQ(true, iterator.next(tuple));
    for (int col_ctr = 0, col_cnt = NUM_OF_COLUMNS; col_ctr < col_cnt; col_ctr++) {
        EXPECT_EQ(COLUMN_TYPES[col_ctr], tuple.getType(col_ctr));
        EXPECT_TRUE(temp_tuple.getNValue(col_ctr).op_equals(tuple.getNValue(col_ctr)).isTrue());
    }
}
开发者ID:AlessandroEmm,项目名称:voltdb,代码行数:35,代码来源:table_test.cpp

示例3: match

TEST_F(FilterTest, SimpleFilter) {
    // WHERE id = 20

    // ComparisonExpression equal(EXPRESSION_TYPE_COMPARE_EQUAL,
    //                           TupleValueExpression::getInstance(0),
    //                           ConstantValueExpression::getInstance(voltdb::Value::newBigIntValue(20)));

    TupleValueExpression *tup_val_exp = new TupleValueExpression(0, std::string("tablename"), std::string("colname"));
    ConstantValueExpression *const_val_exp = new ConstantValueExpression(ValueFactory::getBigIntValue(20));
    ComparisonExpression<CmpEq> *equal = new ComparisonExpression<CmpEq>(EXPRESSION_TYPE_COMPARE_EQUAL, tup_val_exp, const_val_exp);

    // ::printf("\nFilter:%s\n", equal->debug().c_str());

    int count = 0;
    TableIterator iter = table->iterator();
    TableTuple match(table->schema());
    while (iter.next(match)) {
        if (equal->eval(&match, NULL).isTrue()) {
            //::printf("  match:%s", match->debug(table).c_str());
            ++count;
        }
    }
    ASSERT_EQ(1, count);

    // delete the root to destroy the full tree.
    delete equal;
}
开发者ID:Eonblast,项目名称:voltdb,代码行数:27,代码来源:filter_test.cpp

示例4: p_execute

bool DistinctExecutor::p_execute(const NValueArray &params) {
    DistinctPlanNode* node = dynamic_cast<DistinctPlanNode*>(m_abstractNode);
    assert(node);
    Table* output_table = node->getOutputTable();
    assert(output_table);
    Table* input_table = node->getInputTables()[0];
    assert(input_table);

    TableIterator iterator = input_table->iterator();
    TableTuple tuple(input_table->schema());

    std::set<NValue, NValue::ltNValue> found_values;
    while (iterator.next(tuple)) {
        //
        // Check whether this value already exists in our list
        //
        NValue tuple_value = node->getDistinctExpression()->eval(&tuple, NULL);
        if (found_values.find(tuple_value) == found_values.end()) {
            found_values.insert(tuple_value);
            if (!output_table->insertTuple(tuple)) {
                VOLT_ERROR("Failed to insert tuple from input table '%s' into"
                           " output table '%s'",
                           input_table->name().c_str(),
                           output_table->name().c_str());
                return false;
            }
        }
    }

    return true;
}
开发者ID:Eonblast,项目名称:voltdb,代码行数:31,代码来源:distinctexecutor.cpp

示例5: TableTuple

TEST_F(TableTest, BigTest) {
    vector<NValue> cachedStringValues;//To free at the end of the test
    TableTuple *temp_tuple = &warehouseTempTable->tempTuple();
    temp_tuple->setNValue(0, ValueFactory::getTinyIntValue(static_cast<int8_t>(3)));
    cachedStringValues.push_back(ValueFactory::getStringValue("EZ Street WHouse"));
    temp_tuple->setNValue(1, cachedStringValues.back());
    cachedStringValues.push_back(ValueFactory::getStringValue("Headquarters"));
    temp_tuple->setNValue(2, cachedStringValues.back());
    cachedStringValues.push_back(ValueFactory::getStringValue("77 Mass. Ave."));
    temp_tuple->setNValue(3, cachedStringValues.back());
    cachedStringValues.push_back(ValueFactory::getStringValue("Cambridge"));
    temp_tuple->setNValue(4, cachedStringValues.back());
    cachedStringValues.push_back(ValueFactory::getStringValue("AZ"));
    temp_tuple->setNValue(5, cachedStringValues.back());
    cachedStringValues.push_back(ValueFactory::getStringValue("12938"));
    temp_tuple->setNValue(6, cachedStringValues.back());
    temp_tuple->setNValue(7, ValueFactory::getDoubleValue(static_cast<double>(.1234)));
    temp_tuple->setNValue(8, ValueFactory::getDoubleValue(static_cast<double>(15241.45)));
    warehouseTempTable->insertTupleNonVirtual(*temp_tuple);


    TableTuple warehouseTuple = TableTuple(warehouseTempTable->schema());
    TableIterator warehouseIterator = warehouseTempTable->iterator();
    while (warehouseIterator.next(warehouseTuple)) {
        if (!warehouseTable->insertTuple(warehouseTuple)) {
            cout << "Failed to insert tuple from input table '" << warehouseTempTable->name() << "' into target table '" << warehouseTable->name() << "'" << endl;
        }
    }
    warehouseTempTable->deleteAllTuplesNonVirtual(true);

}
开发者ID:wwgong,项目名称:CVoltDB,代码行数:31,代码来源:table_test.cpp

示例6: match

TEST_F(FilterTest, FunctionAbs2Filter) {
    // WHERE abs(0 - id) = 20

    // ComparisonExpression equal(EXPRESSION_TYPE_COMPARE_EQUAL,
    //                           0 - TupleValueExpression::getInstance(0),
    //                           UnaryFunctionExpression(EXPRESSION_TYPE_FUNCTION_ABS,
    //                                                   ConstantValueExpression::getInstance(voltdb::Value::newBigIntValue(20))));

    ConstantValueExpression *zero_val_exp = new ConstantValueExpression(ValueFactory::getBigIntValue(0));
    TupleValueExpression *tup_val_exp = new TupleValueExpression(0, 0);
    AbstractExpression* minus_exp = new OperatorExpression<OpMinus>(EXPRESSION_TYPE_OPERATOR_MINUS, zero_val_exp, tup_val_exp);
    std::vector<AbstractExpression*>* argument = new std::vector<AbstractExpression*>();
    argument->push_back(minus_exp);
    AbstractExpression* abs_exp = ExpressionUtil::functionFactory(FUNC_ABS, argument);
    ConstantValueExpression *const_val_exp = new ConstantValueExpression(ValueFactory::getBigIntValue(20));
    ComparisonExpression<CmpEq> *equal = new ComparisonExpression<CmpEq>(EXPRESSION_TYPE_COMPARE_EQUAL, abs_exp, const_val_exp);

    // ::printf("\nFilter:%s\n", equal->debug().c_str());

    int count = 0;
    TableIterator iter = table->iterator();
    TableTuple match(table->schema());
    while (iter.next(match)) {
        if (equal->eval(&match, NULL).isTrue()) {
            // ::printf("  match:%s\n", match.debug(std::string("tablename")).c_str());
            ++count;
        }
    }
    ASSERT_EQ(1, count);

    // delete the root to destroy the full tree.
    delete equal;
}
开发者ID:Zealsathish,项目名称:voltdb,代码行数:33,代码来源:filter_test.cpp

示例7: p_execute

bool InsertExecutor::p_execute(const NValueArray &params) {
    //
    // See p_execute_init above.  If we are inserting a
    // replicated table into an export table with no partition column,
    // we only insert on one site.  For all other sites we just
    // do nothing.
    //
    TableTuple inputTuple;
    const TupleSchema *inputSchema = m_inputTable->schema();
    if (p_execute_init(inputSchema, m_tmpOutputTable, inputTuple)) {
        p_execute_finish();
        return true;
    }

    //
    // An insert is quite simple really. We just loop through our m_inputTable
    // and insert any tuple that we find into our targetTable. It doesn't get any easier than that!
    //
    TableIterator iterator = m_inputTable->iterator();
    while (iterator.next(inputTuple)) {
        p_execute_tuple(inputTuple);
    }

    p_execute_finish();
    return true;
}
开发者ID:akhanzode,项目名称:voltdb,代码行数:26,代码来源:insertexecutor.cpp

示例8: processTuplesDo

bool UnionSetOperator::processTuplesDo() {

    // Set to keep candidate tuples.
    TupleSet tuples;

    //
    // For each input table, grab their TableIterator and then append all of its tuples
    // to our ouput table. Only distinct tuples are retained.
    //
    for (size_t ctr = 0, cnt = m_input_tables.size(); ctr < cnt; ctr++) {
        Table* input_table = m_input_tables[ctr];
        assert(input_table);
        TableIterator iterator = input_table->iterator();
        TableTuple tuple(input_table->schema());
        while (iterator.next(tuple)) {
            if (m_is_all || needToInsert(tuple, tuples)) {
                // we got tuple to insert
                if (!m_output_table->insertTuple(tuple)) {
                    VOLT_ERROR("Failed to insert tuple from input table '%s' into"
                               " output table '%s'",
                               input_table->name().c_str(),
                               m_output_table->name().c_str());
                    return false;
                }
            }
        }
    }
    return true;
}
开发者ID:AlessandroEmm,项目名称:voltdb,代码行数:29,代码来源:unionexecutor.cpp

示例9: serializeTo

void Table::serializeTo(SerializeOutput &serialOutput) {
    // The table is serialized as:
    // [(int) total size]
    // [(int) header size] [num columns] [column types] [column names]
    // [(int) num tuples] [tuple data]

    /* NOTE:
       VoltDBEngine uses a binary template to create tables of single integers.
       It's called m_templateSingleLongTable and if you are seeing a serialization
       bug in tables of single integers, make sure that's correct.
    */

    // a placeholder for the total table size
    std::size_t pos = serialOutput.position();
    serialOutput.writeInt(-1);

    serializeColumnHeaderTo(serialOutput);

    // active tuple counts
    serialOutput.writeInt(static_cast<int32_t>(m_tupleCount));
    int64_t written_count = 0;
    TableIterator titer = iterator();
    TableTuple tuple(m_schema);
    while (titer.next(tuple)) {
        tuple.serializeTo(serialOutput);
        ++written_count;
    }
    assert(written_count == m_tupleCount);

    // length prefix is non-inclusive
    int32_t sz = static_cast<int32_t>(serialOutput.position() - pos - sizeof(int32_t));
    assert(sz > 0);
    serialOutput.writeIntAt(pos, sz);
}
开发者ID:simonzhangsm,项目名称:voltdb,代码行数:34,代码来源:table.cpp

示例10: p_execute

bool ProjectionExecutor::p_execute(const NValueArray &params) {
#ifndef NDEBUG
    ProjectionPlanNode* node = dynamic_cast<ProjectionPlanNode*>(m_abstractNode);
#endif
    assert (node);
    assert (!node->isInline()); // inline projection's execute() should not be
                                // called
    assert (m_outputTable == dynamic_cast<AbstractTempTable*>(node->getOutputTable()));
    assert (m_outputTable);
    Table* input_table = m_abstractNode->getInputTable();
    assert (input_table);

    VOLT_TRACE("INPUT TABLE: %s\n", input_table->debug().c_str());

    assert (m_columnCount == (int)node->getOutputColumnNames().size());
    if (m_allTupleArray == NULL && m_allParamArray == NULL) {
        for (int ctr = m_columnCount - 1; ctr >= 0; --ctr) {
            assert(expression_array[ctr]);
            VOLT_TRACE("predicate[%d]: %s", ctr,
                       expression_array[ctr]->debug(true).c_str());
        }
    }

    //
    // Now loop through all the tuples and push them through our output
    // expression This will generate new tuple values that we will insert into
    // our output table
    //
    TableIterator iterator = input_table->iteratorDeletingAsWeGo();
    assert (m_tuple.columnCount() == input_table->columnCount());
    while (iterator.next(m_tuple)) {
        //
        // Project (or replace) values from input tuple
        //
        TableTuple &temp_tuple = m_outputTable->tempTuple();
        if (m_allTupleArray != NULL) {
            VOLT_TRACE("sweet, all tuples");
            for (int ctr = m_columnCount - 1; ctr >= 0; --ctr) {
                temp_tuple.setNValue(ctr, m_tuple.getNValue(m_allTupleArray[ctr]));
            }
        } else if (m_allParamArray != NULL) {
            VOLT_TRACE("sweet, all params");
            for (int ctr = m_columnCount - 1; ctr >= 0; --ctr) {
                temp_tuple.setNValue(ctr, params[m_allParamArray[ctr]]);
            }
        } else {
            for (int ctr = m_columnCount - 1; ctr >= 0; --ctr) {
                temp_tuple.setNValue(ctr, expression_array[ctr]->eval(&m_tuple, NULL));
            }
        }
        m_outputTable->insertTempTuple(temp_tuple);

        VOLT_TRACE("OUTPUT TABLE: %s\n", m_outputTable->debug().c_str());
    }

    return true;
}
开发者ID:aamadeo27,项目名称:voltdb,代码行数:57,代码来源:projectionexecutor.cpp

示例11: TupleValueExpression

TEST_F(FilterTest, ComplexFilter) {

    // WHERE val1=1 AND val2=2 AND val3=3 AND val4=4

    // shared_ptr<AbstractExpression> equal1
    //     = ComparisonExpression::getInstance(EXPRESSION_TYPE_COMPARE_EQUAL, TupleValueExpression::getInstance(1), ConstantValueExpression::getInstance(voltdb::Value::newBigIntValue(1)));
    // shared_ptr<AbstractExpression> equal2
    //     = ComparisonExpression::getInstance(EXPRESSION_TYPE_COMPARE_EQUAL, TupleValueExpression::getInstance(2), ConstantValueExpression::getInstance(voltdb::Value::newBigIntValue(2)));
    // shared_ptr<AbstractExpression> equal3
    //     = ComparisonExpression::getInstance(EXPRESSION_TYPE_COMPARE_EQUAL, TupleValueExpression::getInstance(3), ConstantValueExpression::getInstance(voltdb::Value::newBigIntValue(3)));
    // shared_ptr<AbstractExpression> equal4
    //     = ComparisonExpression::getInstance(EXPRESSION_TYPE_COMPARE_EQUAL, TupleValueExpression::getInstance(4), ConstantValueExpression::getInstance(voltdb::Value::newBigIntValue(4)));
    //
    // shared_ptr<AbstractExpression> predicate3
    //     = ConjunctionExpression::getInstance(EXPRESSION_TYPE_CONJUNCTION_AND, equal3, equal4);
    // shared_ptr<AbstractExpression> predicate2
    //     = ConjunctionExpression::getInstance(EXPRESSION_TYPE_CONJUNCTION_AND, equal2, predicate3);
    //
    // ConjunctionExpression predicate(EXPRESSION_TYPE_CONJUNCTION_AND, equal1, predicate2);

    AbstractExpression *equal1 = comparisonFactory(EXPRESSION_TYPE_COMPARE_EQUAL,
                                                   new TupleValueExpression(1, std::string("tablename"), std::string("colname")),
                                                   constantValueFactory(ValueFactory::getBigIntValue(1)));

    AbstractExpression *equal2 = comparisonFactory(EXPRESSION_TYPE_COMPARE_EQUAL,
                                                   new TupleValueExpression(2, std::string("tablename"), std::string("colname")),
                                                   constantValueFactory(ValueFactory::getBigIntValue(2)));

    AbstractExpression *equal3 = comparisonFactory(EXPRESSION_TYPE_COMPARE_EQUAL,
                                                   new TupleValueExpression(3, std::string("tablename"), std::string("colname")),
                                                   constantValueFactory(ValueFactory::getBigIntValue(3)));

    AbstractExpression *equal4 = comparisonFactory(EXPRESSION_TYPE_COMPARE_EQUAL,
                                                   new TupleValueExpression(4, std::string("tablename"), std::string("colname")),
                                                   constantValueFactory(ValueFactory::getBigIntValue(4)));

    AbstractExpression *predicate3 = conjunctionFactory(EXPRESSION_TYPE_CONJUNCTION_AND, equal3, equal4);
    AbstractExpression *predicate2 = conjunctionFactory(EXPRESSION_TYPE_CONJUNCTION_AND, equal2, predicate3);
    AbstractExpression *predicate = conjunctionFactory(EXPRESSION_TYPE_CONJUNCTION_AND, equal1, predicate2);


    // ::printf("\nFilter:%s\n", predicate->debug().c_str());

    int count = 0;
    TableIterator iter = table->iterator();
    TableTuple match(table->schema());
    while (iter.next(match)) {
        if (predicate->eval(&match, NULL).isTrue()) {
            //::printf("  match:%s\n", match->debug(table).c_str());
            ++count;
        }
    }
    ASSERT_EQ(5, count);

    delete predicate;
}
开发者ID:Eonblast,项目名称:voltdb,代码行数:56,代码来源:filter_test.cpp

示例12: serialize_in

TEST_F(TableSerializeTest, NullStrings) {
    std::string *columnNames = new std::string[1];
    std::vector<voltdb::ValueType> columnTypes(1, voltdb::VALUE_TYPE_VARCHAR);
    std::vector<int32_t> columnSizes(1, 20);
    std::vector<bool> columnAllowNull(1, false);
    voltdb::TupleSchema *schema = voltdb::TupleSchema::createTupleSchema(columnTypes, columnSizes, columnAllowNull, true);
    columnNames[0] = "";
    table_->deleteAllTuples(true);
    delete table_;
    table_ = TableFactory::getTempTable(this->database_id, "temp_table", schema,
                                        columnNames, NULL);

    TableTuple& tuple = table_->tempTuple();
    tuple.setNValue(0, ValueFactory::getNullStringValue());
    table_->insertTuple(tuple);

    // Serialize the table
    CopySerializeOutput serialize_out;
    table_->serializeTo(serialize_out);

    // Deserialize the table: verify that it matches the existing table
    ReferenceSerializeInput serialize_in(serialize_out.data() + sizeof(int32_t), serialize_out.size() - sizeof(int32_t));
    TempTableLimits limits;
    schema = TupleSchema::createTupleSchema(table_->schema());
    Table* deserialized = TableFactory::getTempTable(this->database_id, "foo", schema,
                                                     columnNames, &limits);
    deserialized->loadTuplesFrom(serialize_in, NULL);

    EXPECT_EQ(1, deserialized->activeTupleCount());
    EXPECT_EQ(1, table_->activeTupleCount());
    EXPECT_EQ(1, deserialized->columnCount());
    EXPECT_EQ(1, table_->columnCount());
    EXPECT_EQ("", table_->columnName(0));
    EXPECT_EQ("", deserialized->columnName(0));
    EXPECT_EQ(VALUE_TYPE_VARCHAR, table_->schema()->columnType(0));
    EXPECT_EQ(VALUE_TYPE_VARCHAR, deserialized->schema()->columnType(0));
    EXPECT_EQ(true, table_->schema()->columnIsInlined(0));

    TableIterator iter = deserialized->iterator();
    TableTuple t(deserialized->schema());
    int count = 0;
    while (iter.next(t)) {
        EXPECT_EQ(VALUE_TYPE_VARCHAR, tuple.getType(0));
        EXPECT_EQ(VALUE_TYPE_VARCHAR, t.getType(0));
        EXPECT_TRUE(tuple.getNValue(0).isNull());
        EXPECT_TRUE(t.getNValue(0).isNull());
        EXPECT_TRUE(ValueFactory::getNullStringValue().op_equals(tuple.getNValue(0)).isTrue());
        EXPECT_TRUE(ValueFactory::getNullStringValue().op_equals(t.getNValue(0)).isTrue());
        count += 1;
    }
    EXPECT_EQ(1, count);
    delete deserialized;
    // clean up
    delete[] columnNames;
}
开发者ID:BibudhLahiriCC,项目名称:voltdb,代码行数:55,代码来源:serialize_test.cpp

示例13: countMatches

 static int countMatches(AbstractExpression* predicate) {
     int count = 0;
     TableIterator iter = m_table_static->iterator();
     TableTuple match(m_table_static->schema());
     while (iter.next(match)) {
         if (predicate->eval(&match, NULL).isTrue()) {
             //::printf("  match:%s\n", match->debug(table).c_str());
             ++count;
         }
     }
     return count;
 }
开发者ID:cgvarela,项目名称:voltdb,代码行数:12,代码来源:filter_test.cpp

示例14: collectTuples

void ExceptIntersectSetOperator::collectTuples(Table& input_table, TupleMap& tuple_map) {
    TableIterator iterator = input_table.iterator();
    TableTuple tuple(input_table.schema());
    while (iterator.next(tuple)) {
        TupleMap::iterator mapIt = tuple_map.find(tuple);
        if (mapIt == tuple_map.end()) {
            tuple_map.insert(std::make_pair(tuple, 1));
        } else if (m_is_all) {
            ++mapIt->second;
        }
    }
}
开发者ID:AlessandroEmm,项目名称:voltdb,代码行数:12,代码来源:unionexecutor.cpp

示例15: UniqueEngineBuilder

TEST_F(TableTupleTest, VolatileTempTuplePersistent) {
    UniqueEngine engine = UniqueEngineBuilder().build();

    // A schema with
    //    - one fixed-length column
    //    - one inlined variable-length column
    //    - one non-inlined variable-length column
    TupleSchema *schema = Tools::buildSchema(VALUE_TYPE_BIGINT,
                                             std::make_pair(VALUE_TYPE_VARCHAR, 12),
                                             std::make_pair(VALUE_TYPE_VARCHAR, 256));
    std::vector<std::string> columnNames{"id", "inlined", "noninlined"};
    char signature[20];
    std::unique_ptr<Table> table{TableFactory::getPersistentTable(0,
                                                                  "perstbl",
                                                                  schema,
                                                                  columnNames,
                                                                  signature)};
    TableTuple tuple = table->tempTuple();
    Tools::setTupleValues(&tuple, int64_t(0), "foo", "foo bar");

    ASSERT_TRUE(tuple.inlinedDataIsVolatile());
    ASSERT_FALSE(tuple.nonInlinedDataIsVolatile());

    NValue nv = tuple.getNValue(0);
    ASSERT_FALSE(nv.getVolatile());

    nv = tuple.getNValue(1);
    ASSERT_TRUE(nv.getVolatile());

    nv = tuple.getNValue(2);
    ASSERT_FALSE(nv.getVolatile());

    table->insertTuple(tuple);
    TableIterator it = table->iterator();
    TableTuple iterTuple{schema};
    while (it.next(iterTuple)) {
        // Regular, TupleBlock-backed tuples are never volatile.
        ASSERT_FALSE(iterTuple.inlinedDataIsVolatile());
        ASSERT_FALSE(iterTuple.nonInlinedDataIsVolatile());

        nv = iterTuple.getNValue(0);
        ASSERT_FALSE(nv.getVolatile());

        nv = iterTuple.getNValue(1);
        ASSERT_FALSE(nv.getVolatile());

        nv = iterTuple.getNValue(2);
        ASSERT_FALSE(nv.getVolatile());
    }
}
开发者ID:simonzhangsm,项目名称:voltdb,代码行数:50,代码来源:tabletuple_test.cpp


注:本文中的TableIterator::next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。