From:             jdw5 at sha dot cornell dot edu
Operating system: Windows XP
PHP version:      4.3.3
PHP Bug Type:     OCI8 related
Bug description:  PEAR DB query() calls OCIFreeStatement before data fetched

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:[EMAIL PROTECTED]');
$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 bug report at http://bugs.php.net/?id=25747&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25747&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25747&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25747&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25747&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25747&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25747&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25747&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25747&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25747&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25747&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25747&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25747&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25747&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25747&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25747&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25747&r=float

Reply via email to