From 5bd3bcac679f878f82033448bc3164183d0921fe Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Fri, 13 Nov 2009 03:46:43 +0000 Subject: [PATCH] BUGFIX Ensure that the ID is returned as a string when coming out of the database using the mssql_*() functions. This is NOT set to an integer, because there are many places in the sapphire framework that expect ID to be a string --- code/MSSQLDatabase.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/MSSQLDatabase.php b/code/MSSQLDatabase.php index 18ca363..1fdbcf8 100644 --- a/code/MSSQLDatabase.php +++ b/code/MSSQLDatabase.php @@ -1454,6 +1454,9 @@ class MSSQLQuery extends SS_Query { foreach($data as $columnIdx => $value) { $columnName = mssql_field_name($this->handle, $columnIdx); + // There are many places in the framework that expect the ID to be a string, not a double + // Do not set this to an integer, or it will cause failures in many tests that expect a string + if($columnName == 'ID') $value = (string) $value; // $value || !$ouput[$columnName] means that the *last* occurring value is shown // !$ouput[$columnName] means that the *first* occurring value is shown if(isset($value) || !isset($output[$columnName])) {