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()

        Gliffy Diagrams

          Activity

          Hide
          skodak Petr Skoda added a comment -

          assigning back to our db master, there are still some 3 instances of RecordCount in lib/dmllib.php
          the rest should be gone

          Show
          skodak Petr Skoda added a comment - assigning back to our db master, there are still some 3 instances of RecordCount in lib/dmllib.php the rest should be gone
          Hide
          infosemantics Rod Ward added a comment -

          Guys,

          Is it possible this issue is the cause of some errors I'm getting at present with 1.9 on an MS SQL install? There may be a couple of other locations where this code appears.

          When I first open Moodle I get an error something like this:
          Fatal error: Call to a member function RecordCount() on a non-object in C:\Inetpub\wwwroot\moodle\lib\accesslib.php on line 3508

          Then when I log in I get this error:
          Fatal error: Call to a member function RecordCount() on a non-object in C:\Inetpub\wwwroot\moodle\lib\datalib.php on line 965

          I'm using a version of 1.9 downloaded 21/10/2007

          Rod Ward

          Show
          infosemantics Rod Ward added a comment - Guys, Is it possible this issue is the cause of some errors I'm getting at present with 1.9 on an MS SQL install? There may be a couple of other locations where this code appears. When I first open Moodle I get an error something like this: Fatal error: Call to a member function RecordCount() on a non-object in C:\Inetpub\wwwroot\moodle\lib\accesslib.php on line 3508 Then when I log in I get this error: Fatal error: Call to a member function RecordCount() on a non-object in C:\Inetpub\wwwroot\moodle\lib\datalib.php on line 965 I'm using a version of 1.9 downloaded 21/10/2007 Rod Ward
          Hide
          skodak Petr Skoda added a comment -

          No longer issue in 2.0 any more, thanks Eloy!

          Show
          skodak Petr Skoda added a comment - No longer issue in 2.0 any more, thanks Eloy!

            People

            • Assignee:
              skodak Petr Skoda
              Reporter:
              skodak Petr Skoda
              Tester:
              Nobody
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

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