* (bug 21116) MediaWiki:Templatesused, MediaWiki:Templatesusedpreview and
MediaWiki:Templatesusedsection now support plural
* (bug 21079) There is no more line wrapping between label and field in Special:Log
+* (bug 20256) Fixed SQL errors on Special:Recentchanges and Special:Recentchangeslinked
+ on SQLite backend
== API changes in 1.16 ==
return $this->limitResult( $sql, $num, 0 );
}
+ /**
+ * Returns true if current database backend supports ORDER BY or LIMIT for separate subqueries
+ * within the UNION construct.
+ * @return Boolean
+ */
+ function unionSupportsOrderAndLimit() {
+ return true; // True for almost every DB supported
+ }
+
/**
* Construct a UNION query
* This is used for providing overload point for other DB abstractions
return - 1;
}
+ function unionSupportsOrderAndLimit() {
+ return false;
+ }
+
+ function unionQueries( $sqls, $all ) {
+ $glue = $all ? ' UNION ALL ' : ' UNION ';
+ return implode( $glue, $sqls );
+ }
+
function wasDeadlock() {
return $this->lastErrno() == SQLITE_BUSY;
}
// Is there either one namespace selected or excluded?
// Tag filtering also has a better index.
// Also, if this is "all" or main namespace, just use timestamp index.
- if( is_null($namespace) || $invert || $opts['tagfilter'] ) {
+ if( is_null($namespace)
+ || $invert
+ || $opts['tagfilter']
+ || !$dbr->unionSupportsOrderAndLimit() )
+ {
$res = $dbr->select( $tables, '*', $conds, __METHOD__,
array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) +
$query_options,
}
}
- $subsql[] = $dbr->selectSQLText(
+ if( $dbr->unionSupportsOrderAndLimit())
+ $order = array( 'ORDER BY' => 'rc_timestamp DESC' );
+ else
+ $order = array();
+
+
+ $query = $dbr->selectSQLText(
array_merge( $tables, array( $link_table ) ),
$select,
$conds + $subconds,
__METHOD__,
- array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) + $query_options,
+ $order + $query_options,
$join_conds + array( $link_table => array( 'INNER JOIN', $subjoin ) )
);
+
+ if( $dbr->unionSupportsOrderAndLimit())
+ $query = $dbr->limitResult( $query, $limit );
+
+ $subsql[] = $query;
}
if( count($subsql) == 0 )
return false; // should never happen
- if( count($subsql) == 1 )
+ if( count($subsql) == 1 && $dbr->unionSupportsOrderAndLimit() )
$sql = $subsql[0];
else {
// need to resort and relimit after union