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

Request #10234 Set length property when not null, rather than > 0
Submitted: 2007-03-01 16:13 UTC
From: andrew dot hill at openads dot org Assigned: quipo
Status: Closed Package: MDB2_Driver_pgsql (version 1.3.0)
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 : 7 + 21 = ?

 
 [2007-03-01 16:13 UTC] andrew dot hill at openads dot org (Andrew Hill)
Description: ------------ In MDB2_Driver_Reverse_pgsql::getTableFieldDefinition(), the length property is only set when the returned length value from MDB2_Driver_Datatype_Common::mapNativeDatatype() is > 0. However, it is the responsibility of MDB2_Driver_Datatype_Common::mapNativeDatatype() to ensure that it returns the correct length value, or null. As a result, I would propose that the MDB2_Driver_Reverse_pgsql::getTableFieldDefinition() method only check to see if $length is not null, and if so, set the property. See also http://pear.php.net/bugs/bug.php?id=10233 Test script: --------------- --- MDB2/Driver/Reverse/pgsql.php (revision 4767) +++ MDB2/Driver/Reverse/pgsql.php (working copy) @@ -121,7 +121,7 @@ $autoincrement = true; } $definition[0] = array('notnull' => $notnull, 'nativetype' => $column['type']); - if ($length > 0) { + if (!is_null($length)) { $definition[0]['length'] = $length; } if (!is_null($unsigned)) {

Comments

 [2007-03-04 23:44 UTC] quipo (Lorenzo Alberton)
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.