From 5a0bbe0a1a54d53eb3a3efc0d095084564e8532a Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sat, 7 Jul 2007 21:51:06 +0000 Subject: [PATCH] bug 10496 DISTINCT option logic incorrect in Database::makeSelectOptions --- includes/Database.php | 2 +- includes/DatabaseOracle.php | 2 +- includes/DatabasePostgres.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/Database.php b/includes/Database.php index f56b7a3947..293ed055b1 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -1132,7 +1132,7 @@ class Database { if ( isset( $noKeyOptions['FOR UPDATE'] ) ) $postLimitTail .= ' FOR UPDATE'; if ( isset( $noKeyOptions['LOCK IN SHARE MODE'] ) ) $postLimitTail .= ' LOCK IN SHARE MODE'; - if ( isset( $noKeyOptions['DISTINCT'] ) && isset( $noKeyOptions['DISTINCTROW'] ) ) $startOpts .= 'DISTINCT'; + if ( isset( $noKeyOptions['DISTINCT'] ) || isset( $noKeyOptions['DISTINCTROW'] ) ) $startOpts .= 'DISTINCT'; # Various MySQL extensions if ( isset( $noKeyOptions['STRAIGHT_JOIN'] ) ) $startOpts .= ' /*! STRAIGHT_JOIN */'; diff --git a/includes/DatabaseOracle.php b/includes/DatabaseOracle.php index 929ac44079..27e85297a0 100644 --- a/includes/DatabaseOracle.php +++ b/includes/DatabaseOracle.php @@ -659,7 +659,7 @@ echo "error!\n"; #if ( isset( $noKeyOptions['FOR UPDATE'] ) ) $tailOpts .= ' FOR UPDATE'; #if ( isset( $noKeyOptions['LOCK IN SHARE MODE'] ) ) $tailOpts .= ' LOCK IN SHARE MODE'; - if ( isset( $noKeyOptions['DISTINCT'] ) && isset( $noKeyOptions['DISTINCTROW'] ) ) $startOpts .= 'DISTINCT'; + if ( isset( $noKeyOptions['DISTINCT'] ) || isset( $noKeyOptions['DISTINCTROW'] ) ) $startOpts .= 'DISTINCT'; if ( isset( $options['USE INDEX'] ) && ! is_array( $options['USE INDEX'] ) ) { $useIndex = $this->useIndexClause( $options['USE INDEX'] ); diff --git a/includes/DatabasePostgres.php b/includes/DatabasePostgres.php index b04af1d445..7c2a2aade0 100644 --- a/includes/DatabasePostgres.php +++ b/includes/DatabasePostgres.php @@ -1195,7 +1195,7 @@ END; if ( isset( $noKeyOptions['FOR UPDATE'] ) ) $postLimitTail .= ' FOR UPDATE'; if ( isset( $noKeyOptions['LOCK IN SHARE MODE'] ) ) $postLimitTail .= ' LOCK IN SHARE MODE'; - if ( isset( $noKeyOptions['DISTINCT'] ) && isset( $noKeyOptions['DISTINCTROW'] ) ) $startOpts .= 'DISTINCT'; + if ( isset( $noKeyOptions['DISTINCT'] ) || isset( $noKeyOptions['DISTINCTROW'] ) ) $startOpts .= 'DISTINCT'; return array( $startOpts, $useIndex, $preLimitTail, $postLimitTail ); } -- 2.20.1