From: Greg Sabino Mullane Date: Sun, 23 Jul 2006 01:13:56 +0000 (+0000) Subject: Use NULL instead of 0 to indicate "no page" for cases where rc_cur_id is a FK. X-Git-Tag: 1.31.0-rc.0~56157 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=a9d232c10b7992d05d8356bf9d953694c17a83a4;p=lhc%2Fweb%2Fwiklou.git Use NULL instead of 0 to indicate "no page" for cases where rc_cur_id is a FK. --- 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 );