php.net |  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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jdw5 at sha dot cornell dot edu
New email:
PHP Version: OS:

 

 [2003-10-03 13:49 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-20 20:55 UTC] danielc@php.net
Fixed in CVS.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 06:01:27 2025 UTC