Zend Framework

Zend_Db_Select having() does not allow passing the type of a value

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.10.5
  • Fix Version/s: 1.10.8
  • Component/s: Zend_Db_Select
  • Labels:
    None

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);

Activity

Hide
Martin Hujer added a comment -

typo

Show
Martin Hujer added a comment - typo
Hide
Ralph Schindler added a comment -

Can you propose a patch and unit test by chance?

Show
Ralph Schindler added a comment - Can you propose a patch and unit test by chance?
Hide
Dolf Schimmel (Freeaqingme) added a comment -

Can I just say I'm jealous on this issue?

Show
Dolf Schimmel (Freeaqingme) added a comment - Can I just say I'm jealous on this issue?
Hide
Dolf Schimmel (Freeaqingme) added a comment -

I'd wanted to add an issue with this id.

Show
Dolf Schimmel (Freeaqingme) added a comment - I'd wanted to add an issue with this id.
Hide
Martin Hujer added a comment -

Ralph: I'll try to do it tomorrow.

Dorf: Sorry...

Show
Martin Hujer added a comment - Ralph: I'll try to do it tomorrow. Dorf: Sorry...
Hide
Martin Hujer added a comment -

Attaching patch.

Ralph, it would be great if you have time to review it.

Show
Martin Hujer added a comment - Attaching patch. Ralph, it would be great if you have time to review it.
Hide
Pádraic Brady added a comment -

Applied patch by Martin Hujer in r22850

Show
Pádraic Brady added a comment - Applied patch by Martin Hujer in r22850
Hide
Simon Gilliot added a comment -

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.

Show
Simon Gilliot added a comment - 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.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: