Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-14679 META: DB layer 2.0
  3. MDL-14967

M2-M3-M4 Upgrade all code using DML

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: Critical Critical
    • 2.0
    • 2.0
    • Database SQL/XMLDB
    • None
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE

      Since the new DML 2.0 API is now in place, all code using the old dmllib needs to be upgraded. In essence, this means the following changes:

      1. Wherever old functions are used (get_record*, get_field*, set_field, insert_record, update_record), the global $DB must be used as the object on which these functions are called (e.g. get_record_select becomes $DB->get_record_select).
      2. All the functions that used to accept a list of string params in the form "param1, value1, param2, value2" now need to be given an array of key=>value pairs as a replacement for these params. Other params remain as before. Check the new API for any exceptions.
      3. rs_fetch_next_record($rs) is deprecated, in favour of the simple foreach($rs as $var). Calls to rs_close() must be replaced by $rs->close();

      As an example to #3, if you have the original code:

      while($result = rs_fetch_next_record($rs))

      { ... }

      rs_close();

      you would replace it with

      foreach ($rs as $result)

      { .... }

      $rs->close();

            skodak Petr Skoda
            nicolasconnault Nicolas Connault (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.