mirror of
https://github.com/php/doc-ru.git
synced 2025-07-30 12:57:40 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/ru/trunk@335474 c90b9560-bf6c-de11-be94-00142212c4b1
148 lines
4.7 KiB
XML
148 lines
4.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: 04b11e621f6ccf857368d90262f051a8d40c865d Maintainer: aur Status: ready -->
|
||
<!-- Reviewed: yes -->
|
||
<!-- $Revision$ -->
|
||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.16 -->
|
||
<refentry xml:id="function.pg-set-client-encoding" xmlns="http://docbook.org/ns/docbook">
|
||
<refnamediv>
|
||
<refname>pg_set_client_encoding</refname>
|
||
<refpurpose>
|
||
Устанавливает клиентскую кодировку
|
||
</refpurpose>
|
||
</refnamediv>
|
||
|
||
<refsect1 role="description">
|
||
&reftitle.description;
|
||
<methodsynopsis>
|
||
<type>int</type><methodname>pg_set_client_encoding</methodname>
|
||
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
|
||
<methodparam><type>string</type><parameter>encoding</parameter></methodparam>
|
||
</methodsynopsis>
|
||
<para>
|
||
<function>pg_set_client_encoding</function> устанавливает клиентскую
|
||
кодировку и возвращает 0 при успехе, -1 в случае ошибки.
|
||
</para>
|
||
<para>
|
||
PostgreSQL автоматически конвертирует данные из кодировки базы данных
|
||
в кодировку клиентского приложения.
|
||
</para>
|
||
<note>
|
||
<para>
|
||
Прежнее название функции: <function>pg_setclientencoding</function>.
|
||
</para>
|
||
</note>
|
||
</refsect1>
|
||
|
||
<refsect1 role="parameters">
|
||
&reftitle.parameters;
|
||
<para>
|
||
<variablelist>
|
||
<varlistentry>
|
||
<term><parameter>connection</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Ресурс подключения к базе данных PostgreSQL. Если параметр
|
||
<parameter>connection</parameter> не задан, будет использовано
|
||
подключение по умолчанию - последнее соединение, открытое функцией
|
||
<function>pg_connect</function> или <function>pg_pconnect</function>.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>encoding</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Требуемая клиентская кодировка. Список возможных значений:
|
||
<literal>SQL_ASCII</literal>, <literal>EUC_JP</literal>,
|
||
<literal>EUC_CN</literal>, <literal>EUC_KR</literal>,
|
||
<literal>EUC_TW</literal>, <literal>UNICODE</literal>,
|
||
<literal>MULE_INTERNAL</literal>, <literal>LATINX</literal> (X=1...9),
|
||
<literal>KOI8</literal>, <literal>WIN</literal>,
|
||
<literal>ALT</literal>, <literal>SJIS</literal>,
|
||
<literal>BIG5</literal> or <literal>WIN1250</literal>.
|
||
</para>
|
||
<para>
|
||
Список доступных кодировок зависит от версии PostgreSQL. Смотрите
|
||
документацию к вашей версии сервера.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
</variablelist>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="returnvalues">
|
||
&reftitle.returnvalues;
|
||
<para>
|
||
Возвращает 0 в случае успеха, либо -1 в случае ошибки.
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="examples">
|
||
&reftitle.examples;
|
||
<para>
|
||
<example>
|
||
<title>Пример использования <function>pg_set_client_encoding</function></title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
|
||
$conn = pg_pconnect("dbname=publisher");
|
||
if (!$conn) {
|
||
echo "Произошла ошибка.\n";
|
||
exit;
|
||
}
|
||
|
||
// Установка кодировки в UNICODE. Данные будут автоматически
|
||
// преобразованы из кодировки в базе данных к клиентской.
|
||
pg_set_client_encoding($conn, "UNICODE");
|
||
|
||
$result = pg_query($conn, "SELECT author, email FROM authors");
|
||
if (!$result) {
|
||
echo "Произошла ошибка.\n";
|
||
exit;
|
||
}
|
||
|
||
// Выводим UTF-8 данные
|
||
while ($row = pg_fetch_row($result)) {
|
||
echo "Author: $row[0] E-mail: $row[1]";
|
||
echo "<br />\n";
|
||
}
|
||
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
</example>
|
||
</para>
|
||
</refsect1>
|
||
<refsect1 role="seealso">
|
||
&reftitle.seealso;
|
||
<para>
|
||
<simplelist>
|
||
<member><function>pg_client_encoding</function></member>
|
||
</simplelist>
|
||
</para>
|
||
</refsect1>
|
||
</refentry>
|
||
|
||
<!-- Keep this comment at the end of the file
|
||
Local variables:
|
||
mode: sgml
|
||
sgml-omittag:t
|
||
sgml-shorttag:t
|
||
sgml-minimize-attributes:nil
|
||
sgml-always-quote-attributes:t
|
||
sgml-indent-step:1
|
||
sgml-indent-data:t
|
||
indent-tabs-mode:nil
|
||
sgml-parent-document:nil
|
||
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
||
sgml-exposed-tags:nil
|
||
sgml-local-catalogs:nil
|
||
sgml-local-ecat-files:nil
|
||
End:
|
||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||
vim: et tw=78 syn=sgml
|
||
vi: ts=1 sw=1
|
||
-->
|