ZF-836: Zend_Db_Table::fetchCount($where = null) - fetching number of row results

Issue Type: New Feature Created: 2007-01-31T18:46:02.000+0000 Last Updated: 2009-01-09T12:36:18.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Philipp F├╝hrer (flipkick) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db_Table

Related issues: - ZF-1335



i've wanted to count row results to build a nice helper which organizes my index-views more comfortable.

so i've added ..

<pre class="highlight">
     * Fetches the number of row results.
     * @return int The number of row results
    public function fetchCount($where = null)
        return (int)$this->_fetch('Count', $where);

.. and changed ..

<pre class="highlight">
        // the FROM clause
        $select->from($this->_name, array_keys($this->_cols));

.. to ..

<pre class="highlight">
        // the FROM clause
        if ($type == 'Count') {
            $select->from($this->_name, 'count(*)');
            $type = 'One';
            $select->from($this->_name, array_keys($this->_cols));

.. which gives me a Zend_Db_Table::fetchCount($where)-function returning the number of row results :)


Posted by Wil Sinclair (wil) on 2008-03-25T20:43:58.000+0000

Please categorize/fix as needed.

Posted by Wil Sinclair (wil) on 2008-04-18T13:11:56.000+0000

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Posted by Wil Sinclair (wil) on 2008-12-04T13:17:31.000+0000

Reassigning to Ralph since he's the new maintainer of Zend_Db

Posted by Ralph Schindler (ralph) on 2009-01-09T12:36:17.000+0000

A solution exists for this in this issue:

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.