Change-Id: I0d39242d1c4bd8c2236f0b0cd21eb3f604b7d2bd
[ 'ar_rev_id' => $revids ],
__METHOD__
),
[ 'ar_rev_id' => $revids ],
__METHOD__
),
+ ], $db::UNION_DISTINCT );
$res = $db->query( $sql, __METHOD__ );
foreach ( $res as $row ) {
if ( (int)$row->id === (int)$params['startid'] ) {
$res = $db->query( $sql, __METHOD__ );
foreach ( $res as $row ) {
if ( (int)$row->id === (int)$params['startid'] ) {
*/
const QUERY_PSEUDO_PERMANENT = 2;
*/
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.
/**
* 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
* 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 );
* @return string SQL fragment
*/
public function unionQueries( $sqls, $all );
$sql = $subsql[0];
} else {
// need to resort and relimit after union
$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 );
}
$sql = $dbr->limitResult( $sql, $limit, false );
}
$oiWheres ? $dbr->makeList( $oiWheres, LIST_OR ) : '1=0'
)
],
$oiWheres ? $dbr->makeList( $oiWheres, LIST_OR ) : '1=0'
)
],
- true // UNION ALL (performance)