mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-04-30 04:03:10 +02:00
dc1e647602
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@260775 c90b9560-bf6c-de11-be94-00142212c4b1
153 lines
3.9 KiB
XML
153 lines
3.9 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.10 $ -->
|
|
<!-- EN-Revision: 1.6 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.maxdb-thread-id">
|
|
<refnamediv>
|
|
<refname>maxdb_thread_id</refname>
|
|
<refname>maxdb->thread_id</refname>
|
|
<refpurpose>Retourne l'identifiant du thread pour la connexion courante</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<para>Style procédural :</para>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>maxdb_thread_id</methodname>
|
|
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>Style orienté objet (propriété) :</para>
|
|
<classsynopsis>
|
|
<ooclass><classname>maxdb</classname></ooclass>
|
|
<fieldsynopsis><type>int</type><varname>thread_id</varname></fieldsynopsis>
|
|
</classsynopsis>
|
|
<para>
|
|
<function>maxdb_thread_id</function> retourne l'identifiant du thread
|
|
pour la connexion courante que l'on peut ensuite tuer en utilisant la fonction
|
|
<function>maxdb_kill</function>. Si la connexion est perdue et que
|
|
vous vous reconnectez avec la fonction <function>maxdb_ping</function>,
|
|
l'identifiant du thread changera. De ce fait, vous ne devez récupérer
|
|
l'identifiant du thread que lorsque vous en avez besoin.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
L'identifiant du thread est assigné à chaque connexion.
|
|
De ce fait, si la connexion est interrompue puis établie à nouveau, un nouvel
|
|
identifiant du thread sera assigné.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
<function>maxdb_thread_id</function> retourne l'identifiant du thread
|
|
pour la connexion courante.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title>Style orienté objet</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
|
|
|
/* Vérification de la connexion */
|
|
if (maxdb_connect_errno()) {
|
|
printf("Echec de la connexion : %s\n", maxdb_connect_error());
|
|
exit();
|
|
}
|
|
|
|
/* Détermine notre identifiant de thread */
|
|
$thread_id = $maxdb->thread_id;
|
|
|
|
/* Tue la connexion */
|
|
$maxdb->kill($thread_id);
|
|
|
|
/* This should produce an error */
|
|
if (!$maxdb->query("CREATE TABLE mycity LIKE hotel.city")) {
|
|
printf("Erreur : %s\n", $maxdb->error);
|
|
exit;
|
|
}
|
|
|
|
/* Fermeture de la connexion */
|
|
$maxdb->close();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Style procédural</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
|
|
|
/* Vérification de la connexion */
|
|
if (maxdb_connect_errno()) {
|
|
printf("Echec de la connexion : %s\n", maxdb_connect_error());
|
|
exit();
|
|
}
|
|
|
|
/* Détermine notre identifiant de thread */
|
|
$thread_id = maxdb_thread_id($link);
|
|
|
|
/* Tue la connexion */
|
|
maxdb_kill($link, $thread_id);
|
|
|
|
/* Ceci devrait produire une erreur */
|
|
if (!maxdb_query($link, "CREATE TABLE mycity LIKE hotel.city")) {
|
|
printf("Erreur : %s\n", maxdb_error($link));
|
|
exit;
|
|
}
|
|
|
|
/* Fermeture de la connexion */
|
|
maxdb_close($link);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
Warning: maxdb_query(): -10821 Session not connected <...>
|
|
Erreur : Session not connected
|
|
]]>
|
|
</screen>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>maxdb_kill</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:"../../../../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
|
|
--> |