Moodle

\\moodledev\mod\quiz\report\reportlib.php where the tables have been hardcoded with a prefix of "mdl" - causing an error.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9.1
  • Fix Version/s: 1.9.2
  • Component/s: Quiz
  • Labels:
    None
  • Database:
    Oracle
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

The following error appeared in our logs last Friday.
[Fri May 23 07:05:30 2008] [error] SQL ORA-00942: table or view does not exist in /var/www/html/moodle/lib/dmllib.php on line 1078. STATEMENT: SELECT\n FLOOR(qg.grade*10/q.grade) AS band,\n COUNT(1) AS num\n FROM\n mdl_quiz_grades qg, \n mdl_quiz q\n WHERE qg.quiz = q.id AND qg.quiz = 4723 AND qg.userid IN (11223)\n GROUP BY band\n ORDER BY band with limits (, ), referer: http://usqstudydesk.usq.edu.au/mod/quiz/report.php?q=4723

Bug found in \mod\quiz\report\reportlib.php in the following function:
function quiz_report_grade_bands($bandwidth, $bands, $quizid, $useridlist){
$sql = "SELECT
FLOOR(qg.grade/$bandwidth) AS band,
COUNT(1) AS num
FROM
mdl_quiz_grades qg,
mdl_quiz q
WHERE qg.quiz = q.id AND qg.quiz = $quizid AND qg.userid IN ($useridlist)
GROUP BY band
ORDER BY band";

Activity

Hide
Andrew Yong added a comment -

SOLUTION: Change "mdl_" to "{$CFG->prefix}" as shown below:

function quiz_report_grade_bands($bandwidth, $bands, $quizid, $useridlist){
:
:
FROM
{$CFG->prefix}quiz_grades qg,
{$CFG->prefix}quiz q
WHERE qg.quiz = q.id AND qg.quiz = $quizid AND qg.userid IN ($useridlist)
GROUP BY band
ORDER BY band";

Show
Andrew Yong added a comment - SOLUTION: Change "mdl_" to "{$CFG->prefix}" as shown below: function quiz_report_grade_bands($bandwidth, $bands, $quizid, $useridlist){ : : FROM {$CFG->prefix}quiz_grades qg, {$CFG->prefix}quiz q WHERE qg.quiz = q.id AND qg.quiz = $quizid AND qg.userid IN ($useridlist) GROUP BY band ORDER BY band";
Hide
Tim Hunt added a comment -

Oops. This is such an easy mistake to make - I know from experience. I'll let Jamie sort it out, since it is his slip this time.

Show
Tim Hunt added a comment - Oops. This is such an easy mistake to make - I know from experience. I'll let Jamie sort it out, since it is his slip this time.
Hide
Jamie Pratt added a comment -

Fixed.

Show
Jamie Pratt added a comment - Fixed.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: