Files
php-doc-ru/reference/mysql/functions/mysql-pconnect.xml
sergey 63da451bcf upd: actual en-revision
git-svn-id: https://svn.php.net/repository/phpdoc/ru/trunk@347581 c90b9560-bf6c-de11-be94-00142212c4b1
2019-06-08 21:55:31 +00:00

203 lines
7.8 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 43c3e5cb61b0557f3a1bd7b54b154e3bdd2046a2 Maintainer: shein Status: ready -->
<!-- Reviewed: no -->
<!-- $Revision$ -->
<refentry xml:id="function.mysql-pconnect" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mysql_pconnect</refname>
<refpurpose>Устанавливает постоянное соединение с сервером MySQL</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
&mysql.alternative.note;
<simplelist role="alternatives">
<member><function>mysqli_connect</function> с <literal>p:</literal> префиксом хоста</member>
<member><methodname>PDO::__construct</methodname> с опцией драйвера <constant>PDO::ATTR_PERSISTENT</constant></member>
</simplelist>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>mysql_pconnect</methodname>
<methodparam choice="opt"><type>string</type><parameter>server</parameter><initializer>ini_get("mysql.default_host")</initializer></methodparam>
<methodparam choice="opt"><type>string</type><parameter>username</parameter><initializer>ini_get("mysql.default_user")</initializer></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter><initializer>ini_get("mysql.default_password")</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>client_flags</parameter><initializer>0</initializer></methodparam>
</methodsynopsis>
<!-- Undocumented confusing syntax:
<methodsynopsis>
<type>resource</type><methodname>mysql_pconnect</methodname>
<methodparam choice="opt"><type>string</type><parameter>server</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>username</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>new_link</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>client_flags</parameter></methodparam>
</methodsynopsis>
-->
<para>
Устанавливает постоянное соединение с сервером MySQL.
</para>
<!-- TODO: Integrate this information more nicely with features.persistent -->
<para>
<function>mysql_pconnect</function> работает аналогично
<function>mysql_connect</function> с двумя важными отличиями.
</para>
<para>
Во-первых, при соединении функция пытается найти уже открытый
(постоянный) указатель на тот же сервер с тем же пользователем и паролем.
Если он найден, возвращён функцией будет именно он, вместо открытия
нового соединения.
</para>
<para>
Во-вторых, соединение с SQL-сервером не будет закрыто, когда работа
скрипта закончится. Вместо этого, оно останется рабочим для будущего
использования (<function>mysql_close</function> также не закрывает
постоянные соединения, открытые <function>mysql_pconnect</function>).
</para>
<para>
Соединения такого типа называют 'постоянными'.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>server</parameter></term>
<listitem>
<para>
Сервер MySQL. Может также включать номер порта, например,
"hostname:port" или путь к локальному сокету, например,
":/path/to/socket" для локального хоста.
</para>
<para>
Если директива <link linkend="ini.mysql.default-host">
mysql.default_host</link> не определена (по умолчанию), то
по умолчанию используется значение 'localhost:3306'
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>username</parameter></term>
<listitem>
<para>
Имя пользователя. По умолчанию используется имя пользователя,
владеющего серверным процессом.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>password</parameter></term>
<listitem>
<para>
Пароль. По умолчанию используется пустая строка.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>client_flags</parameter></term>
<listitem>
<para>
Параметр <parameter>client_flags</parameter> может быть
комбинацией следующих констант:
128 (включает обработку <literal>LOAD DATA LOCAL</literal>),
<constant>MYSQL_CLIENT_SSL</constant>,
<constant>MYSQL_CLIENT_COMPRESS</constant>,
<constant>MYSQL_CLIENT_IGNORE_SPACE</constant> и
<constant>MYSQL_CLIENT_INTERACTIVE</constant>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает дескриптор постоянного соединения MySQL в случае успеха,
и &false; в случае ошибки.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>5.5.0</entry>
<entry>
Эта функция теперь вызывает ошибку <constant>E_DEPRECATED</constant>.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
Учтите, что соединения такого типа работают только, если
PHP установлен как модуль. За дополнительной информацией
обращайтесь к разделу
"<link linkend="features.persistent-connections">Постоянные соединения с
базами данных</link>".
</para>
</note>
<warning>
<para>
Использование постоянных соединений может потребовать некоторой
настройки Apache и MySQL. Убедитесь, что вы не превысите максимальное
число дозволенных соединений в MySQL.
</para>
</warning>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mysql_connect</function></member>
<member>"<link linkend="features.persistent-connections">Постоянные
соединения с базами данных</link>"</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
-->