]> git.mjollnir.org Git - moodle.git/commitdiff
Minor fix to be able to drop tables without prefix properly (adodb_log)
authorstronk7 <stronk7>
Fri, 22 Sep 2006 16:16:48 +0000 (16:16 +0000)
committerstronk7 <stronk7>
Fri, 22 Sep 2006 16:16:48 +0000 (16:16 +0000)
lib/xmldb/classes/generators/XMLDBGenerator.class.php

index 2c3f48e3511e1501633bb59c10780a82d77b3663..36d59b390a3708ca61d2e8de34dfede932098c25 100644 (file)
@@ -447,18 +447,31 @@ class XMLDBgenerator {
      */
     function getDropTableSQL($xmldb_table) {
 
+        $tempprefix = '';
+    /// If the table needs to be created without prefix
+        if (in_array($xmldb_table->getName(), $this->getTablesWithoutPrefix())) {
+        /// Save current prefix to be restore later
+            $tempprefix = $this->prefix;
+        /// Empty prefix
+            $this->prefix = '';
+        }
+
         $results = array();  //Array where all the sentences will be stored
 
         $drop = str_replace('TABLENAME', $this->getEncQuoted($this->prefix . $xmldb_table->getName()), $this->drop_table_sql);
 
         $results[] = $drop;
 
-    /// TODO, call to getDropTableExtraSQL() if $rename_table_extra_code is enabled. It will add sequence/trigger drop code.
+    /// call to getDropTableExtraSQL() if $rename_table_extra_code is enabled. It will add sequence/trigger drop code.
         if ($this->drop_table_extra_code) {
             $extra_sentences = $this->getDropTableExtraSQL($xmldb_table);
             $results = array_merge($results, $extra_sentences);
         }
 
+    /// Re-set the original prefix if it has changed
+        if ($tempprefix) {
+            $this->prefix = $tempprefix;
+        }
 
         return $results;
     }