예제 #1
0
ItemPointer DataTable::InsertVersion(const storage::Tuple *tuple) {
  // First, do integrity checks and claim a slot
  ItemPointer location = GetEmptyTupleSlot(tuple, true);
  if (location.block == INVALID_OID) {
    LOG_TRACE("Failed to get tuple slot.");
    return INVALID_ITEMPOINTER;
  }

  // Index checks and updates
  if (InsertInSecondaryIndexes(tuple, location) == false) {
    LOG_TRACE("Index constraint violated");
    return INVALID_ITEMPOINTER;
  }

  // ForeignKey checks
  if (CheckForeignKeyConstraints(tuple) == false) {
    LOG_TRACE("ForeignKey constraint violated");
    return INVALID_ITEMPOINTER;
  }

  LOG_TRACE("Location: %u, %u", location.block, location.offset);

  IncreaseNumberOfTuplesBy(1);
  return location;
}
예제 #2
0
bool DataTable::InstallVersion(const AbstractTuple *tuple,
                               const TargetList *targets_ptr,
                               ItemPointer *index_entry_ptr) {

  // Index checks and updates
  if (InsertInSecondaryIndexes(tuple, targets_ptr, index_entry_ptr) == false) {
    LOG_TRACE("Index constraint violated");
    return false;
  }
  return true;
}