|
|
|
I would propose a new alternative fetch() method for Zend_Db_Adapter, to retrieve data combined with metadata in a canonical form. The adapter is responsible for assembling the metadata into this form.
Then a Zend_Db_Table_Row would also have a new method getMetadata() which returns an associative array mapping column names to a further associative array with attributes for the respective column. Zend_Db_Table_Row would always fetch the metadata for a query from the adapter. This might cause a slight performance cost depending on the adapter's implementation, but it is likely to be insignificant compared to the cost of the query itself. I wrote some considerations about this and other things on my blog:
http://tinyurl.com/2f38sq http://tinyurl.com/yr4lk9 metadata retrieving should be untied from the zend_db_table and should work using the getcolumnmeta function, that should be released as stable (not experimental like now). a feature that needs to be added is the table name of the field, absolutely needed when writing general code This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
PDO has a method getColumnMeta() but it is noted as "experimental" in the PDO docs. Not all PDO drivers are guaranteed to support it. I haven't checked the status of support for this method in the PDO drivers we use in ZF.
The PDO getColumnMeta() method returns an associative array for a single column (specified by the 0-indexed ordinal number of the column), with the following keys:
MySQLi stmts have a result_metadata() method, so this could support result set metadata. The result_metadata() method returns a result-set object, which is an iterable collection of fields. Each field is an object. The documentation does not specify the members of this object.
The OCI API for Oracle has individual methods for metadata. So this could support result set metadata. The methods are: