@@ -349,7 +349,7 @@ ItemPointer DataTable::InsertTuple(const storage::Tuple *tuple,
349
349
350
350
bool DataTable::InsertTuple (const AbstractTuple *tuple,
351
351
ItemPointer location, concurrency::TransactionContext *transaction,
352
- ItemPointer **index_entry_ptr, UNUSED_ATTRIBUTE bool check_fk) {
352
+ ItemPointer **index_entry_ptr, bool check_fk) {
353
353
if (CheckConstraints (tuple) == false ) {
354
354
LOG_TRACE (" InsertTuple(): Constraint violated" );
355
355
return false ;
@@ -590,7 +590,7 @@ bool DataTable::CheckForeignKeySrcAndCascade(storage::Tuple *prev_tuple,
590
590
storage::Tuple *new_tuple,
591
591
concurrency::TransactionContext *current_txn,
592
592
executor::ExecutorContext *context,
593
- bool is_update UNUSED_ATTRIBUTE )
593
+ bool is_update)
594
594
{
595
595
size_t fk_count = GetForeignKeySrcCount ();
596
596
@@ -738,6 +738,8 @@ bool DataTable::CheckForeignKeySrcAndCascade(storage::Tuple *prev_tuple,
738
738
return true ;
739
739
}
740
740
741
+ // PA - looks like the FIXME has been done. We check to see if the key
742
+ // is visible
741
743
/* *
742
744
* @brief Check if all the foreign key constraints on this table
743
745
* is satisfied by checking whether the key exist in the referred table
@@ -752,8 +754,8 @@ bool DataTable::CheckForeignKeySrcAndCascade(storage::Tuple *prev_tuple,
752
754
* @returns True on success, false if any foreign key constraints fail
753
755
*/
754
756
bool DataTable::CheckForeignKeyConstraints (
755
- const AbstractTuple *tuple UNUSED_ATTRIBUTE ,
756
- concurrency::TransactionContext *transaction UNUSED_ATTRIBUTE ) {
757
+ const AbstractTuple *tuple,
758
+ concurrency::TransactionContext *transaction) {
757
759
for (auto foreign_key : foreign_keys_) {
758
760
oid_t sink_table_id = foreign_key->GetSinkTableOid ();
759
761
storage::DataTable *ref_table = nullptr ;
@@ -773,7 +775,6 @@ bool DataTable::CheckForeignKeyConstraints(
773
775
774
776
// The foreign key constraints only refer to the primary key
775
777
if (index->GetIndexType () == IndexConstraintType::PRIMARY_KEY) {
776
-
777
778
std::vector<oid_t > key_attrs = foreign_key->GetSinkColumnIds ();
778
779
std::unique_ptr<catalog::Schema> foreign_key_schema (
779
780
catalog::Schema::CopySchema (ref_table->schema , key_attrs));
@@ -782,11 +783,10 @@ bool DataTable::CheckForeignKeyConstraints(
782
783
key->SetFromTuple (tuple, foreign_key->GetSourceColumnIds (), index->GetPool ());
783
784
784
785
LOG_TRACE (" check key: %s" , key->GetInfo ().c_str ());
785
-
786
786
std::vector<ItemPointer *> location_ptrs;
787
787
index->ScanKey (key.get (), location_ptrs);
788
788
789
- // if this key doesn't exist in the refered column
789
+ // if this key doesn't exist in the referred column
790
790
if (location_ptrs.size () == 0 ) {
791
791
LOG_DEBUG (" The key: %s does not exist in table %s\n " ,
792
792
key->GetInfo ().c_str (),
@@ -821,6 +821,8 @@ bool DataTable::CheckForeignKeyConstraints(
821
821
return true ;
822
822
}
823
823
824
+
825
+
824
826
// ===--------------------------------------------------------------------===//
825
827
// STATS
826
828
// ===--------------------------------------------------------------------===//
0 commit comments