pg_set_error_verbosity
(PHP 5 >= 5.1.0, PHP 7)
pg_set_error_verbosity — Determines the verbosity of messages returned by pg_last_error() and pg_result_error()
Description
$connection
], int $verbosity
) : intDetermines the verbosity of messages returned by pg_last_error() and pg_result_error().
pg_set_error_verbosity() sets the verbosity mode, returning the connection's previous
setting. In PGSQL_ERRORS_TERSE
mode, returned messages include severity, primary text, and
position only; this will normally fit on a single line. The default mode (PGSQL_ERRORS_DEFAULT
)
produces messages that include the above plus any detail, hint, or context
fields (these may span multiple lines). The PGSQL_ERRORS_VERBOSE
mode includes all available
fields. Changing the verbosity does not affect the messages available from
already-existing result objects, only subsequently-created ones.
Parameters
-
connection
-
PostgreSQL database connection resource. When
connection
is not present, the default connection is used. The default connection is the last connection made by pg_connect() or pg_pconnect(). -
verbosity
-
The required verbosity:
PGSQL_ERRORS_TERSE
,PGSQL_ERRORS_DEFAULT
orPGSQL_ERRORS_VERBOSE
.
Return Values
The previous verbosity level: PGSQL_ERRORS_TERSE
,
PGSQL_ERRORS_DEFAULT
or PGSQL_ERRORS_VERBOSE
.
Examples
Example #1 pg_set_error_verbosity() example
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
if (!pg_connection_busy($dbconn)) {
pg_send_query($dbconn, "select * from doesnotexist;");
}
pg_set_error_verbosity($dbconn, PGSQL_ERRORS_VERBOSE);
$res1 = pg_get_result($dbconn);
echo pg_result_error($res1);
?>
See Also
- pg_last_error() - Get the last error message string of a connection
- pg_result_error() - Get error message associated with result
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-function.pg-set-error-verbosity.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.