Issues

ZF-5695: Zend_Db_Adapter_Pdo_Mysql->describeTable() does not return all information

Description

describeTable() (via Zend_Db_Table_Abstract->info()) returns a lot of data from its underlying sql call to 'DESCRIBE ' but not all of it.

A significant omission is key information. Whilst Primary Key and Identity information is returned, Unique Key and Index key information is not, forcing the developer to do a second sql 'DESCRIBE ' in their own code to get the rest of the information.

Unfortunately as the Zend_Db_Table_Abstract->_setupMetadata() uses the output of the filtered describeTable() to cache the result, we can't simply reread the cache for the data and this becomes an expensive operation.

Can we have describeTable() return ALL the table information please? I suspect an argument against doing this is that ZF devs have elected to return the Least Common Denominator (LCD) data consistent across all adapter types. I would say that you should normalise the LCD data so it is consistent across all adapters but provide any extra info in an 'extras' parameter of the returned data set so that developers can take advantage of it where possible.

Regards

Comments

There is a workaround for this. Create your own adapter based on the Zend supplied adapter e.g.

class My_Pdo_Mysql extends Zend_Db_Adapter_Pdo_Mysql;

and then override the describeTable() method to add in the bits that ZF misses out.

be aware of issue ZF-3154 when namimg the new class however.