From 3d74e77aaee57074f117f3345679e3383f9c59b1 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Tue, 11 Sep 2007 19:08:11 +0000 Subject: [PATCH] Now we aren't guessing check constraint names but getting the real ones under Oracle. MDL-9356 --- .../classes/generators/oci8po/oci8po.class.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/xmldb/classes/generators/oci8po/oci8po.class.php b/lib/xmldb/classes/generators/oci8po/oci8po.class.php index ea68d652f5c..ad37cad719e 100644 --- a/lib/xmldb/classes/generators/oci8po/oci8po.class.php +++ b/lib/xmldb/classes/generators/oci8po/oci8po.class.php @@ -451,9 +451,16 @@ class XMLDBoci8po extends XMLDBgenerator { * (usually invoked from getModifyEnumSQL() */ function getDropEnumSQL($xmldb_table, $xmldb_field) { - /// All we have to do is to drop the check constraint - return array('ALTER TABLE ' . $this->getTableName($xmldb_table) . - ' DROP CONSTRAINT ' . $this->getNameForObject($xmldb_table->getName(), $xmldb_field->getName(), 'ck')); + /// Let's introspect to know the real name of the check constraint + if ($check_constraints = $this->getCheckConstraintsFromDB($xmldb_table, $xmldb_field)) { + $check_constraint = array_shift($check_constraints); /// Get the 1st (should be only one) + $constraint_name = strtolower($check_constraint->name); /// Extract the REAL name + /// All we have to do is to drop the check constraint + return array('ALTER TABLE ' . $this->getTableName($xmldb_table) . + ' DROP CONSTRAINT ' . $constraint_name); + } else { /// Constraint not found. Nothing to do + return array(); + } } /**