#25747 [Opn->Csd]: PEAR DB query() calls OCIFreeStatement before data fetched
| From: | danielc@php.net | Date: | Wed, 21 Jan 2004 01:55:56 +0000 |
| Subject: | #25747 [Opn->Csd]: PEAR DB query() calls OCIFreeStatement before data fetched | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-25191@lists.php.net to get a copy of this message | ||
ID: 25747
Updated by: danielc@php.net
Reported By: jdw5 at sha dot cornell dot edu
-Status: Open
+Status: Closed
Bug Type: PEAR related
Operating System: Windows XP
PHP Version: 4.3.3
-Assigned To:
+Assigned To: danielc
New Comment:
Fixed in CVS.
Previous Comments:
------------------------------------------------------------------------
[2003-10-03 13:49:22] jdw5 at sha dot cornell dot edu
Description:
------------
When using the two parameter form of the PEAR DB method 'query'
($dbh->query($sql, $parameters)), and using the oci8 driver, query will
call $dbh->freePrepared prior to returning which, in the oci8 driver,
calls OCIFreeStatement on the OCI statement handle, which causes OCI to
discard the results.
The solution was to comment out the call to OCIFreeStatement. In
that case, caller of $dbh->query must remember to free the statement by
calling $results->freeResults().
Reproduce code:
---------------
require_once('DB.php');
$dbh =& DB::connect('oci8://user:pass@db');
$result = $dbh->query('SELECT ? FROM DUAL', array('5'));
if (DB::isError($result)) {
print 'Error from query: '.$result->toString();
} else {
print "No Error\n";
$row = $result->fetchRow();
if (is_null($row)) {
print "No Rows\n";
} else {
print "Result is: $row[0]";
}
}
Expected result:
----------------
No Error
Result is: 5
Actual result:
--------------
No Error
No Rows
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25747&edit=1