]> git.mjollnir.org Git - moodle.git/commitdiff
rename_field() under oracle completed
authorstronk7 <stronk7>
Mon, 2 Oct 2006 17:06:37 +0000 (17:06 +0000)
committerstronk7 <stronk7>
Mon, 2 Oct 2006 17:06:37 +0000 (17:06 +0000)
lib/xmldb/classes/generators/oci8po/oci8po.class.php

index e513a32eab5c0f17ba9c90c7cc1258dc6b2e697c..3fe24ebc452df13092046393b2ae5dc26304c676 100644 (file)
@@ -53,6 +53,8 @@ class XMLDBoci8po extends XMLDBgenerator {
 
     var $rename_table_extra_code = true; //Does the generator need to add code after table rename
 
+    var $rename_column_extra_code = true; //Does the generator need to add code after field rename
+
     var $enum_inline_code = false; //Does the generator need to add inline code in the column definition
 
     var $alter_column_sql = 'ALTER TABLE TABLENAME MODIFY (COLUMNSPECS)'; //The SQL template to alter columns
@@ -201,6 +203,26 @@ class XMLDBoci8po extends XMLDBgenerator {
         return array($comment);
     }
 
+    /**
+     * Returns the code (array of statements) needed to execute extra statements on field rename
+     */
+    function getRenameFieldExtraSQL ($xmldb_table, $xmldb_field, $newname) {
+
+        $results = array();
+
+    /// If the field is enum, drop and re-create the check constraint
+        if ($xmldb_field->getEnum()) {
+        /// Drop the current enum
+            $results = array_merge($results, $this->getDropEnumSQL($xmldb_table, $xmldb_field));
+        /// Change field name
+            $xmldb_field->setName($newname);
+        /// Recreate the enum
+            $results = array_merge($results, $this->getCreateEnumSQL($xmldb_table, $xmldb_field));
+        }
+
+        return $results;
+    }
+
     /**
      * Returns the code (array of statements) needed to execute extra statements on table drop
      */