function getOrderLimit( $offset, $limit ) {
return " ORDER BY value " .
($this->sortDescending() ? "DESC" : "")
- . " LIMIT {$offset}, {$limit}";
+ . wfLimitResult($limit,$offset);
}
# Is this query expensive (for some definition of expensive)? Then we
# There's got to be a cleaner way to do this!
for( $i = 1; $i < $sections; $i++ ) {
$from = $i * $indexMaxperpage;
- $sql = "SELECT cur_title $fromwhere $order LIMIT $from,2";
+ $sql = "SELECT cur_title $fromwhere $order ".wfLimitResult(2,$from);
$res = wfQuery( $sql, DB_READ, $fname );
$s = wfFetchObject( $res );
}
$from = $i * $indexMaxperpage;
- $sql = "SELECT cur_title $fromwhere $order LIMIT " . ($count-1) . ",1";
+ $sql = "SELECT cur_title $fromwhere $order ".wfLimitResult(1,$count-1);
$res = wfQuery( $sql, DB_READ, $fname );
$s = wfFetchObject( $res );
$outpoint = $s->cur_title;
$sql = "SELECT img_name,img_user,img_user_text,img_timestamp,img_description " .
"FROM image LEFT JOIN imagelinks ON img_name=il_to WHERE il_to IS NULL " .
- "ORDER BY img_timestamp LIMIT {$offset}, {$limit}";
+ "ORDER BY img_timestamp ".wfLimitResult($limit,$offset);
$res = wfQuery( $sql, DB_READ, $fname );
$sk = $wgUser->getSkin();