Small bug with Oracle

Small bug with Oracle

by María José Blanes -
Number of replies: 1

Hi,

I'm testing Moodle 2.6 with Oracle database.

I've installed the plug-in without problems.

After that, when I try to create a Questionnaire activity, I get this error:

Debug info: ORA-00933: SQL command not properly ended
SELECT s.id,s.name,s.owner,s.realm,s.status,q.id as qid,q.name as qname FROM m_questionnaire q INNER JOIN m_questionnaire_survey s ON s.id = q.sid WHERE owner = :o_param1 and realm = :o_param2ORDER BY realm,name
[array (
'o_param1' => '2',
'o_param2' => 'private',
)]
Error code: dmlreadexception

Stack trace:

  • line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown
  • line 271 of /lib/dml/oci_native_moodle_database.php: call to moodle_database->query_end()
  • line 1122 of /lib/dml/oci_native_moodle_database.php: call to oci_native_moodle_database->query_end()
  • line 495 of /mod/questionnaire/locallib.php: call to oci_native_moodle_database->get_records_sql()
  • line 503 of /mod/questionnaire/locallib.php: call to questionnaire_get_survey_list()
  • line 108 of /mod/questionnaire/mod_form.php: call to questionnaire_get_survey_select()
  • line 191 of /lib/formslib.php: call to mod_questionnaire_mod_form->definition()
  • line 86 of /course/moodleform_mod.php: call to moodleform->moodleform()
  • line 256 of /course/modedit.php: call to moodleform_mod->moodleform_mod()


I think the problem is "realm = :o_param2ORDER BY". It's necessary a whitespace between parm2 and ORDER BY.

I've modified the mod\questionnaire\locallib.php file, adding the blank mentioned.

In the function "questionnaire_get_survey_list", at the end (line 491)...


} else if ($type == 'private') {
            $sql = "SELECT s.id,s.name,s.owner,s.realm,s.status,q.id as qid,q.name as qname " .
                "FROM {questionnaire} q " .
                "INNER JOIN {questionnaire_survey} s ON s.id = q.sid " .
               "WHERE owner = ? and realm = ?" .
               " ORDER BY realm,name ";    //added a blank before ORDER BY
            $params = array($courseid, $type);
        }


Regards,

Maria

Average of ratings: -
In reply to María José Blanes

Re: Small bug with Oracle

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Thanks for reporting this bug, Maria. The bug is not showing in mySql nor in PostgreSQL, which are more "tolerant" of such errors, I guess!

Reported as CONTRIB-5050, fixed and committed to the github.

Joseph