Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-7105

dmlreadexception in Questionnaire with Oracle

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.2
    • Fix Version/s: 3.3.3, 3.4.1
    • Component/s: Module: Questionnaire
    • Labels:
      None

      Description

      DB: Oracle

      **There is a dmlreadexception when the teacher clicks on "View All the responses" link.

      The exception is due to the use, in some queries,  of the reserved keyword uid (https://docs.moodle.org/dev/XMLDB_reserved_words) 

      I replaced uid with a uidd and now it seems to work.

      This is the patch that I applied:

       

      diff --git a/classes/question/base.php b/classes/question/base.php 
      index 42c8f43..b65a30c 100644 
      --- a/classes/question/base.php 
      +++ b/classes/question/base.php 
      @@ -985,7 +985,7 @@ abstract class base { 
      $userfields .= $userfields === '' ? '' : ', '; 
      $userfields .= 'u.'.$field; 
      } 
      - $userfields .= ', u.id as uid'; 
      + $userfields .= ', u.id as uidd'; 
      return $userfields; } } 
      \ No newline at end of file 
      diff --git a/classes/response/base.php b/classes/response/base.php 
      index aade68c..3c9d6a6 100644 
      --- a/classes/response/base.php 
      +++ b/classes/response/base.php @@ -123,7 +123,7 
      @@ abstract class base { 
      $userfields .= $userfields === '' ? '' : ', ';
      $userfields .= 'u.'.$field; 
      } 
      - $userfields .= ', u.id as uid'; 
      + $userfields .= ', u.id as uidd'; 
      return $userfields; 
      } 
      diff --git a/classes/response/text.php b/classes/response/text.php 
      index 5a4d6bc..f10434b 100644 
      --- a/classes/response/text.php 
      +++ b/classes/response/text.php 
      @@ -76,7 +76,7 @@ class text extends base { 
      'ORDER BY r.submitted DESC'; 
      } else { 
      $sql = 'SELECT t.id, t.response, r.submitted AS submitted, r.userid, u.username AS username, ' . 
      - 'u.id as uid, ' . 
      + 'u.id as uidd, ' . 
      'r.survey_id, r.id AS rid ' . 'FROM {'.$this->response_table().'} t, ' .
      '{questionnaire_response} r, ' . 
      diff --git a/questionnaire.class.php b/questionnaire.class.php 
      index 120c917..8605999 100644 
      --- a/questionnaire.class.php 
      +++ b/questionnaire.class.php 
      @@ -2643,7 +2643,7 @@ class questionnaire { 
      $allresponsessql .= $sql; } 
      - $allresponsessql .= " ORDER BY uid, id"; 
      + $allresponsessql .= " ORDER BY uidd, id"; 
      $allresponses = $DB->get_recordset_sql($allresponsessql, $allresponsesparams); return $allresponses; 
      }
      
      

       

        Attachments

          Activity

            People

            • Assignee:
              mchurch Mike Churchward
              Reporter:
              sara.cenni Sara Cenni
              Participants:
              Component watchers:
              Mike Churchward
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Nov/17