From aed4e5271340863c364acdba02c26839161c26f2 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Wed, 6 Sep 2006 19:47:50 +0000 Subject: [PATCH] Now indexes are able to return their PHP specs. --- lib/xmldb/classes/XMLDBIndex.class.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/xmldb/classes/XMLDBIndex.class.php b/lib/xmldb/classes/XMLDBIndex.class.php index 33d5e18f1f..8333b42d5e 100644 --- a/lib/xmldb/classes/XMLDBIndex.class.php +++ b/lib/xmldb/classes/XMLDBIndex.class.php @@ -211,6 +211,31 @@ class XMLDBIndex extends XMLDBObject { $this->changed = true; } + /** + * Returns the PHP code needed to define one XMLDBIndex + */ + function getPHP() { + + $result = ''; + + /// The type + $unique = $this->getUnique(); + if (!empty($unique)) { + $result .= 'XMLDB_INDEX_UNIQUE, '; + } else { + $result .= 'XMLDB_INDEX_NOTUNIQUE, '; + } + /// The fields + $indexfields = $this->getFields(); + if (!empty($indexfields)) { + $result .= 'array(' . "'". implode("', '", $indexfields) . "')"; + } else { + $result .= 'null'; + } + /// Return result + return $result; + } + /** * Shows info in a readable format */ -- 2.39.5