Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
N/A
-
Resolution: Not an Issue
-
Affects Version/s: 1.9.0
-
Fix Version/s: None
-
Component/s: Zend_Db
-
Labels:None
Description
I have reported this issue to Juokaz but his fix (if any) didn't make it into 1.9.0
As http://msdn.microsoft.com/en-us/library/cc296193%28SQL.90%29.aspx states, certain SQL types will be converted to native PHP objects. For example, the datetime SQL time comes back as a PHP DateTime object (http://uk3.php.net/manual/en/class.datetime.php) rather than a string.
I believe that these columns should be fetched as strings, allowing you to switch between the sqlsrv and other (e.g. pdo_mssql) adapters without introducing additional logic to handle string/Datetime data types in your application.
The PHP data type used to represent a column can be specified using sqlsrv_get_field. See http://msdn.microsoft.com/en-us/library/cc296208%28SQL.90%29.aspx
I have few sollutions in mind, but only one work for me: having Date object cast to sting. Its quite easy in all calls to check if returned value is date object and then return value as a string representation.
I don't think that using sqlsrv_get_field for all fields is a good idea. Basically you will end-up with exponentially increasing load.