#25773 [Opn]: OCIError documentation incorrect about "last error"
| From: | goba@php.net | Date: | Tue, 07 Oct 2003 18:23:56 +0000 |
| Subject: | #25773 [Opn]: OCIError documentation incorrect about "last error" | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969356529@lists.php.net to get a copy of this message | ||
ID: 25773
Updated by: goba@php.net
Reported By: cjbj at hotmail dot com
Status: Open
Bug Type: Documentation problem
Operating System: Windows 2000
PHP Version: 4.3.3
New Comment:
Yes it will definitely help if you write up something to cut and paste.
Thanks for contributing, Goba.
Previous Comments:
------------------------------------------------------------------------
[2003-10-07 05:50:42] cjbj at hotmail dot com
Description:
------------
This is similar to http://bugs.php.net/bug.php?id=9510, which was
closed two years ago saying the docs need to be updated. However the
docs have still not been updated. Also there are no real useful
user-supplied notes in the manual entry despite them being referred to
in http://bugs.php.net/bug.php?id=8993
How do we get the OCIError documentation updated? Will
it help if I write something to cut-and-paste?
Re-description of the problem:
The OCIError documentation
http://www.php.net/manual/en/function.ocierror.php
says that if no
parameter is given, then the most recent error is displayed:
"If the optional stmt|conn|global is not provided, the last
error encountered is returned"
I am not seeing this with OCIParse or OCIExecute. I am seeing
OCIError return false. This is consistent with the comment in
http://bugs.php.net/bug.php?id=9510 :
"the documentation needs to be updated - ocierror always
stores the error in the most appropiate (parent-)handle. "
Reproduce code:
---------------
<?php
// Display OCI error
function PrintOCIError($t, $err)
{
echo "<pre>$t: ".$err['message']."</pre>\n";
}
echo "<p>Connecting . . . </p>";
$con = @OCILogon("scott", "tiger", "T920");
if (!$con) {
PrintOCIError(@OCIError());
}
// Deliberate syntax error: missing a single quote
$stid = @OCIParse($con, "select 'x from dual");
if (!$stid) {
$e = OCIError();
PrintOCIError("First error ", $e);
// The correct error is displayed when $con is passed to OCIError
$e = OCIError($con);
PrintOCIError("Second error ", $e);
}
?>
Expected result:
----------------
According to the documentation the testcase should give:
Connecting . . .
First error : ORA-01756: quoted string not properly terminated
Second error : ORA-01756: quoted string not properly terminated
Actual result:
--------------
The testcase gives:
Connecting . . .
First error :
Second error : ORA-01756: quoted string not properly terminated
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25773&edit=1