array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'function.pg-parameter-status.php', 1 => 'pg_parameter_status', 2 => 'Looks up a current parameter setting of the server', ), 'up' => array ( 0 => 'ref.pgsql.php', 1 => 'PostgreSQL Функції', ), 'prev' => array ( 0 => 'function.pg-options.php', 1 => 'pg_options', ), 'next' => array ( 0 => 'function.pg-pconnect.php', 1 => 'pg_pconnect', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/pgsql/functions/pg-parameter-status.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

pg_parameter_status

(PHP 5, PHP 7, PHP 8)

pg_parameter_statusLooks up a current parameter setting of the server

Опис

function pg_parameter_status(PgSql\Connection $connection = ?, string $name): string|false

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 by the server include server_version, server_encoding, client_encoding, is_superuser, session_authorization, DateStyle, TimeZone, and integer_datetimes. Note that server_version, server_encoding and integer_datetimes cannot change after PostgreSQL startup.

Параметри

connection

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

Увага

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

name

Possible name values include server_version, server_encoding, client_encoding, is_superuser, session_authorization, DateStyle, TimeZone, and integer_datetimes. Note that this value is case-sensitive.

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

A string containing the value of the parameter, false on failure or invalid name.

Журнал змін

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

Приклади

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