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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
48 - 33 = ?
Subscribe to this entry?

 
 [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: Fri Apr 26 00:01:30 2024 UTC