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

Bug #10285 MDB2_Schema::createTableIndexes() ignores indexes
Submitted: 2007-03-06 15:41 UTC
From: fornax Assigned: ifeghali
Status: Closed Package: MDB2_Schema (version 0.7.1)
PHP Version: 4.3.11 OS: Centos 4.3, Apache 1.3
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 28 + 31 = ?

 
 [2007-03-06 15:41 UTC] fornax (Andrew Hill)
Description: ------------ The MDB2_Schema::createTableIndexes() method has a mis-named return array, which results in the arrays that should be created being overwritten. Please find a patch below. Test script: --------------- --- MDB2/Schema.php (revision 4851) +++ MDB2/Schema.php (working copy) @@ -551,16 +551,16 @@ $errorcodes = array(MDB2_ERROR_UNSUPPORTED, MDB2_ERROR_NOT_CAPABLE); $this->db->expectError($errorcodes); if (!empty($index['primary']) || !empty($index['unique'])) { - $indexes = $this->db->manager->listTableConstraints($table_name); + $current_indexes = $this->db->manager->listTableConstraints($table_name); } else { - $indexes = $this->db->manager->listTableIndexes($table_name); + $current_indexes = $this->db->manager->listTableIndexes($table_name); } $this->db->popExpect(); - if (PEAR::isError($indexes)) { - if (!MDB2::isError($indexes, $errorcodes)) { - return $indexes; + if (PEAR::isError($current_indexes)) { + if (!MDB2::isError($current_indexes, $errorcodes)) { + return $current_indexes; } - } elseif (is_array($indexes) && in_array($index_name, $indexes)) { + } elseif (is_array($current_indexes) && in_array($index_name, $current_indexes)) { if (!$overwrite) { $this->db->debug('Index already exists: '.$index_name, __FUNCTION__); return MDB2_OK;

Comments

 [2007-03-06 16:37 UTC] ifeghali (Igor Feghali)
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.