From fac17f427fee79f71ab83d80c63ea650753eeba5 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Thu, 28 Sep 2006 17:25:00 +0000 Subject: [PATCH] add_key() and drop_key() are working (with sync of undelying indexes automated) --- lib/xmldb/classes/XMLDBTable.class.php | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/xmldb/classes/XMLDBTable.class.php b/lib/xmldb/classes/XMLDBTable.class.php index 0c750e3af08..79c5027b475 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.