Re: PHP 4.0 Bug #5888: Can't access result columns meta information after reaching the end of result.
| From: | thies at digicol dot de | Date: | Sat, 05 Aug 2000 10:30:45 +0000 |
| Subject: | Re: PHP 4.0 Bug #5888: Can't access result columns meta information after reaching the end of result. | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-27817@lists.php.net to get a copy of this message | ||
On Tue, Aug 01, 2000 at 04:10:12AM -0000, mlemos@acm.org wrote:
> From: mlemos@acm.org
> Operating system: Linux RH 6
> PHP version: 4.0 Latest CVS (01/08/2000)
> PHP Bug Type: Oracle related
> Bug description: Can't access result columns meta information after reaching the end of
> result.
>
> 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 .
sorry - please do not depend on OCINumCols to be valid after
the cursor is read. we need to free all cursor related suff
when the end of the cursor is reached in order to support
nested tables and REFCURSORS in the driver *without* carrying
to much complexity into the script level.
>
> Also notice the erroneous warning that is outputted.
this will be fixed shortly.
a few notes follow:
>
> <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);
> }
i would *not* recomment using putenv to set any of those - we
had all kinds of problems reported that went away by setting
the oracle-related env-vars _before_ apache was started!
> putenv("ORACLE_HOME=/home/oracle/u01");
> putenv("ORACLE_SID=dboracle");
OCINLogon is the slowest connection mode possible, it always
creates a new transaction context on the server. i don't
think that any other php-db-driver allows this level of
transaction isolation - use it only when needed!
>
> if(($connection=OCINLogon("SYS","change_on_install","dboracle")))
> {
OCINewCursor() is only needed for initilalizing bind
valriables.
> 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";
> ?>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
Digital Collections Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93 20097 Hamburg / Germany