Files
php-doc-ru/reference/mysql/functions/mysql-ping.xml
Alexander Moskaliov 7bf5a93848 Updated translation
git-svn-id: https://svn.php.net/repository/phpdoc/ru/trunk@336379 c90b9560-bf6c-de11-be94-00142212c4b1
2015-04-05 09:18:31 +00:00

123 lines
3.7 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: ed56c4e375ef51f88d578741f1b5074d31fc0988 Maintainer: shein Status: ready -->
<!-- Reviewed: no -->
<!-- $Revision$ -->
<refentry xml:id="function.mysql-ping" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mysql_ping</refname>
<refpurpose>Проверяет соединение с сервером и пересоединяется при необходимости</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
&mysql.alternative.note;
<simplelist role="alternatives">
<member><function>mysqli_ping</function></member>
</simplelist>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>mysql_ping</methodname>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter><initializer>NULL</initializer></methodparam>
</methodsynopsis>
<para>
Проверяет работает ли соединение с сервером. Если оно
утеряно, автоматически предпринимается попытка пересоединения. Эта
функция может быть использована в скриптах, работающих на протяжении
долгого времени.
</para>
<note>
<para>
Автоматическое восстановление соединения по умолчанию отключено в версиях MySQL &gt;= 5.0.3.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&mysql.linkid.description;
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает &true;, если соединение в рабочем состоянии
и &false; в противном случае.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример использования <function>mysql_ping</function></title>
<programlisting role="php">
<![CDATA[
<?php
set_time_limit(0);
$conn = mysql_connect('localhost', 'mysqluser', 'mypass');
$db = mysql_select_db('mydb');
/* Подразумевается что этот запрос будет выполняться достаточно долго */
$result = mysql_query($sql);
if (!$result) {
echo 'Запрос #1 не удался, выходим.';
exit;
}
/* Проверяем что соединение еще работает, если нет, соединяемся заново */
if (!mysql_ping($conn)) {
echo 'Соединение потеряно, выходим после запроса #1';
exit;
}
mysql_free_result($result);
/* Соединение еще работает, выполняем еще один запрос */
$result2 = mysql_query($sql2);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mysql_thread_id</function></member>
<member><function>mysql_list_processes</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
-->