本文整理汇总了C++中TableTuple::getSchema方法的典型用法代码示例。如果您正苦于以下问题:C++ TableTuple::getSchema方法的具体用法?C++ TableTuple::getSchema怎么用?C++ TableTuple::getSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableTuple
的用法示例。
在下文中一共展示了TableTuple::getSchema方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replaceEntryNoKeyChange
bool TableIndex::replaceEntryNoKeyChange(const TableTuple &destinationTuple, const TableTuple &originalTuple)
{
assert(originalTuple.address() != destinationTuple.address());
if (isPartialIndex()) {
const AbstractExpression* predicate = getPredicate();
if (!predicate->eval(&destinationTuple, NULL).isTrue() && !predicate->eval(&originalTuple, NULL).isTrue()) {
// both tuples fail the predicate. Nothing to do. Return TRUE
return true;
} else if (predicate->eval(&destinationTuple, NULL).isTrue() && !predicate->eval(&originalTuple, NULL).isTrue()) {
// The original tuple fails the predicate meaning the tuple is not indexed.
// Simply add the new tuple
TableTuple conflict(destinationTuple.getSchema());
addEntryDo(&destinationTuple, &conflict);
return conflict.isNullTuple();
} else if (!predicate->eval(&destinationTuple, NULL).isTrue() && predicate->eval(&originalTuple, NULL).isTrue()) {
// The destination tuple fails the predicate. Simply delete the original tuple
return deleteEntryDo(&originalTuple);
} else {
// both tuples pass the predicate.
assert(predicate->eval(&destinationTuple, NULL).isTrue() && predicate->eval(&originalTuple, NULL).isTrue());
return replaceEntryNoKeyChangeDo(destinationTuple, originalTuple);
}
} else {
return replaceEntryNoKeyChangeDo(destinationTuple, originalTuple);
}
}
示例2: compare_tuple
NValue compare_tuple(const TableTuple& tuple1, const TableTuple& tuple2)
{
assert(tuple1.getSchema()->columnCount() == tuple2.getSchema()->columnCount());
NValue fallback_result = OP::includes_equality() ? NValue::getTrue() : NValue::getFalse();
int schemaSize = tuple1.getSchema()->columnCount();
for (int columnIdx = 0; columnIdx < schemaSize; ++columnIdx) {
NValue value1 = tuple1.getNValue(columnIdx);
if (value1.isNull()) {
fallback_result = NValue::getNullValue(VALUE_TYPE_BOOLEAN);
if (OP::implies_null_for_row()) {
return fallback_result;
}
continue;
}
NValue value2 = tuple2.getNValue(columnIdx);
if (value2.isNull()) {
fallback_result = NValue::getNullValue(VALUE_TYPE_BOOLEAN);
if (OP::implies_null_for_row()) {
return fallback_result;
}
continue;
}
if (OP::compare_withoutNull(value1, tuple2.getNValue(columnIdx)).isTrue()) {
if (OP::implies_true_for_row(value1, value2)) {
// allow early return on strict inequality
return NValue::getTrue();
}
}
else {
if (OP::implies_false_for_row(value1, value2)) {
// allow early return on strict inequality
return NValue::getFalse();
}
}
}
// The only cases that have not already short-circuited involve all equal columns.
// Each op either includes or excludes that particular case.
return fallback_result;
}
示例3: compare
NValue compare(const TableTuple& tuple) const
{
assert(tuple.getSchema()->columnCount() == 1);
return compare<OP>(tuple.getNValue(0));
}