-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
1.6
-
None
-
All
-
MySQL
-
MOODLE_16_STABLE
Following error is displayed when attempting to add a new Choice activity:
==============================
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RELEASE, DISPLAY, ALLOWUPDATE, SHOWUNANSWERED, LIMITANSWERS, TIMEOPEN, TIMECLOSE' at line 1
INSERT INTO mdl_choice ( COURSE, NAME, TEXT, FORMAT, RELEASE, DISPLAY, ALLOWUPDATE, SHOWUNANSWERED, LIMITANSWERS, TIMEOPEN, TIMECLOSE, TIMEMODIFIED ) VALUES ( 12, 'test', 'test ', 1, 0, 0, 0, 0, 0, 0, 0, 1139313457 )
==============================
Server details
Apache: 2.0.54 (Win32)
PHP: 5.0.5
MySQL: 5.0.18-nt
Moodle: 1.6 dev (updated daily from CVS)
========
SOLUTION
========
Either rename the release field in the choice table, or modify adodb to always add backticks on MySQL fieldnames
To modify adodb to always add backticks to MySQL:
(1) locate following lines in lib/adodb/adodb-lib.inc.php (around line 539)
if (strpos($upperfname,' ') !== false)
$fnameq = $zthis->nameQuote.$upperfname.$zthis->nameQuote;
else
$fnameq = $upperfname;
(2) remove (or comment out) all except the nameQuote line, i.e.
// if (strpos($upperfname,' ') !== false)
$fnameq = $zthis->nameQuote.$upperfname.$zthis->nameQuote;
// else
// $fnameq = $upperfname;