Skip to content

Commit

Permalink
Now Oracle naming of objects introspects to avoid duplicates. MDL-7376
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Jan 27, 2007
1 parent 083c374 commit 6210ae1
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions lib/xmldb/classes/generators/oci8po/oci8po.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,37 @@ function getSequenceFromDB($xmldb_table) {
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
*/
Expand Down

0 comments on commit 6210ae1

Please sign in to comment.