pg_parameter_status

(PHP 5, PHP 7)

pg_parameter_statusLooks up a current parameter setting of the server

说明

pg_parameter_status ([ resource $connection ], string $param_name ) : string

Looks up a current parameter setting of the server.

Certain parameter values are reported by the server automatically at connection startup or whenever their values change. pg_parameter_status() can be used to interrogate these settings. It returns the current value of a parameter if known, or FALSE if the parameter is not known.

Parameters reported as of PostgreSQL 8.0 include server_version, server_encoding, client_encoding, is_superuser, session_authorization, DateStyle, TimeZone, and integer_datetimes. (server_encoding, TimeZone, and integer_datetimes were not reported by releases before 8.0.) Note that server_version, server_encoding and integer_datetimes cannot change after PostgreSQL startup.

PostgreSQL 7.3 or lower servers do not report parameter settings, pg_parameter_status() includes logic to obtain values for server_version and client_encoding anyway. Applications are encouraged to use pg_parameter_status() rather than ad hoc code to determine these values.

Caution

On a pre-7.4 PostgreSQL server, changing client_encoding via SET after connection startup will not be reflected by pg_parameter_status().

参数

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

param_name

Possible param_name values include server_version, server_encoding, client_encoding, is_superuser, session_authorization, DateStyle, TimeZone, and integer_datetimes.

返回值

A string containing the value of the parameter, FALSE on failure or invalid param_name.

范例

Example #1 pg_parameter_status() example

<?php
  $dbconn 
pg_connect("dbname=publisher") or die("Could not connect");

  echo 
"Server encoding: "pg_parameter_status($dbconn"server_encoding");
?>

以上例程会输出:

Server encoding: SQL_ASCII

相关文章
php apd 函数 get an array of the current variables names in the local scopephp cubrid mysql 兼容性函数 ping a server connection or reconnect if there is no connectionphp ibm db2 函数 returns the width of the current value of the indicated column in a result setphp maxdb 函数 open a new connection to the maxdb serverphp maxdb 函数 returns the version of the maxdb server as an integerphp maxdb 函数 opens a connection to a maxdb serverphp maxdb 函数 gets the current system statusphp ncurses 函数 delete line at current position move rest of screen upphp ncurses 函数 insert lines before current line scrolling down negative numbers delete and scroll up php ncurses 函数 scroll window content up or down without changing current positionphp postgresql 函数 looks up a current parameter setting of the serverphp postgresql 函数 submits a command to the server and waits for the result with the ability to pass parameters separately from the sql command textphp postgresql 函数 submits a command and separate parameters to the server without waiting for the result s php postgresql 函数 returns the current in transaction status of the serverphp postgresql 函数 returns an array with client protocol and server version when available php sqlsrv 函数 sends data from parameter streams to the serverphp statistic 函数 calculates any one parameter of the cauchy distribution given values for the othersphp svn 函数 retrieves authentication parameterphp sybase 函数 sets the handler called when a server message is raisedphp mnogosearch 函数 get the path to the current category
关注编程学问公众号