-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
2.3.2
-
None
-
MOODLE_23_STABLE
A Moodle error occurred:
Error reading from database
Debug info:
SQLState: 42000
Error Code: 102
Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near '.'.
SQLState: 42000
Error Code: 102
Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near 'countwrapperquery'.
SELECT SQL_NO_CACHE countwrapperquery.id AS cohortid, countwrapperquery.itemcount, countwrapperquery.timestamp, countwrapperquery.recentcount, countwrapperquery.mediumcount, countwrapperquery.overduecount, cohort.name, cohort.description FROM (SELECT MAX(moduleunion.timestamp) AS timestamp, COUNT(moduleunion.userid) AS itemcount, SUM(CASE WHEN (moduleunion.timestamp > 1351178096) THEN 1 ELSE 0 END) AS recentcount, SUM(CASE WHEN (moduleunion.timestamp < 1351178096 AND moduleunion.timestamp > 1350659696) THEN 1 ELSE 0 END) AS mediumcount, SUM(CASE WHEN moduleunion.timestamp < 1350659696 THEN 1 ELSE 0 END) AS overduecount, cohort.id FROM (SELECT sub.userid, sub.timemodified AS timestamp, course_modules.id AS coursemoduleid, moduletable.course, sub.id AS subid, 'assignment' AS modulename FROM mdl_assignment moduletable INNER JOIN mdl_assignment_submissions sub ON sub.assignment = moduletable.id INNER JOIN mdl_course_modules course_modules ON course_modules.instance = moduletable.id AND course_modules.module = 1 INNER JOIN mdl_course course ON course.id = moduletable.course WHERE ( (sub.grade = -1 AND CONVERT(varchar, sub.submissioncomment, 32) = '') /* Never marked / OR ( ( moduletable.resubmit = 1 OR ( CONVERT(varchar, moduletable.assignmenttype, 32) = 'upload' AND moduletable.var4 = 1) ) / Resubmit allowed / AND (sub.timemodified > sub.timemarked) / Resubmit happened / ) ) / Not in draft state */ AND ( CONVERT(varchar, moduletable.assignmenttype, 32) != 'upload' OR ( CONVERT(varchar, moduletable.assignmenttype, 32) = 'upload' AND CONVERT(varchar, sub.data2, 32) = 'submitted')) AND CONVERT(varchar, moduletable.assignmenttype, 32) != 'offline' AND EXISTS ( SELECT NULL FROM mdl_enrol enrol INNER JOIN mdl_user_enrolments user_enrolments ON user_enrolments.enrolid = enrol.id WHERE enrol.enrol = 'cohort' AND enrol.courseid = moduletable.course AND user_enrolments.userid != '515' AND user_enrolments.userid = sub.userid) AND course_modules.visible = 1 AND course.visible = 1 AND moduletable.course IN ('2','44','61') UNION ALL SELECT sub.userid, sub.modified AS timestamp, course_modules.id AS coursemoduleid, moduletable.course, sub.id AS subid, 'forum' AS modulename FROM mdl_forum_posts sub INNER JOIN mdl_forum_discussions discussions ON sub.discussion = discussions.id INNER JOIN mdl_forum moduletable ON discussions.forum = moduletable.id INNER JOIN mdl_course_modules forumcoursemodules ON moduletable.id = forumcoursemodules.instance AND forumcoursemodules.module = 7 INNER JOIN mdl_context forumcontext ON forumcoursemodules.id = forumcontext.instanceid AND forumcontext.contextlevel = 70 INNER JOIN mdl_course_modules course_modules ON course_modules.instance = moduletable.id AND course_modules.module = 7 INNER JOIN mdl_course course ON course.id = moduletable.course WHERE sub.userid <> '515' AND moduletable.assessed > 0 AND NOT EXISTS (SELECT 1 FROM mdl_rating rating WHERE rating.component = 'mod_forum' AND rating.contextid = forumcontext.id AND rating.ratingarea = 'post' AND rating.itemid = sub.id AND rating.userid != '515' ) AND ( (moduletable.assesstimestart = 0) OR (sub.created >= moduletable.assesstimestart) ) AND ( (moduletable.assesstimefinish = 0) OR (sub.created <= moduletable.assesstimefinish) ) AND EXISTS ( SELECT NULL FROM mdl_enrol enrol INNER JOIN mdl_user_enrolments user_enrolments ON user_enrolments.enrolid = enrol.id WHERE enrol.enrol = 'cohort' AND enrol.courseid = moduletable.course AND user_enrolments.userid != '515' AND user_enrolments.userid = sub.userid) AND course_modules.visible = 1 AND course.visible = 1 AND moduletable.course IN ('2','44','61') UNION ALL SELECT sub.userid, sub.timecreated AS timestamp, course_modules.id AS coursemoduleid, moduletable.course, sub.id AS subid, 'quiz' AS modulename FROM mdl_quiz moduletable INNER JOIN mdl_quiz_attempts quiz_attempts ON moduletable.id = quiz_attempts.quiz INNER JOIN mdl_question_attempts question_attempts ON question_attempts.questionusageid = quiz_attempts.uniqueid INNER JOIN mdl_question_attempt_steps sub ON question_attempts.id = sub.questionattemptid INNER JOIN mdl_question question ON question_attempts.questionid = question.id INNER JOIN mdl_course_modules course_modules ON course_modules.instance = moduletable.id AND course_modules.module = 14 INNER JOIN mdl_course course ON course.id = moduletable.course WHERE quiz_attempts.timefinish > 0 AND quiz_attempts.preview = 0 AND CONVERT(varchar, question_attempts.behaviour, 32) = 'manualgraded' AND sub.state = 'needsgrading' AND NOT EXISTS( SELECT 1 FROM mdl_question_attempt_steps st WHERE st.state IN (N'gradedwrong',N'gradedpartial',N'gradedright',N'mangrwrong',N'mangrpartial',N'mangrright') AND st.questionattemptid = question_attempts.id) AND EXISTS ( SELECT NULL FROM mdl_enrol enrol INNER JOIN mdl_user_enrolments user_enrolments ON user_enrolments.enrolid = enrol.id WHERE enrol.enrol = 'cohort' AND enrol.courseid = moduletable.course AND user_enrolments.userid != '515' AND user_enrolments.userid = sub.userid) AND course_modules.visible = 1 AND course.visible = 1 AND moduletable.course IN ('2','44','61') UNION ALL SELECT sub.userid, sub.timemodified AS timestamp, course_modules.id AS coursemoduleid, moduletable.course, sub.id AS subid, 'assign' AS modulename FROM mdl_assign moduletable INNER JOIN mdl_assign_submission sub ON sub.assignment = moduletable.id LEFT JOIN mdl_assign_grades assign_grades ON assign_grades.assignment = moduletable.id AND assign_grades.userid = sub.userid AND assign_grades.grader = '515' INNER JOIN mdl_course_modules course_modules ON course_modules.instance = moduletable.id AND course_modules.module = 24 INNER JOIN mdl_course course ON course.id = moduletable.course WHERE CONVERT(varchar, sub.status, 32) = 'submitted' AND assign_grades.grade IS NULL AND EXISTS ( SELECT NULL FROM mdl_enrol enrol INNER JOIN mdl_user_enrolments user_enrolments ON user_enrolments.enrolid = enrol.id WHERE enrol.enrol = 'cohort' AND enrol.courseid = moduletable.course AND user_enrolments.userid != '515' AND user_enrolments.userid = sub.userid) AND course_modules.visible = 1 AND course.visible = 1 AND moduletable.course IN ('2','44','61') ) moduleunion INNER JOIN mdl_cohort_members cohort_members ON cohort_members.userid = moduleunion.userid INNER JOIN mdl_cohort cohort ON cohort_members.cohortid = cohort.id LEFT JOIN mdl_groups_members gmember_members ON gmember_members.userid = moduleunion.userid LEFT JOIN mdl_groups gmember_groups ON gmember_groups.id = gmember_members.groupid AND gmember_groups.courseid = moduleunion.course AND gmember_groups.courseid IN ('2','44','61') LEFT JOIN ( SELECT gviscoursemodulesettingsgroups.groupid, gviscoursemodulesettings.instanceid AS coursemoduleid FROM mdl_block_ajax_marking gviscoursemodulesettings INNER JOIN mdl_block_ajax_marking_groups gviscoursemodulesettingsgroups ON gviscoursemodulesettingsgroups.configid = gviscoursemodulesettings.id WHERE gviscoursemodulesettingsgroups.display = 0 AND gviscoursemodulesettings.userid = '515' AND gviscoursemodulesettings.tablename = 'course_modules' UNION SELECT gviscoursesettingsgroups.groupid, gviscoursemodules.id AS coursemoduleid FROM mdl_course_modules gviscoursemodules INNER JOIN mdl_block_ajax_marking gviscoursesettings ON gviscoursemodules.course = gviscoursesettings.instanceid AND gviscoursesettings.tablename = 'course' AND gviscoursesettings.userid = '515' INNER JOIN mdl_block_ajax_marking_groups gviscoursesettingsgroups ON gviscoursesettingsgroups.configid = gviscoursesettings.id AND gviscoursesettingsgroups.display = 0 WHERE NOT EXISTS (SELECT 1 FROM mdl_block_ajax_marking checknosettings INNER JOIN mdl_block_ajax_marking_groups checknogroups ON checknogroups.configid = checknosettings.id WHERE checknosettings.instanceid = gviscoursemodules.id AND checknosettings.tablename = 'course_modules' AND checknosettings.userid = '515' AND checknogroups.display IS NOT NULL)) gvis ON (gvis.groupid = gmember_groups.id OR (gvis.groupid = 0 AND gmember_groups.id IS NULL)) AND gvis.coursemoduleid = moduleunion.coursemoduleid LEFT JOIN mdl_block_ajax_marking cmconfig ON cmconfig.tablename = 'course_modules' AND cmconfig.instanceid = moduleunion.coursemoduleid AND cmconfig.userid = '515' LEFT JOIN mdl_block_ajax_marking courseconfig ON courseconfig.tablename = 'course' AND courseconfig.instanceid = moduleunion.course AND courseconfig.userid = '515' WHERE ((gmember_groups.id = gmember_members.groupid) OR (gmember_groups.id IS NULL AND gmember_members.groupid IS NULL)) AND gvis.groupid IS NULL AND NOT EXISTS ( SELECT 1 FROM mdl_groups_members gmax_members INNER JOIN mdl_groups gmax_groups ON gmax_groups.id = gmax_members.groupid WHERE NOT EXISTS (SELECT 1 FROM ( SELECT gviscoursemodulesettingsgroups.groupid, gviscoursemodulesettings.instanceid AS coursemoduleid FROM mdl_block_ajax_marking gviscoursemodulesettings INNER JOIN mdl_block_ajax_marking_groups gviscoursemodulesettingsgroups ON gviscoursemodulesettingsgroups.configid = gviscoursemodulesettings.id WHERE gviscoursemodulesettingsgroups.display = 0 AND gviscoursemodulesettings.userid = '515' AND gviscoursemodulesettings.tablename = 'course_modules' UNION SELECT gviscoursesettingsgroups.groupid, gviscoursemodules.id AS coursemoduleid FROM mdl_course_modules gviscoursemodules INNER JOIN mdl_block_ajax_marking gviscoursesettings ON gviscoursemodules.course = gviscoursesettings.instanceid AND gviscoursesettings.tablename = 'course' AND gviscoursesettings.userid = '515' INNER JOIN mdl_block_ajax_marking_groups gviscoursesettingsgroups ON gviscoursesettingsgroups.configid = gviscoursesettings.id AND gviscoursesettingsgroups.display = 0 WHERE NOT EXISTS (SELECT 1 FROM mdl_block_ajax_marking checknosettings INNER JOIN mdl_block_ajax_marking_groups checknogroups ON checknogroups.configid = checknosettings.id WHERE checknosettings.instanceid = gviscoursemodules.id AND checknosettings.tablename = 'course_modules' AND checknosettings.userid = '515' AND checknogroups.display IS NOT NULL)) gmax_vis WHERE gmax_vis.groupid = gmax_groups.id AND gmax_vis.coursemoduleid = moduleunion.coursemoduleid) AND gmax_members.userid = moduleunion.userid AND gmax_groups.courseid = moduleunion.course AND gmax_members.groupid > gmember_members.groupid AND gmax_groups.courseid IN ('2','44','61') ) AND COALESCE(cmconfig.display, courseconfig.display, 1) = 1 GROUP BY cohort.id ) countwrapperquery INNER JOIN mdl_cohort cohort ON countwrapperquery.id = cohort.id ORDER BY cohort.name ASC [array ( 0 => '515', 1 => 2, 2 => 44, 3 => 61, 4 => '515', 5 => '515', 6 => '515', 7 => 2, 8 => 44, 9 => 61, 10 => 'gradedwrong', 11 => 'gradedpartial', 12 => 'gradedright', 13 => 'mangrwrong', 14 => 'mangrpartial', 15 => 'mangrright', 16 => '515', 17 => 2, 18 => 44, 19 => 61, 20 => '515', 21 => '515', 22 => 2, 23 => 44, 24 => 61, 25 => 2, 26 => 44, 27 => 61, 28 => '515', 29 => '515', 30 => '515', 31 => '515', 32 => '515', 33 => '515', 34 => '515', 35 => '515', 36 => 2, 37 => 44, 38 => 61, )] Error code: dmlreadexception
Stacktrace:
- line 407 of \lib\dml\moodle_database.php: dml_read_exception thrown * line 258 of \lib\dml\sqlsrv_native_moodle_database.php: call to moodle_database->query_end() * line 365 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->query_end() * line 777 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->do_query() * line 812 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->get_recordset_sql() * line 592 of \blocks\ajax_marking\classes\query_base.class.php: call to sqlsrv_native_moodle_database->get_records_sql() * line 145 of \blocks\ajax_marking\filters\base.class.php: call to block_ajax_marking_query_base->execute() * line 188 of \blocks\ajax_marking\classes\nodes_builder_base.class.php: call to block_ajax_marking_query_decorator_base->execute() * line 60 of \blocks\ajax_marking\actions\ajax_nodes.php: call to block_ajax_marking_nodes_builder_base::unmarked_nodes()