Skip to content

Commit

Permalink
Predicates are now added in the foreach loop of the where function
Browse files Browse the repository at this point in the history
Test created to test this new scenario
  • Loading branch information
postalservice14 committed Jul 26, 2012
1 parent 40d6d43 commit 9920e34
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/Zend/Db/Sql/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ public function where($predicate, $combination = Predicate\PredicateSet::OP_AND)
} else {
$predicate = new Predicate\Expression($pvalue);
}

$this->where->addPredicate($predicate, $combination);
}

return $this;
}
$this->where->addPredicate($predicate, $combination);
}
Expand Down
9 changes: 9 additions & 0 deletions tests/Zend/Db/Sql/UpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ public function testWhere()
});
}

public function testPassingMultipleKeyValueInWhereClause()
{
$update = clone $this->update;
$update->table('table');
$update->set(array('fld1' => 'val1'));
$update->where(array('id1' => 'val1', 'id2' => 'val2'));
$this->assertEquals('UPDATE "table" SET "fld1" = \'val1\' WHERE "id1" = \'val1\' AND "id2" = \'val2\'', $update->getSqlString());
}

/**
* @covers Zend\Db\Sql\Update::prepareStatement
*/
Expand Down

0 comments on commit 9920e34

Please sign in to comment.