[ 'ar_rev_id' => $revids ],
__METHOD__
),
- ], false );
+ ], $db::UNION_DISTINCT );
$res = $db->query( $sql, __METHOD__ );
foreach ( $res as $row ) {
if ( (int)$row->id === (int)$params['startid'] ) {
*/
const QUERY_PSEUDO_PERMANENT = 2;
+ /** @var bool Parameter to unionQueries() for UNION ALL */
+ const UNION_ALL = true;
+ /** @var bool Parameter to unionQueries() for UNION DISTINCT */
+ const UNION_DISTINCT = false;
+
/**
* A string describing the current software version, and possibly
* other details in a user-friendly way. Will be listed on Special:Version, etc.
* This is used for providing overload point for other DB abstractions
* not compatible with the MySQL syntax.
* @param array $sqls SQL statements to combine
- * @param bool $all Use UNION ALL
+ * @param bool $all Either IDatabase::UNION_ALL or IDatabase::UNION_DISTINCT
* @return string SQL fragment
*/
public function unionQueries( $sqls, $all );
$sql = $subsql[0];
} else {
// need to resort and relimit after union
- $sql = $dbr->unionQueries( $subsql, false ) . ' ORDER BY rc_timestamp DESC';
+ $sql = $dbr->unionQueries( $subsql, $dbr::UNION_DISTINCT ) .
+ ' ORDER BY rc_timestamp DESC';
$sql = $dbr->limitResult( $sql, $limit, false );
}