ADODB mysqli doesn't support tables with reserved-word names in MetaIndexes()

Bug #1238424 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Critical
Aaron Wells

Bug Description

We have a few tables and columns with reserved-word names. Perhaps the worst offender is "group". Normally this doesn't cause a problem because our machine-generated SQL statements escape the table name in double quotes. But, in the ADODB mysqli driver's MetaIndexes() function, which is ultimately used in Mahara's ddl.php add_index(), drop_index(), find_index_name(), and index_exists() functions, they don't add any escape marks. The result: errors during upgrade.

[WAR] 9a (lib/errors.php:464) An exception was thrown of class ADODB_Exception.
[WAR] 9a (lib/errors.php:464) THIS IS BAD and should be changed to something extending MaharaException,
[WAR] 9a (lib/errors.php:464) unless the exception is from a third party library.
[WAR] 9a (lib/errors.php:464) Original trace follows
[WAR] 9a (lib/adodb/adodb-exceptions.inc.php:78) mysqli error: [1064: 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 'group' at line 1] in adodb_throw(SHOW INDEXES FROM group, )
[WAR] 9a (lib/adodb/adodb-exceptions.inc.php:78)
Call stack (most recent first):
  * adodb_throw("mysqli", "adodb_throw", 1064, "You have an error in your SQL syntax; check the ma...", "SHOW INDEXES FROM group", false, object(ADODB_mysqli)) at /home/aaronw/www/mahara/htdocs/lib/adodb/adodb.inc.php:257
  * ADODB_TransMonitor("mysqli", "EXECUTE", 1064, "You have an error in your SQL syntax; check the ma...", "SHOW INDEXES FROM group", false, object(ADODB_mysqli)) at /home/aaronw/www/mahara/htdocs/lib/adodb/adodb.inc.php:1074
  * ADOConnection->_Execute("SHOW INDEXES FROM group", false) at /home/aaronw/www/mahara/htdocs/lib/adodb/adodb.inc.php:1049
  * ADOConnection->Execute("SHOW INDEXES FROM group") at /home/aaronw/www/mahara/htdocs/lib/adodb/drivers/adodb-mysqli.inc.php:331
  * ADODB_mysqli->MetaIndexes("group") at /home/aaronw/www/mahara/htdocs/lib/ddl.php:479
  * find_index_name(object(XMLDBTable), object(XMLDBIndex)) at /home/aaronw/www/mahara/htdocs/lib/ddl.php:374
  * index_exists(object(XMLDBTable), object(XMLDBIndex)) at /home/aaronw/www/mahara/htdocs/lib/xmldb/classes/generators/XMLDBGenerator.class.php:714
  * XMLDBgenerator->getAddKeySQL(object(XMLDBTable), object(XMLDBKey)) at /home/aaronw/www/mahara/htdocs/lib/xmldb/classes/XMLDBTable.class.php:961
  * XMLDBTable->getAddKeySQL("mysqli", "", object(XMLDBKey), false) at /home/aaronw/www/mahara/htdocs/lib/ddl.php:1097
  * add_key(object(XMLDBTable), object(XMLDBKey)) at /home/aaronw/www/mahara/htdocs/lib/db/upgrade.php:2385
  * xmldb_core_upgrade("2011061015") at /home/aaronw/www/mahara/htdocs/lib/upgrade.php:311
  * upgrade_core(object(stdClass)) at /home/aaronw/www/mahara/htdocs/lib/mahara.php:265
  * upgrade_mahara(array(size 11)) at /home/aaronw/www/mahara/htdocs/admin/cli/upgrade.php:62

A nonrecoverable error occurred. This probably means you have encountered a bug in the system

Revision history for this message
Aaron Wells (u-aaronw) wrote :
Changed in mahara:
status: New → In Progress
importance: Undecided → Critical
assignee: nobody → Aaron Wells (u-aaronw)
milestone: none → 1.8.0
Aaron Wells (u-aaronw)
Changed in mahara:
status: In Progress → Fix Committed
Aaron Wells (u-aaronw)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.