From a9d232c10b7992d05d8356bf9d953694c17a83a4 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Sun, 23 Jul 2006 01:13:56 +0000 Subject: [PATCH] Use NULL instead of 0 to indicate "no page" for cases where rc_cur_id is a FK. --- includes/RecentChange.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/RecentChange.php b/includes/RecentChange.php index a1352ce145..4361ca3cce 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -113,6 +113,11 @@ class RecentChange $this->mAttribs['rc_cur_time'] = $dbw->timestamp($this->mAttribs['rc_cur_time']); $this->mAttribs['rc_id'] = $dbw->nextSequenceValue( 'rc_rc_id_seq' ); + ## If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL + if ( $dbw->cascadingDeletes() and $this->mAttribs['rc_cur_id']==0 ) { + unset ( $this->mAttribs['rc_cur_id'] ); + } + # Insert new row $dbw->insert( 'recentchanges', $this->mAttribs, $fname ); -- 2.20.1