ZF-7041: Zend_Db_Adapter returns "double(X, Y) unsigned" instead of "double" for a column DATA_TYPE and voids SCALE and PRECISION keys

Issue Type: Bug Created: 2009-06-18T05:08:32.000+0000 Last Updated: 2012-11-20T21:37:42.000+0000 Status: Reopened Fix version(s): Reporter: Nicolas Grevet (nyko18) Assignee: None Tags: - Zend_Db_Adapter_Mysqli

Related issues: Attachments: - ZF-7041.patch


I don't know if it's supposed to be like this, but when I try to access the metadata of any random MySQL table which have a DOUBLE field, the Zend_Db_Adapter_Pdo_Mysql returns "double(X, Y) unsigned" instead of "double" for a column DATA_TYPE. Additionnaly, it also voids the SCALE and PRECISION keys in the metadata, which is quite strange because it works perfectly using FLOAT and DECIMAL types.

{quote} array 'SCHEMA_NAME' => null 'TABLE_NAME' => string 'test' (length=4) 'COLUMN_NAME' => string 'float3_3' (length=8) 'COLUMN_POSITION' => int 10 'DATA_TYPE' => string 'float' (length=5) 'DEFAULT' => null 'NULLABLE' => boolean false 'LENGTH' => null 'SCALE' => string '3' (length=1) 'PRECISION' => string '3' (length=1) 'UNSIGNED' => null 'PRIMARY' => boolean false 'PRIMARY_POSITION' => null 'IDENTITY' => boolean false

array 'SCHEMA_NAME' => null 'TABLE_NAME' => string 'test' (length=4) 'COLUMN_NAME' => string 'double5_3' (length=9) 'COLUMN_POSITION' => int 11 'DATA_TYPE' => string 'double(5,3) unsigned' (length=20) 'DEFAULT' => null 'NULLABLE' => boolean false 'LENGTH' => null 'SCALE' => null 'PRECISION' => null 'UNSIGNED' => boolean true 'PRIMARY' => boolean false 'PRIMARY_POSITION' => null 'IDENTITY' => boolean false {quote}


Posted by Sebastian Iancu (sebastian.i) on 2010-12-01T07:19:25.000+0000

At the PHP Benelux BugHuntDay 2010 I was focusing on solving this bug and I came out with this patch.

There are many other type of fields suffering by the same behavior, not only DOUBLE, and it is pretty much depending on the used SQL server. I was only focusing on MySQL 5.1 and Sqlite3, thus my patch only address these adapters (MySQLi, PDO-MySQL and PDO-Sqlite).

PDO-Sqlite also have the same misbehavior, but to solve entirely is more complicated, because of the sqlite-affinity and the conversion rules of user-types to internal type and affinity.

Others may want to further contribute on this subject.

The patch contains also relevant unit tests.

Posted by Ramon Henrique Ornelas (ramon) on 2010-12-06T15:47:32.000+0000

Correct me if i wrong but is missing apply the patch to this issue that already was marked how fixed.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.