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

Change get_field_sql()

    XMLWordPrintable

    Details

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

      Description

      get_field_sql() has been changed and now it executes

      $rs = get_recordset_sql($sql, 0, 1);

      to fetch exclusively the first record.

      But this has broken compatibility with some old uses where the "LIMIT" clause was being used to enforce only 1 record to be retrieved. To solve this:

      1) The function will strip any "LIMIT 1" clause present when invoked (dropping some debug info if found)
      2) All the incorrect uses of the function in core will be fixed.

      With this, get_fieldXXX() "family" of functions will be cross-db and consistent (always returning 1 value)

        Attachments

          Activity

            People

            Assignee:
            stronk7 Eloy Lafuente (stronk7)
            Reporter:
            stronk7 Eloy Lafuente (stronk7)
            Tester:
            Nobody
            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