mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
BUGFIX Ensure DateTime objects are handled correctly
This commit is contained in:
parent
30f017335b
commit
05d24b0843
@ -1781,6 +1781,12 @@ class MSSQLQuery extends SS_Query {
|
||||
}
|
||||
} else {
|
||||
if($data = sqlsrv_fetch_array($this->handle, SQLSRV_FETCH_ASSOC)) {
|
||||
|
||||
// special case for sqlsrv - date values are DateTime coming out of the sqlsrv drivers,
|
||||
// so we convert to the usual Y-m-d H:i:s value!
|
||||
foreach($data as $name => $value) {
|
||||
if($value instanceof DateTime) $data[$name] = $value->format('Y-m-d H:i:s');
|
||||
}
|
||||
return $data;
|
||||
} else {
|
||||
// Free the handle if there are no more results - sqlsrv crashes if there are too many handles
|
||||
|
Loading…
Reference in New Issue
Block a user