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
Posted by Wil Sinclair (wil) on 2009-01-13T10:37:10.000+0000
Reassigning to Ralph to bring closure to this issue.
Posted by Mickael Perraud (mikaelkael) on 2009-10-18T02:26:16.000+0000
Already corrected by SVN 13705