From: stronk7 Date: Sat, 30 Sep 2006 19:44:16 +0000 (+0000) Subject: Adding support to rename_key() X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=57770f7a50b66fc3e38904bec2c8706ce1147637;p=moodle.git Adding support to rename_key() Note that this is one EXPERIMENTAL function and shouldn't be used by you in production code EVER! --- diff --git a/lib/xmldb/classes/XMLDBTable.class.php b/lib/xmldb/classes/XMLDBTable.class.php index 917f112b76..70dc13e55d 100644 --- a/lib/xmldb/classes/XMLDBTable.class.php +++ b/lib/xmldb/classes/XMLDBTable.class.php @@ -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) {