array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'function.pg-set-error-verbosity.php', 1 => 'pg_set_error_verbosity', 2 => 'Determines the verbosity of messages returned by pg_last_error and pg_result_error', ), 'up' => array ( 0 => 'ref.pgsql.php', 1 => 'PostgreSQL Функції', ), 'prev' => array ( 0 => 'function.pg-set-error-context-visibility.php', 1 => 'pg_set_error_context_visibility', ), 'next' => array ( 0 => 'function.pg-socket.php', 1 => 'pg_socket', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/pgsql/functions/pg-set-error-verbosity.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

pg_set_error_verbosity

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

pg_set_error_verbosity Determines the verbosity of messages returned by pg_last_error() and pg_result_error()

Опис

pg_set_error_verbosity(PgSql\Connection $connection = ?, int $verbosity): int

Determines 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.

Параметри

connection

Примірник PgSql\Connection. Якщо параметр connection не визначено, то виконується стандартне з'єднання, тобто останнє, виконане функцією pg_connect() або pg_pconnect().

Увага

Починаючи з PHP 8.1.0, використання стандартного з'єднання є застарілим.

verbosity

The required verbosity: PGSQL_ERRORS_TERSE, PGSQL_ERRORS_DEFAULT or PGSQL_ERRORS_VERBOSE.

Значення, що повертаються

The previous verbosity level: PGSQL_ERRORS_TERSE, PGSQL_ERRORS_DEFAULT or PGSQL_ERRORS_VERBOSE.

Журнал змін

Версія Опис
8.1.0 Тепер параметр connection має бути примірником PgSql\Connection. Раніше очікувався resource.

Приклади

Приклад #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);
?>

Прогляньте також