ZF-2142: Allow the where() method of Zend_Db_Select to accept multiple arguments for automatic quoting


Currently the where method of Zend_Db_Select allows to call the where() method with a second parameter that gets quoted substituted into the first parameter and replaces the placeholder (question mark). Since the where() method can be called multiple times, multiple parameters can be quoted.

$select = $db->select()
    ->where("product_name = ?", $prod)
    ->where("price < ?", $minimumPrice)
    ->orWhere("price > ?", $maximumPrice);

Unfortunately this usage makes it more difficult when you need to evaluate Boolean expressions in a specific order. In certain cases it becomes necessary to use the non-quoted format in order to clarify the query because AND has higher precedence than OR. Quoting must be done separately.

$minPriceQuoted = $db->quote($minimumPrice);
$maxPriceQuoted = $db->quote($maximumPrice);
$select = $db->select()
    ->where("product_name = ?", $prod)
    ->where("price < $minPriceQuoted OR price > $maxPriceQuoted");

If the where() method accepted multiple parameters for quoting, the usage would be much less awkward:

$select = $db->select()
    ->where("product_name = ? AND (price < ? OR price > ?)", $prod, $minimumPrice, $maximumPrice);


Assigning to [~thomas].

Integrated to trunk... Please check SVN8640 or later and give us feedback.

Solution not accepted by community and main author. Reverted the changes.

Unassigned as original additional where methodology was not accepted.

Integrated with SVN7576. Cored with Release 1.5

Erased from core for review of complete component

Will evaluate within 2 weeks