From 0bf39d0c55045ad831a00ee852372af739f5b37b Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 4 Nov 2011 15:02:29 +0000 Subject: [PATCH] MDL-30137 question engine: Ugglify the SQL to appease MS SQL server. --- mod/quiz/locallib.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index ae956d59f50..87eecc0839f 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -693,7 +693,12 @@ function quiz_update_all_final_grades($quiz) { WHERE ABS(newgrades.newgrade - qg.grade) > 0.000005 OR - (newgrades.newgrade IS NULL) <> (qg.grade IS NULL)", + ((newgrades.newgrade IS NULL OR qg.grade IS NULL) AND NOT + (newgrades.newgrade IS NULL AND qg.grade IS NULL))", + // The mess on the previous line is detecting where the value is + // NULL in one column, and NOT NULL in the other, but SQL does + // not have an XOR operator, and MS SQL server can't cope with + // (newgrades.newgrade IS NULL) <> (qg.grade IS NULL). $param); $timenow = time();