]> git.mjollnir.org Git - moodle.git/commitdiff
Although difficult, now all the key/index/sequence/trigger names
authorstronk7 <stronk7>
Sun, 20 Aug 2006 18:01:50 +0000 (18:01 +0000)
committerstronk7 <stronk7>
Sun, 20 Aug 2006 18:01:50 +0000 (18:01 +0000)
are quoted if they are reserved words

lib/xmldb/classes/generators/XMLDBGenerator.class.php

index e360afce0c37c57411fa9aa0c4e790772ffb84aa..32b58764c5ad317ee7c252d8d9aa4c78bc226d7a 100644 (file)
@@ -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;
     }