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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-20 20:55 UTC] danielc@php.net
Fixed in CVS.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 20:01:31 2024 UTC