From: stronk7 Date: Sun, 20 Aug 2006 18:01:50 +0000 (+0000) Subject: Although difficult, now all the key/index/sequence/trigger names X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c412278140dd20f5549ecd8778fa5733b716a33f;p=moodle.git Although difficult, now all the key/index/sequence/trigger names are quoted if they are reserved words --- diff --git a/lib/xmldb/classes/generators/XMLDBGenerator.class.php b/lib/xmldb/classes/generators/XMLDBGenerator.class.php index e360afce0c..32b58764c5 100644 --- a/lib/xmldb/classes/generators/XMLDBGenerator.class.php +++ b/lib/xmldb/classes/generators/XMLDBGenerator.class.php @@ -327,7 +327,7 @@ class XMLDBgenerator { case XMLDB_KEY_PRIMARY: if ($this->primary_keys) { if ($this->primary_key_name !== null) { - $key = $this->primary_key_name; + $key = $this->getEncQuoted($this->primary_key_name); } else { $key = $this->getNameForObject($xmldb_table->getName(), implode(', ', $xmldb_key->getFields()), 'pk'); } @@ -383,6 +383,7 @@ class XMLDBgenerator { /** * Given three strings (table name, list of fields (comma separated) and suffix), create the proper object name + * quoting it if necessary */ function getNameForObject($tablename, $fields, $suffix) { @@ -435,6 +436,9 @@ class XMLDBgenerator { /// Add the name to the cache $used_names[] = $namewithsuffix; + /// Quote it if necessary (reserved words) + $namewithsuffix = $this->getEncQuoted($namewithsuffix); + return $namewithsuffix; }