php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5888 Can't access result columns meta information after reaching the end of result.
Submitted: 2000-08-01 06:10 UTC Modified: 2006-07-17 08:39 UTC
From: mlemos at acm dot org Assigned:
Status: Closed Package: OCI8 related
PHP Version: 4.0 Latest CVS (01/08/2000) OS: Linux RH 6
Private report: No CVE-ID: None
 [2000-08-01 06:10 UTC] mlemos at acm dot org
Try the following script and see that after attempting to fetch the row after the
last in the result set, OCINumCols() no longer returns the right value.
This problem did not exist in PHP 4.0.0 .

Also notice the erroneous warning that is outputted.

<br>                                                                            
<b>Warning</b>:  failed to rollback outstanding transactions!: ORA-24324: servic
e handle not initialized                                                        
 in <b>Unknown</b> on line <b>0</b><br>

<?
 if(!function_exists("OCINLogon"))
 {
  $this->last_error="Oracle OCI API support is not available in this PHP configuration";
  return(0);
 }
 putenv("ORACLE_HOME=/home/oracle/u01");
 putenv("ORACLE_SID=dboracle");
 if(($connection=OCINLogon("SYS","change_on_install","dboracle")))
 {
  if(($cursor=OCINewCursor($connection)))
  {
   if(($statement=OCIParse($connection,"SELECT * FROM DUAL")))
   {
    if(($result=OCIExecute($statement,OCI_COMMIT_ON_SUCCESS)))
    {
     echo OCINumCols($statement),"\n";
     OCIFetch($statement);
     OCIFetch($statement);
     echo OCINumCols($statement),"\n";
     OCIFreeCursor($statement);
    }
    else
     echo "Could not execute query\n";
   }
   else
    echo "Could not parse query\n";
   OCIFreeCursor($cursor);
  }
  else
   echo "Could not create new query cursor\n";
  OCILogOff($connection);
 }
 else
  echo "Could not connect to Oracle server\n";
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-05 12:44 UTC] thies@php.net
this change was intentional - plz do not rely on any metadata information after the cursor is read. 
the reported warning is fixed in CVS
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed May 22 12:01:27 2019 UTC