From: stronk7 Date: Thu, 28 Sep 2006 17:25:00 +0000 (+0000) Subject: add_key() and drop_key() are working (with sync of undelying X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=fac17f427fee79f71ab83d80c63ea650753eeba5;p=moodle.git add_key() and drop_key() are working (with sync of undelying indexes automated) --- diff --git a/lib/xmldb/classes/XMLDBTable.class.php b/lib/xmldb/classes/XMLDBTable.class.php index 0c750e3af0..79c5027b47 100644 --- a/lib/xmldb/classes/XMLDBTable.class.php +++ b/lib/xmldb/classes/XMLDBTable.class.php @@ -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.