]> git.mjollnir.org Git - moodle.git/commitdiff
add_key() and drop_key() are working (with sync of undelying
authorstronk7 <stronk7>
Thu, 28 Sep 2006 17:25:00 +0000 (17:25 +0000)
committerstronk7 <stronk7>
Thu, 28 Sep 2006 17:25:00 +0000 (17:25 +0000)
indexes automated)

lib/xmldb/classes/XMLDBTable.class.php

index 0c750e3af088c261448f703b467b89d19e85cf90..79c5027b475d41ab9210fed57c99e0b614adc0a0 100644 (file)
@@ -909,6 +909,42 @@ class XMLDBTable extends XMLDBObject {
         return $results;
     }
 
+    /**
+     * This function will return the SQL code needed to add one key to the table for the specified DB and
+     * prefix. Just one simple wrapper over generators.
+     */
+    function getAddKeySQL ($dbtype, $prefix, $xmldb_key, $statement_end=true) {
+
+        $results = array();
+
+        $classname = 'XMLDB' . $dbtype;
+        $generator = new $classname();
+        $generator->setPrefix($prefix);
+        $results = $generator->getAddKeySQL($this, $xmldb_key);
+        if ($statement_end) {
+            $results = $generator->getEndedStatements($results);
+        }
+        return $results;
+    }
+
+    /**
+     * This function will return the SQL code needed to drop one key from the table for the specified DB and
+     * prefix. Just one simple wrapper over generators.
+     */
+    function getDropKeySQL ($dbtype, $prefix, $xmldb_key, $statement_end=true) {
+
+        $results = array();
+
+        $classname = 'XMLDB' . $dbtype;
+        $generator = new $classname();
+        $generator->setPrefix($prefix);
+        $results = $generator->getDropKeySQL($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.