use wfLimitResult
authorDomas Mituzas <midom@users.mediawiki.org>
Fri, 11 Jun 2004 16:37:15 +0000 (16:37 +0000)
committerDomas Mituzas <midom@users.mediawiki.org>
Fri, 11 Jun 2004 16:37:15 +0000 (16:37 +0000)
includes/QueryPage.php
includes/SpecialAllpages.php
includes/SpecialUnusedimages.php

index 6ffd116..43804ce 100644 (file)
@@ -37,7 +37,7 @@ class QueryPage {
        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
index 67246e4..ccac741 100644 (file)
@@ -52,7 +52,7 @@ function indexShowToplevel()
        # 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 );
@@ -66,7 +66,7 @@ function indexShowToplevel()
        }
        
        $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;
index 09075f5..4bc8d7b 100644 (file)
@@ -8,7 +8,7 @@ function wfSpecialUnusedimages() {
 
        $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();