From: Yuri Astrakhan Date: Sat, 11 Nov 2006 21:42:46 +0000 (+0000) Subject: forgot for prev checkin re bug 6440. Database should return all rows about a given... X-Git-Tag: 1.31.0-rc.0~55221 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=ccd72b22e2dea418157511f129ea78ba6cf792d1;p=lhc%2Fweb%2Fwiklou.git forgot for prev checkin re bug 6440. Database should return all rows about a given index, not just the first. --- 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;