Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixing issue with integer columns and NULL values.

Fixes #2037
  • Loading branch information...
commit a3f25ee5e362c3ed88e10f2fb1ef8231da799229 1 parent 11f3868
@markstory markstory authored
View
2  lib/Cake/Model/Datasource/DboSource.php
@@ -2443,7 +2443,7 @@ protected function _parseKey($model, $key, $value) {
break;
}
$value = "({$value})";
- } elseif ($null) {
+ } elseif ($null || $value === 'NULL') {
switch ($operator) {
case '=':
$operator = 'IS';
View
7 lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
@@ -2219,10 +2219,15 @@ public function testArrayConditionsParsing() {
$expected = " WHERE `Book`.`id` = 0";
$this->assertEqual($expected, $result);
- $result = $this->Dbo->conditions(array("Book.id" => NULL));
+ $result = $this->Dbo->conditions(array("Book.id" => null));
$expected = " WHERE `Book`.`id` IS NULL";
$this->assertEqual($expected, $result);
+ $conditions = array('MysqlModel.id' => '');
+ $result = $this->Dbo->conditions($conditions, true, true, $this->model);
+ $expected = " WHERE `MysqlModel`.`id` IS NULL";
+ $this->assertEqual($result, $expected);
+
$result = $this->Dbo->conditions(array('Listing.beds >=' => 0));
$expected = " WHERE `Listing`.`beds` >= 0";
$this->assertEqual($expected, $result);
Please sign in to comment.
Something went wrong with that request. Please try again.