Skip to content
Permalink
Browse files

Fixing issue in DboSource::_matchRecords() where unqualified conditio…

…ns would result in 1=1 conditions. Fixing incorrect test case. Fixes #930
  • Loading branch information...
markstory committed Sep 16, 2010
1 parent 9bf6fbf commit d12d2d70cd0b25978b0f0256dba0bbfcee040248
@@ -1487,8 +1487,10 @@ function _matchRecords(&$model, $conditions = null) {
$noJoin = false;
break;
}
$conditions[$field] = $value;
unset($conditions[$originalField]);
if ($field !== $originalField) {
$conditions[$field] = $value;
unset($conditions[$originalField]);
}
}
if ($noJoin === true) {
return $this->conditions($conditions);
@@ -662,13 +662,13 @@ function testAlterIndexes() {
function testUpdateAllWithNonQualifiedConditions() {
$this->loadFixtures('Article');
$Article =& new Article();
$result = $Article->updateAll(array('title' => "'Awesome'"), array('published' => 'Y'));
$result = $Article->updateAll(array('title' => "'Awesome'"), array('title' => 'Third Article'));
$this->assertTrue($result);

$result = $Article->find('count', array(
'conditions' => array('Article.title' => 'Awesome')
));
$this->assertEqual($result, 3, 'Article count is wrong or fixture has changed.');
$this->assertEqual($result, 1, 'Article count is wrong or fixture has changed.');
}
}
?>
?>

0 comments on commit d12d2d7

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