ZF-10000: Zend_Db_Select having() does not allow passing the type of a value
Description
When using where(), you can pass the optional third parameter which way the $value should be quoted. This functionality is not available for having(). It would be nice to have it.
public function where($cond, $value = null, $type = null)
vs
public function having($cond)
{
if (func_num_args() > 1) {
$val = func_get_arg(1);
$cond = $this->_adapter->quoteInto($cond, $val);
}
Workaround:
$cond = $this->getAdapter()->quoteInto('count >= ?', $minimalCount, Zend_Db::INT_TYPE);
$select->having($cond);
Comments
Posted by Martin Hujer (mhujer) on 2010-06-16T11:47:42.000+0000
typo
Posted by Ralph Schindler (ralph) on 2010-06-18T13:16:14.000+0000
Can you propose a patch and unit test by chance?
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2010-06-18T13:18:13.000+0000
Can I just say I'm jealous on this issue?
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2010-06-18T13:18:29.000+0000
I'd wanted to add an issue with this id.
Posted by Martin Hujer (mhujer) on 2010-06-18T17:02:47.000+0000
Ralph: I'll try to do it tomorrow.
Dorf: Sorry...
Posted by Martin Hujer (mhujer) on 2010-06-19T01:43:11.000+0000
Attaching patch.
Ralph, it would be great if you have time to review it.
Posted by Pádraic Brady (padraic) on 2010-08-19T11:46:47.000+0000
Applied patch by Martin Hujer in r22850
Posted by Simon Gilliot (alsimon) on 2010-09-02T07:25:59.000+0000
I think this patch has some problems : In Zend_Db_Select, line 535, a test on value is done. That can't allow us to pass 0 or "0" (or an empty string) as value.