Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-7168

Kill all uses of LIMIT clauses

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7
    • Fix Version/s: 1.7
    • Component/s: Database SQL/XMLDB
    • Labels:
      None
    • Database:
      Any
    • Affected Branches:
      MOODLE_17_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE

      Description

      SQL LIMIT clauses aren't cross-db so they must be replaced by function calls using the new limitfrom and limitnum parameters. Current uses are:

      admin/report/courseoverview/reportsgraph.php: $sql = $param->sql ." LIMIT ".$numcourses;
      admin/report/courseoverview/reportsgraph.php: ." LIMIT ".$numcourses;

      blocks/blog_tags/block_blog_tags.php: $sql .= "LIMIT {$this->config->numberoftags} ";

      blocks/search_glossaries/search_glossaries.php: $sqllimit = " LIMIT $entriesbypage OFFSET $offset";
      blocks/search_glossaries/search_glossaries.php: $sqllimit = " LIMIT $offset, $entriesbypage";

      blog/lib.php: //echo 'Debug: BlogFilter fetch_entries() sql="'. $SQL . $orderby . $limit .'"<br />'. $this->categoryid; //debug

      lib/datalib.php: $limit = sql_paging_limit($limitfrom, $limitnum);
      lib/datalib.php: $limit = "";

      lib/dmllib.php: return 'LIMIT '. $recordsperpage .' OFFSET '. $page;
      lib/dmllib.php: return 'LIMIT '. $page .','. $recordsperpage;

      mod/chat/lib.php: ORDER BY timestamp DESC LIMIT 1")) {

      mod/data/rsslib.php: "LIMIT {$data->rssarticles}";

      mod/glossary/sql.php: $sqllimit = " LIMIT $entriesbypage OFFSET $offset";
      mod/glossary/sql.php: $sqllimit = " LIMIT $offset, $entriesbypage";

      mod/quiz/report/analysis/report.php: $scorelimit = $quiz->sumgrades * $lowmarklimit/ 100;
      mod/quiz/report/analysis/report.php: $limit = '';
      mod/quiz/report/analysis/report.php: $limit = ', max(qa.sumgrades) ';
      mod/quiz/report/analysis/report.php: $limit = ', min(qa.timemodified) ';
      mod/quiz/report/analysis/report.php: $limit = ', max(qa.timemodified) ';

      mod/wiki/ewiki/ewiki.php: . " WHERE (pagename=$id) $version ORDER BY version DESC LIMIT 1"
      mod/wiki/ewikimoodlelib.php: # . " WHERE (pagename=$id) $version ORDER BY version DESC LIMIT 1"

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stronk7 Eloy Lafuente (stronk7)
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Tester:
              Ken Wilson
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                7/Nov/06