From ccd72b22e2dea418157511f129ea78ba6cf792d1 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sat, 11 Nov 2006 21:42:46 +0000 Subject: [PATCH] forgot for prev checkin re bug 6440. Database should return all rows about a given index, not just the first. --- includes/Database.php | 9 ++++++--- includes/DatabaseOracle.php | 3 +++ includes/DatabasePostgres.php | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/includes/Database.php b/includes/Database.php index 04a3731915..7dd734b7dc 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -1144,12 +1144,15 @@ class Database { return NULL; } + $result = array(); while ( $row = $this->fetchObject( $res ) ) { if ( $row->Key_name == $index ) { - return $row; + $result[] = $row; } } - return false; + $this->freeResult($res); + + return empty($result) ? false : $result; } /** @@ -1203,7 +1206,7 @@ class Database { if ( !$indexInfo ) { return NULL; } - return !$indexInfo->Non_unique; + return !$indexInfo[0]->Non_unique; } /** diff --git a/includes/DatabaseOracle.php b/includes/DatabaseOracle.php index aa1e329ed0..81635677e5 100644 --- a/includes/DatabaseOracle.php +++ b/includes/DatabaseOracle.php @@ -239,6 +239,9 @@ class DatabaseOracle extends Database { $this->freeResult($res); $row->Non_unique = !$row->uniqueness; return $row; + + // BUG: !!!! This code needs to be synced up with database.php + } function indexUnique ($table, $index, $fname = 'indexUnique') { diff --git a/includes/DatabasePostgres.php b/includes/DatabasePostgres.php index 5e531bc872..0ff74edfb9 100644 --- a/includes/DatabasePostgres.php +++ b/includes/DatabasePostgres.php @@ -460,6 +460,9 @@ class DatabasePostgres extends Database { while ( $row = $this->fetchObject( $res ) ) { if ( $row->indexname == $index ) { return $row; + + // BUG: !!!! This code needs to be synced up with database.php + } } return false; -- 2.20.1