Skip to content

Commit

Permalink
BUGFIX Ensure DateTime objects are handled correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
halkyon committed May 4, 2012
1 parent 30f0173 commit 05d24b0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions code/MSSQLDatabase.php
Expand Up @@ -1781,6 +1781,12 @@ public function nextRecord() {
}
} 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
Expand Down

0 comments on commit 05d24b0

Please sign in to comment.