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

new $strictness parameter in $DB->get_record() DML method

    XMLWordPrintable

    Details

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

      Description

      there are very many palces in code like:
      if (!$record = $DB->ger_record('table', $conditions)) {
      print_error('geenralproblem');
      }

      it is usually 66% of wasted lines and one extra language string with information that does not help with real problem solution anyway

      I am proposing to add new method to moodle_database clas
      function get_existing_record($tablename, array $conditions, $errorstring='', $errorcode='', $module='');

      This method would work like get_record() but it would throw new exception.

      Eloy is strongly opposing this because there is nothing like this in standard SQL. Time to vote

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              skodak Petr Skoda
              Reporter:
              skodak Petr Skoda
              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:
                24/Nov/10