Merge pull request #1620 from ovidiupruteanu/patch-1

Fixed handling null values in Sqlserver->value().

Fixes #3768
This commit is contained in:
Mark Story 2013-09-09 09:20:05 -07:00
commit 1499723252
2 changed files with 5 additions and 1 deletions

View file

@ -571,7 +571,7 @@ class Sqlserver extends DboSource {
* @return string Quoted and escaped data
*/
public function value($data, $column = null) {
if (is_array($data) || is_object($data)) {
if ($data === null || is_array($data) || is_object($data)) {
return parent::value($data, $column);
} elseif (in_array($data, array('{$__cakeID__$}', '{$__cakeForeignKey__$}'), true)) {
return $data;

View file

@ -311,6 +311,10 @@ class SqlserverTest extends CakeTestCase {
$expected = "''";
$result = $this->db->value('', 'binary');
$this->assertSame($expected, $result);
$expected = 'NULL';
$result = $this->db->value(null, 'string');
$this->assertSame($expected, $result);
}
/**