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()

说明

pg_set_error_verbosity ([ resource $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

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 or PGSQL_ERRORS_VERBOSE.

返回值

The previous verbosity level: PGSQL_ERRORS_TERSE, PGSQL_ERRORS_DEFAULT or PGSQL_ERRORS_VERBOSE.

范例

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($dbconnPGSQL_ERRORS_VERBOSE);
  
$res1 pg_get_result($dbconn);
  echo 
pg_result_error($res1);
?>

参见

相关文章
php ibm db2 函数 returns a string containing the sqlstate returned by the last connection attemptphp db++ 函数 get error string for given errorcode or last errorphp db++ 函数 get error code for last operationphp eio 函数 returns string describing the last error associated with a request resourcephp fdf 函数 return error code for last fdf operationphp imap 函数 gets the last imap error that occurred during this page requestphp ingres 函数 get the last ingres error number generatedphp json 函数 returns the error string of the last json encode or json decode callphp maxdb 函数 returns the error code from last connect callphp maxdb 函数 returns a string description of the last errorphp maxdb 函数 returns a string description for last statement errorphp 多字节字符串 函数 retrieve the result from the last multibyte regular expression matchphp msql 函数 returns error message of last msql callphp postgresql 函数 submits a command and separate parameters to the server without waiting for the result s php postgresql 函数 determines the verbosity of messages returned by pg last error and pg result errorphp session pgsql 函数 increments error counts and sets last error messagephp session pgsql 函数 returns number of errors and last error messagephp socket 函数 returns the last error on the socketphp sqlite 函数 returns the error code of the last error for a databasephp sam 函数 contains the unique numeric error code of the last executed sam operation
关注编程学问公众号