]> git.mjollnir.org Git - moodle.git/commitdiff
Adding support to rename_key()
authorstronk7 <stronk7>
Sat, 30 Sep 2006 19:44:16 +0000 (19:44 +0000)
committerstronk7 <stronk7>
Sat, 30 Sep 2006 19:44:16 +0000 (19:44 +0000)
Note that this is one EXPERIMENTAL function and shouldn't be used
by you in production code EVER!

lib/xmldb/classes/XMLDBTable.class.php

index 917f112b76e66d0a3fddef1e3daaee98b1f7e614..70dc13e55d1b82091013c177eda7caa2ddabedef 100644 (file)
@@ -963,6 +963,24 @@ class XMLDBTable extends XMLDBObject {
         return $results;
     }
 
+    /**
+     * This function will return the SQL code needed to rename one key from the table for the specified DB and
+     * prefix. Just one simple wrapper over generators.
+     */
+    function getRenameKeySQL ($dbtype, $prefix, $xmldb_key, $statement_end=true) {
+
+        $results = array();
+
+        $classname = 'XMLDB' . $dbtype;
+        $generator = new $classname();
+        $generator->setPrefix($prefix);
+        $results = $generator->getRenameKeySQL($this, $xmldb_key);
+        if ($statement_end) {
+            $results = $generator->getEndedStatements($results);
+        }
+        return $results;
+    }
+
     /**
      * This function will return the SQL code needed to add one index to the table for the specified DB and
      * prefix. Just one simple wrapper over generators.
@@ -1002,6 +1020,7 @@ class XMLDBTable extends XMLDBObject {
     /**
      * This function will return the SQL code needed to rename one index from the table for the specified DB and
      * prefix. Just one simple wrapper over generators.
+     * Experimental. Shouldn't be used at all!
      */
     function getRenameIndexSQL ($dbtype, $prefix, $xmldb_index, $statement_end=true) {