From: stronk7 Date: Sat, 27 Jan 2007 22:11:04 +0000 (+0000) Subject: Now Oracle naming of objects introspects to avoid duplicates. MDL-7376 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=6210ae1d43e28a064b2700bb1605cf0fe29bc874;p=moodle.git Now Oracle naming of objects introspects to avoid duplicates. MDL-7376 --- diff --git a/lib/xmldb/classes/generators/oci8po/oci8po.class.php b/lib/xmldb/classes/generators/oci8po/oci8po.class.php index 41d5144dc1..2c040d7bb1 100644 --- a/lib/xmldb/classes/generators/oci8po/oci8po.class.php +++ b/lib/xmldb/classes/generators/oci8po/oci8po.class.php @@ -527,6 +527,37 @@ class XMLDBoci8po extends XMLDBgenerator { return $sequencename; } + /** + * Given one object name and it's type (pk, uk, fk, ck, ix, uix, seq, trg) + * return if such name is currently in use (true) or no (false) + * (invoked from getNameForObject() + */ + function isNameInUse($object_name, $type) { + switch($type) { + case 'ix': + case 'uix': + case 'seq': + case 'trg': + if ($check = get_records_sql("SELECT object_name + FROM user_objects + WHERE lower(object_name) = '" . strtolower($object_name) . "'")) { + return true; + } + break; + case 'pk': + case 'uk': + case 'fk': + case 'ck': + if ($check = get_records_sql("SELECT constraint_name + FROM user_constraints + WHERE lower(constraint_name) = '" . strtolower($object_name) . "'")) { + return true; + } + break; + } + return false; //No name in use found + } + /** * Returns an array of reserved words (lowercase) for this DB */