Пример #1
0
bool Table::equals(const voltdb::Table *other) const {
    if (!(columnCount() == other->columnCount())) return false;
    if (!(indexCount() == other->indexCount())) return false;
    if (!(activeTupleCount() == other->activeTupleCount())) return false;
    if (!(databaseId() == other->databaseId())) return false;
    if (!(tableId() == other->tableId())) return false;
    if (!(name() == other->name())) return false;
    if (!(tableType() == other->tableType())) return false;

    std::vector<voltdb::TableIndex*> indexes = allIndexes();
    std::vector<voltdb::TableIndex*> otherIndexes = other->allIndexes();
    if (!(indexes.size() == indexes.size())) return false;
    for (std::size_t ii = 0; ii < indexes.size(); ii++) {
        if (!(indexes[ii]->equals(otherIndexes[ii]))) return false;
    }

    const voltdb::TupleSchema *otherSchema = other->schema();
    if ((!m_schema->equals(otherSchema))) return false;

    voltdb::TableIterator firstTI(this);
    voltdb::TableIterator secondTI(other);
    voltdb::TableTuple firstTuple(m_schema);
    voltdb::TableTuple secondTuple(otherSchema);
    while(firstTI.next(firstTuple)) {
        if (!(secondTI.next(secondTuple))) return false;
        if (!(firstTuple.equals(secondTuple))) return false;
    }
    return true;
}
Пример #2
0
bool Table::equals(voltdb::Table *other) {
    if (!(columnCount() == other->columnCount())) return false;
    if (!(activeTupleCount() == other->activeTupleCount())) return false;
    if (!(databaseId() == other->databaseId())) return false;
    if (!(name() == other->name())) return false;
    if (!(tableType() == other->tableType())) return false;

    const voltdb::TupleSchema *otherSchema = other->schema();
    if ((!m_schema->equals(otherSchema))) return false;

    voltdb::TableIterator firstTI = iterator();
    voltdb::TableIterator secondTI = other->iterator();
    voltdb::TableTuple firstTuple(m_schema);
    voltdb::TableTuple secondTuple(otherSchema);
    while(firstTI.next(firstTuple)) {
        if (!(secondTI.next(secondTuple))) return false;
        if (!(firstTuple.equals(secondTuple))) return false;
    }
    return true;
}