ZF-2962: Zend_Db_Statement_Oracle::fetchObject() throws Exception at end of results

Description

Zend_Db_Statement_Oracle::fetchObject() wraps oci_fetch_object() which returns "false" when there are no more rows to retrieve.

The current implementation throws an exception when false is returned:


$obj = oci_fetch_object($this->_stmt);

if ($obj === false) {
    /**
     * @see Zend_Db_Adapter_Oracle_Exception
     */
    require_once 'Zend/Db/Statement/Oracle/Exception.php';
    throw new Zend_Db_Statement_Oracle_Exception(oci_error($this->_stmt));
}

I suggest changing it to something similar to how Zend_Db_Statement_Oracle::fetch() method works. Something like:


$obj = oci_fetch_object($this->_stmt);

if ($obj === false && $error = oci_error($this->_stmt) ) {
    /**
     * @see Zend_Db_Adapter_Oracle_Exception
     */
    require_once 'Zend/Db/Statement/Oracle/Exception.php';
    throw new Zend_Db_Statement_Oracle_Exception($error);
}

which should only throw an exception if an actual error ocurred.

Comments

Reassigning to Ralph to bring closure to this issue.

Already corrected by SVN 13705