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

Bug #3997 query result not correctly wrapped
Submitted: 2005-03-29 21:56 UTC
From: yunosh Assigned: lsmith
Status: Closed Package: MDB2
PHP Version: Irrelevant OS:
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 : 37 + 37 = ?

 
 [2005-03-29 21:56 UTC] yunosh
Description: ------------ This patch fixes two issues: Query results not being properly wrapped if using mysql(i) with the manager's dumpDatabase() method. NOT NULL columns without default values causing errors in the manager. I can commit these changes directly if you want. Index: MDB2/Driver/Reverse/mysqli.php =================================================================== RCS file: /repository/pear/MDB2/MDB2/Driver/Reverse/mysqli.php,v retrieving revision 1.4 diff -u -r1.4 mysqli.php --- MDB2/Driver/Reverse/mysqli.php 25 Mar 2005 18:12:19 -0000 1.4 +++ MDB2/Driver/Reverse/mysqli.php 29 Mar 2005 21:55:40 -0000 @@ -128,7 +128,7 @@ return $db->raiseError(MDB2_ERROR, null, null, 'getTableFieldDefinition: '.$db->dummy_primary_key.' is an hidden column'); } - $result = $db->query("SHOW COLUMNS FROM $table", null, false, false); + $result = $db->query("SHOW COLUMNS FROM $table", null, true, false); if (PEAR::isError($result)) { return $result; } @@ -251,6 +251,12 @@ ) { $default = $row[$columns['default']]; } + if (isset($notnull) + && !isset($default) + && $type[0] == 'text' + ) { + $default = ''; + } $definition = array(); for ($field_choices = array(), $datatype = 0; $datatype < count($type); $datatype++) { $field_choices[$datatype] = array('type' => $type[$datatype]); @@ -338,7 +344,7 @@ return $db->raiseError(MDB2_ERROR, null, null, 'getTableIndexDefinition: PRIMARY is an hidden index'); } - $result = $db->query("SHOW INDEX FROM $table", null, false, false); + $result = $db->query("SHOW INDEX FROM $table", null, true, false); if (PEAR::isError($result)) { return $result; }

Comments

 [2005-03-30 19:32 UTC] smith at backendmedia dot com
I have fixed the wrapping issues. I am not sure about the default stuff. It just fixes things for text fields. I need to revisit the entire topic of how to handle missing default values for not null fields.
 [2005-04-01 10:12 UTC] smith at backendmedia dot com
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. I have removed the need for not null fields to have a default set and fixed the internal calls to query() to use the default result wrapping.