Skip to content
Permalink
Browse files

Fixed handling null values in Sqlserver->value

The value function quoted a null value as N'' instead of NULL.
As a result is produced queries like [name] IS N'' instead of [name] IS NULL which resulted in an SQL error.
  • Loading branch information...
ovidiupruteanu committed Sep 9, 2013
1 parent 86bee4d commit b58940e9b5580a57310eceef6181e3d7273d2752
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Cake/Model/Datasource/Database/Sqlserver.php
@@ -571,7 +571,7 @@ public function renderStatement($type, $data) {
* @return string Quoted and escaped data * @return string Quoted and escaped data
*/ */
public function value($data, $column = null) { 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); return parent::value($data, $column);
} elseif (in_array($data, array('{$__cakeID__$}', '{$__cakeForeignKey__$}'), true)) { } elseif (in_array($data, array('{$__cakeID__$}', '{$__cakeForeignKey__$}'), true)) {
return $data; return $data;

0 comments on commit b58940e

Please sign in to comment.
You can’t perform that action at this time.