ThaDafinser/ZfcDatagrid

Problem with count Pagination Oracle

Closed this issue · 7 comments

Hi I got this error using an oracle adapter:

I have the following problem in the file Zend\Paginator\Adapter\DbSelect;

   /**
     * Returns the total number of rows in the result set.
     *
     * @return int
     */
    public function count()
    {
        if ($this->rowCount !== null) {
            return $this->rowCount;
        }

        $select = clone $this->select;
        $select->reset(Select::LIMIT);
        $select->reset(Select::OFFSET);
        $select->reset(Select::ORDER);

        $countSelect = new Select;
        $countSelect->columns(array('c' => new Expression('COUNT(1)')));
        $countSelect->from(array('original_select' => $select));

        $statement = $this->sql->prepareStatementForSqlObject($countSelect);
        $result    = $statement->execute();

        $row       = $result->current();

        $this->rowCount = $row['c'];

        return $this->rowCount;
    }

$row['c'] is empty $result->current() returns $row['C'], 'C' in uppercase.

@FraGoTe since i cannot check Oracle currently, would it solve the problem to just change the c to uppercase?

yes, but that is in my zend vendor directory. How should I correct that without break any component or a future update?

ZF2.4 it's not an stable version, by now I'll extend the datasource. Thanks anyway!

Yeah that is a possible workaround i also do, when i need to wait for an upgrade 😄

Nice work! 👍