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

eliminate $rs->RecordCount()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 2.0
    • Component/s: Database SQL/XMLDB
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      For some unknown reason we were using:

      if ($rs = get_recordset('blog_tag_instance')) {
      $db->debug = false;
      if ($rs->RecordCount() > 0) {
      while ($blogtag = rs_fetch_next_record($rs)) {

      Eloy says it is wrong because it might fetch all records into memory and is not needed at all because if count == 0 the loop is just skipped without any notices...

      going to fix all places and verify rs_close() at the same time.

      discussion it a bit more with Eloy we should:
      1/ remove all RecordCount() - replace with SQL ounting, rs_EOF() or just drop it
      2/ add rs_EOF($rs)
      3/ add experimental setting to disable record counting in adodb $ADODB_COUNTRECS=false
      4/ find out which databases get performance boost from this change
      5/ fix rs_close()

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            skodak Petr Skoda
            Tester:
            Nobody Nobody
            Participants:
            Component watchers:
            Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              24/Nov/10