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

Bug #6054 unsigned fields handling in reverse class
Submitted: 2005-11-24 09:33 UTC
From: alex at cgi-central dot net Assigned: lsmith
Status: Closed Package: MDB2_Driver_mysql
PHP Version: 4.3.11 OS: any
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 : 36 - 8 = ?

 
 [2005-11-24 09:33 UTC] alex at cgi-central dot net
Description: ------------ Reverse driver seems to do not have any handling to determine unsigned fields. Code below adds this handling. Also function name was wrong: getTableConstraintDefinition instead of getTableConstraintsDefinition in base class, this caused all kind of troubles. Test script: --------------- --- MDB2/Driver/Reverse/mysql.php 16 Oct 2005 09:39:50 -0000 1.34 +++ MDB2/Driver/Reverse/mysql.php 24 Nov 2005 09:31:23 -0000 @@ -93,6 +93,7 @@ } if ($field_name == $column['field']) { list($types, $length) = $db->datatype->mapNativeDatatype($column); + $unsigned = preg_match('/ unsigned/i', $column['type']); $notnull = false; if (array_key_exists('null', $column) && $column['null'] != 'YES') { $notnull = true; @@ -120,6 +121,9 @@ if ($default !== false) { $definition[$key]['default'] = $default; } + if ($unsigned) { + $definition[$key]['unsigned'] = 1; + } if ($autoincrement !== false) { $definition[$key]['autoincrement'] = $autoincrement; } @@ -201,7 +205,7 @@ } // }}} - // {{{ getTableConstraintDefinition() + // {{{ getTableConstraintsDefinition() /** * get the stucture of a constraint into an array @@ -211,7 +215,7 @@ * @return mixed data array on success, a MDB2 error on failure * @access public */ - function getTableConstraintDefinition($table, $index_name) + function getTableConstraintsDefinition($table, $index_name) { $db =& $this->getDBInstance(); if (PEAR::isError($db)) { @@ -224,6 +228,7 @@ } $definition = array(); while (is_array($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))) { + if (!($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) || $db->options['field_case'] != CASE_LOWER ) {

Comments

 [2005-11-24 14:21 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!