|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25747 PEAR DB query() calls OCIFreeStatement before data fetched
Submitted: 2003-10-03 13:49 UTC Modified: 2004-01-20 20:55 UTC
From: jdw5 at sha dot cornell dot edu Assigned: danielc (profile)
Status: Closed Package: PEAR related
PHP Version: 4.3.3 OS: Windows XP
Private report: No CVE-ID: None
 [2003-10-03 13:49 UTC] jdw5 at sha dot cornell dot edu
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:
$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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-20 20:55 UTC]
Fixed in CVS.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Aug 05 01:01:23 2021 UTC