mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-04-29 03:33:21 +02:00
ae28be1e4d
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@270744 c90b9560-bf6c-de11-be94-00142212c4b1
147 lines
4.9 KiB
XML
147 lines
4.9 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.11 $ -->
|
|
<!-- EN-Revision: 1.7 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.maxdb-connect">
|
|
<refnamediv>
|
|
<refname>maxdb_connect</refname>
|
|
<refname>maxdb</refname>
|
|
<refpurpose>Ouvre une nouvelle connexion sur un serveur MaxDB</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<para>Style procédural :</para>
|
|
<methodsynopsis>
|
|
<type>resource</type><methodname>maxdb_connect</methodname>
|
|
<methodparam choice='opt'><type>string</type><parameter>host</parameter></methodparam>
|
|
<methodparam choice='opt'><type>string</type><parameter>username</parameter></methodparam>
|
|
<methodparam choice='opt'><type>string</type><parameter>passwd</parameter></methodparam>
|
|
<methodparam choice='opt'><type>string</type><parameter>dbname</parameter></methodparam>
|
|
<methodparam choice='opt'><type>int</type><parameter>port</parameter></methodparam>
|
|
<methodparam choice='opt'><type>string</type><parameter>socket</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>Style orienté objet (constructeur) :</para>
|
|
<classsynopsis>
|
|
<ooclass><classname>maxdb</classname></ooclass>
|
|
<constructorsynopsis>
|
|
<methodname>__construct</methodname>
|
|
<methodparam choice='opt'><type>string</type><parameter>host</parameter></methodparam>
|
|
<methodparam choice='opt'><type>string</type><parameter>username</parameter></methodparam>
|
|
<methodparam choice='opt'><type>string</type><parameter>passwd</parameter></methodparam>
|
|
<methodparam choice='opt'><type>string</type><parameter>dbname</parameter></methodparam>
|
|
<methodparam choice='opt'><type>int</type><parameter>port</parameter></methodparam>
|
|
<methodparam choice='opt'><type>string</type><parameter>socket</parameter></methodparam>
|
|
</constructorsynopsis>
|
|
</classsynopsis>
|
|
<para>
|
|
<function>maxdb_connect</function> tente d'ouvrir une connexion sur un serveur
|
|
MaxDB fonctionnant sur l'hôte <parameter>host</parameter> qui peut être soit
|
|
un nom d'hôte, soit une adresse IP. Passer la chaîne "localhost" à ce paramètre,
|
|
l'hôte local sera assumé. En cas de succès, <function>maxdb_connect</function>
|
|
retournera une ressource représentant la connexion à la base de données, ou &false;
|
|
si une erreur survient.
|
|
</para>
|
|
<para>
|
|
Les paramètres <parameter>username</parameter> et
|
|
<parameter>password</parameter> spécifient le nom de l'utilisateur ainsi que le mot
|
|
de passe utilisés pour la connexion au serveur MaxDB. Si le mot de passe n'est pas
|
|
fourni (la valeur &null; est passée), le serveur MaxDB tentera d'identifier l'utilisateur
|
|
encore une fois en utilisant la valeur de l'option de configuration
|
|
<parameter>maxdb.default_pw</parameter> du &php.ini;.
|
|
</para>
|
|
<para>
|
|
Le paramètre <parameter>dbname</parameter>, si fourni, spécifie la base de données
|
|
par défaut à utiliser lors de l'exécution de requêtes. S'il n'est pas fourni, l'option
|
|
de configuration <parameter>maxdb.default_db</parameter> du &php.ini;
|
|
est utilisée.
|
|
</para>
|
|
<para>
|
|
Les paramètres <parameter>port</parameter> et <parameter>socket</parameter>
|
|
sont ignorés par le serveur MaxDB.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retourne une ressource représentant la connexion au serveur MaxDB ou &false;
|
|
si la connexion échoue.
|
|
</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érfication de la connexion */
|
|
if (maxdb_connect_errno()) {
|
|
printf("Echec de la connexion : %s\n", maxdb_connect_error());
|
|
exit();
|
|
}
|
|
|
|
printf("Informations sur l'hôte : %s\n", $maxdb->host_info);
|
|
|
|
/* 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");
|
|
|
|
/* Vérifie la connexion */
|
|
if (!$link) {
|
|
printf("Echec de la connexion : %s\n", maxdb_connect_error());
|
|
exit();
|
|
}
|
|
|
|
printf("Informations sur l'hôte : %s\n", maxdb_get_host_info($link));
|
|
|
|
/* Fermeture de la connexion */
|
|
maxdb_close($link);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
Informations sur l'hôte : localhost
|
|
]]>
|
|
</screen>
|
|
</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
|
|
--> |