Replaced a few hardcoded LIMIT clauses with database function.
Wrapped UNION statement in SpecialRecentchangeslinked for Oracle compatibility.
GROUP BY rev_user, rev_user_text, user_real_name
ORDER BY timestamp DESC";
- if($limit > 0) { $sql .= ' LIMIT '.$limit; }
- if($offset > 0) { $sql .= ' OFFSET '.$offset; }
+ if($limit > 0)
+ $sql = $dbr->limitResult($sql, $limit, $offset);
$sql .= ' '. $this->getSelectOptions();
if ($hidebotsql) {
$sql .= "$hidebotsql WHERE ug_group IS NULL";
}
- $sql .= ' ORDER BY img_timestamp DESC LIMIT 1';
+ $sql .= ' ORDER BY img_timestamp DESC';
+ $sql = $dbr->limitResult($sql, 1, false);
$res = $dbr->query( $sql, __FUNCTION__ );
$row = $dbr->fetchRow( $res );
if( $row !== false ) {
$sql .= ' WHERE ' . $dbr->makeList( $where, LIST_AND );
}
$sql.=' ORDER BY img_timestamp '. ( $invertSort ? '' : ' DESC' );
- $sql.=' LIMIT ' . ( $limit + 1 );
+ $sql = $dbr->limitResult($sql, ( $limit + 1 ), false);
$res = $dbr->query( $sql, __FUNCTION__ );
/**
$sql = $subsql[0];
else {
// need to resort and relimit after union
- $sql = "(" . implode( ") UNION (", $subsql ) . ") ORDER BY rc_timestamp DESC LIMIT {$limit}";
+ // unwrapped UNION block will not work in Oracle. Wrapper aded.
+ $sql = "SELECT * FROM ((" . implode( ") UNION (", $subsql ) . ")) ORDER BY rc_timestamp DESC";
+ $sql = $dbr->limitResult($sql, $limit, false);
}
$res = $dbr->query( $sql, __METHOD__ );