#18747 [Asn->Csd]: pg_result_error is complete useless
| From: | vrana@php.net | Date: | Tue, 27 Jul 2004 18:50:09 +0000 |
| Subject: | #18747 [Asn->Csd]: pg_result_error is complete useless | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969362261@lists.php.net to get a copy of this message | ||
ID: 18747
Updated by: vrana@php.net
Reported By: vincent at sunlight dot tmfweb dot nl
-Status: Assigned
+Status: Closed
Bug Type: Documentation problem
Operating System: Linux
PHP Version: 4.2.2
Assigned To: yohgaki
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
"Because pg_query() returns false if the query fails, you must must use
pg_send_query() and pg_get_result() to get the result handle."
Thanks to anonymous user contributed note for explaining.
Previous Comments:
------------------------------------------------------------------------
[2003-12-13 10:39:16] aspire420 at hotpop dot com
I also tried this function with no good result. I suppose this
function must be made workable as PostgreSQL 7.4 > have error codes
rather than strings and with those error codes we have to throw some
realistic and meaning full output to our applications
------------------------------------------------------------------------
[2003-06-22 20:19:54] jc at mega-bucks dot co dot jp
When will the documentation be updated? This bug report has been open
for 10 months now ...
The documentation clearly states that we should be using this function
instead of the *old* pg_last_error():
http://jp.php.net/manual/en/function.pg-last-error.php
Use pg_result_error(), pg_result_status() and pg_connection_status()
for better error handling.
But as the first person who reported this bug noted, the current
implementation of this function is useless. You can't pass it a valid
ressource identifier because pg_query() returns false on failure.
Having a valid bug report open for almost one year is a bit too long
....
I really want to use this function as it seems very useful and more
robust than pg_last_error() but I can't figure out at all how to use it
...
------------------------------------------------------------------------
[2002-08-07 03:12:12] yohgaki@php.net
Looks like I need to explain how it could be useful.
If you cannot wait, read libpq manual.
------------------------------------------------------------------------
[2002-08-05 17:58:17] vincent at sunlight dot tmfweb dot nl
The function pg_result_error() supposedly gives the error
message for some failed SQL query after calling pg_query()
with that query. It must be given a resource identifier of
the result to get the error message for that result
(sounds alright).
However, function pg_query() returns FALSE if a query
failed instead of a result identifier, so what can
possibly be passed to pq_result_error() in this case? The
query certainly went wrong, but there's no way to check
exactly what, as there is no resource identifier...
Almost looks like a Catch 22.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18747&edit=1