Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #7109 Oracle Driver, Autoincremement Constraint problem
Submitted: 2006-03-13 14:43 UTC
From: nolife at gmail dot com Assigned: lsmith
Status: Closed Package: MDB2_Driver_oci8 (version 2.0.0)
PHP Version: 5.1.2 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-03-13 14:43 UTC] nolife at gmail dot com (nolife)
Description: ------------ When creating an autoincrement field mdb2 creates a constraint . The name is based on the tablename and the constant "AUTOINCREMENT_PK" This is used for various things. My Oracle 9R2 defaults to a varchar2(30) for the constraint identifier, this limits the table size and the reportet pear error does not really help debugging the problem. Test script: --------------- hotfix that solves the problem for me, suggested is a validation that tests the table string length -------------------------------------------------------- --- oci8_orig.php 2006-03-10 14:26:19.000000000 +0100 +++ oci8.php 2006-03-13 14:36:18.000000000 +0100 @@ -140,7 +140,7 @@ } $table = strtoupper($table); - $index_name = $table . '_AUTOINCREMENT_PK'; + $index_name = $table . '_AUTOINC_PK'; $definition = array( 'primary' => true, 'fields' => array($name => true), @@ -169,7 +169,7 @@ '_makeAutoincrement: sequence for autoincrement PK could not be created'); } $sequence_name = $db->getSequenceName($table); - $trigger_name = $db->quoteIdentifier($table . '_AUTOINCREMENT_PK', true); + $trigger_name = $db->quoteIdentifier($table . '_AUTOINC_PK', true); $table = $db->quoteIdentifier($table, true); $name = $db->quoteIdentifier($name, true); $trigger_sql = "CREATE TRIGGER $trigger_name BEFORE INSERT ON $table"; @@ -196,7 +196,7 @@ } $table = strtoupper($table); - $trigger_name = $table . '_AUTOINCREMENT_PK'; + $trigger_name = $table . '_AUTOINC_PK'; $trigger_name = $db->quoteIdentifier($trigger_name, true); $trigger = $db->queryOne("SELECT trigger_name FROM user_triggers WHERE trigger_name = '$trigger_name'"); if (PEAR::isError($trigger)) { @@ -217,7 +217,7 @@ '_dropAutoincrement: sequence for autoincrement PK could not be dropped'); } - $index_name = $table . '_AUTOINCREMENT_PK'; + $index_name = $table . '_AUTOINC_PK'; $result = $db->manager->dropConstraint($table, $index_name); if (PEAR::isError($result)) { return $db->raiseError(MDB2_ERROR, null, null, @@ -795,4 +795,4 @@ return $result; } } -?> \ Kein Zeilenumbruch am Dateiende. +?> --------------------------------------------------------

Comments

 [2006-03-13 15:17 UTC] lsmith
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. i went with AI_PK