Permalink
Browse files

Merge pull request #422 from scottharwell/2.1

Fixing possible SQL error when using 'field NOT' => array(1)
  • Loading branch information...
2 parents 7e9e3f9 + e1738c8 commit 6211be2acc4c6312bba9185d60e80755b29d374b @lorenzo lorenzo committed Jan 18, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Cake/Model/Datasource/DboSource.php
@@ -2368,7 +2368,7 @@ public function conditionKeysToString($conditions, $quoteValues = true, $model =
$keys = array_keys($value);
if ($keys === array_values($keys)) {
$count = count($value);
- if ($count === 1) {
+ if ($count === 1 && !preg_match("/\s+NOT$/", $key)) {
$data = $this->_quoteFields($key) . ' = (';
} else {
$data = $this->_quoteFields($key) . ' IN (';

0 comments on commit 6211be2

Please sign in to comment.