cvs: phpdoc-fr /reference/pgsql/functions pg-connection-busy.xml pg-connection-status.xml pg-convert.xml pg-delete.xml pg-fetch-object.xml
pg-field-is-null.xml pg-field-name.xml pg-insert.xml pg-meta-data.xml pg-select.xml pg-send-query.xml pg-update.xml
| From: | Damien Seguy | Date: | Wed, 16 Jul 2003 15:18:09 +0000 |
| Subject: | cvs: phpdoc-fr /reference/pgsql/functions pg-connection-busy.xml pg-connection-status.xml pg-convert.xml pg-delete.xml pg-fetch-object.xml pg-field-is-null.xml pg-field-name.xml pg-insert.xml pg-meta-data.xml pg-select.xml pg-send-query.xml pg-update.xml |
||
| Groups: | php.doc.fr | ||
| Request: | Send a blank email to doc-fr+get-646@lists.php.net to get a copy of this message | ||
dams Wed Jul 16 11:18:09 2003 EDT
Modified files:
/phpdoc-fr/reference/pgsql/functions pg-connection-busy.xml
pg-connection-status.xml
pg-convert.xml pg-delete.xml
pg-fetch-object.xml
pg-field-is-null.xml
pg-field-name.xml
pg-insert.xml pg-meta-data.xml
pg-select.xml
pg-send-query.xml
pg-update.xml
Log:
updating docs with latest commits
Index: phpdoc-fr/reference/pgsql/functions/pg-connection-busy.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-connection-busy.xml:1.1 phpdoc-fr/reference/pgsql/functions/pg-connection-busy.xml:1.2 --- phpdoc-fr/reference/pgsql/functions/pg-connection-busy.xml:1.1 Thu Nov 21 21:31:11 2002 +++ phpdoc-fr/reference/pgsql/functions/pg-connection-busy.xml Wed Jul 16 11:18:08 2003 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 --> <refentry id="function.pg-connection-busy"> <refnamediv> <refname>pg_connection_busy</refname> - <refpurpose>Vérifie si la connexion est occupée</refpurpose> + <refpurpose>Vérifie si la connexion PostGreSQL est occupée</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -17,6 +17,25 @@ connexion est occupe. Si elle est occupée, une requête a déjà été lancée, et est en cours. Si <function>pg_get_result</function> est appelé, elle sera alors bloquée. + </para> + <para> + <example> + <title>Exemple avec <function>pg_connection_busy</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbconn = pg_connect("dbname=publisher") or die("Impossible de se connecter"); + $bs = pg_connection_busy($dbconn); + if ($bs) { + echo 'La connexion est occupe'; + } + else { + echo 'La connexion est libre'; + } +?> +]]> + </programlisting> + </example> </para> <para> Voir aussi Index: phpdoc-fr/reference/pgsql/functions/pg-connection-status.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-connection-status.xml:1.1 phpdoc-fr/reference/pgsql/functions/pg-connection-status.xml:1.2 --- phpdoc-fr/reference/pgsql/functions/pg-connection-status.xml:1.1 Thu Nov 21 21:31:11 2002 +++ phpdoc-fr/reference/pgsql/functions/pg-connection-status.xml Wed Jul 16 11:18:08 2003 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 --> <refentry id="function.pg-connection-status"> <refnamediv> <refname>pg_connection_status</refname> - <refpurpose>Lit le statut de la connexion</refpurpose> + <refpurpose>Lit le statut de la connexion PostGreSQL</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -15,8 +15,22 @@ <para> <function>pg_connection_status</function> retourne le statut de la connexion <parameter>connection</parameter>. Les valeurs possibles - sont <literal>PGSQL_CONNECTION_OK</literal> (connexion correcte) et - <literal>PGSQL_CONNECTION_BAD</literal> (connexion abandonnée). + sont <constant>PGSQL_CONNECTION_OK</constant> (connexion correcte) et + <constant>PGSQL_CONNECTION_BAD</constant> (connexion abandonnée). + </para> + <para> + <example> + <title>Exemple avec <function>pg_connection_status</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbconn = pg_connect("dbname=publisher") or die("Impossible de se connecter"); + $stat = pg_connection_status($dbconn); + echo 'Etat de la connexion : '.$stat; +?> +]]> + </programlisting> + </example> </para> <para> Voir aussi Index: phpdoc-fr/reference/pgsql/functions/pg-convert.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-convert.xml:1.2 phpdoc-fr/reference/pgsql/functions/pg-convert.xml:1.3 --- phpdoc-fr/reference/pgsql/functions/pg-convert.xml:1.2 Fri Jun 13 12:20:36 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-convert.xml Wed Jul 16 11:18:08 2003 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 --> <refentry id="function.pg-convert"> <refnamediv> <refname>pg_convert</refname> - <refpurpose>Convertit un tableau associatif en une commande SQL</refpurpose> + <refpurpose>Convertit un tableau associatif en une commande PostGreSQL</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -18,7 +18,15 @@ <para> <function>pg_convert</function> vérifie et convertit le tableau associatif <literal>assoc_array</literal> en une requête SQL valide. + Pour que <function>pg_convert</function> fonctionne, il faut que la table + <literal>table_name</literal> existe, et contienne au moins autant de colonnes + que le tableau <parameter>assoc_array</parameter> a d'lments. Les noms des + champs de <parameter>table_name</parameter> doit correspondre aux index + du tableau <literal>assoc_array</literal>. <function>pg_convert</function> + retourne un tableau avec les valeurs converties, en cas de succs, et sinon, + &false;. </para> + &warn.experimental.func; <para> Voir aussi <function>pg_meta_data</function>. Index: phpdoc-fr/reference/pgsql/functions/pg-delete.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-delete.xml:1.3 phpdoc-fr/reference/pgsql/functions/pg-delete.xml:1.4 --- phpdoc-fr/reference/pgsql/functions/pg-delete.xml:1.3 Fri Jun 20 13:25:56 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-delete.xml Wed Jul 16 11:18:08 2003 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 --> <refentry id="function.pg-delete"> <refnamediv> <refname>pg_delete</refname> - <refpurpose>Efface des lignes</refpurpose> + <refpurpose>Efface des lignes PostGreSQL</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -41,6 +41,7 @@ ]]> </programlisting> </example> + &warn.experimental.func; <para> Voir aussi <function>pg_convert</function>. Index: phpdoc-fr/reference/pgsql/functions/pg-fetch-object.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-fetch-object.xml:1.2 phpdoc-fr/reference/pgsql/functions/pg-fetch-object.xml:1.3 --- phpdoc-fr/reference/pgsql/functions/pg-fetch-object.xml:1.2 Fri Jun 13 12:20:36 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-fetch-object.xml Wed Jul 16 11:18:08 2003 @@ -93,13 +93,6 @@ </programlisting> </example> </para> - <para> - Voir aussi - <function>pg_query</function>, - <function>pg_fetch_array</function>, - <function>pg_fetch_row</function> et - <function>pg_fetch_result</function>. - </para> <note> <para> Depuis 4.1.0, <parameter>row</parameter> est devenu optionnel. @@ -107,6 +100,14 @@ le pointeur interne de 1. </para> </note> + <para> + Voir aussi + <function>pg_query</function>, + <function>pg_fetch_array</function>, + <function>pg_fetch_assoc</function>, + <function>pg_fetch_row</function> et + <function>pg_fetch_result</function>. + </para> </refsect1> </refentry> Index: phpdoc-fr/reference/pgsql/functions/pg-field-is-null.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-field-is-null.xml:1.5 phpdoc-fr/reference/pgsql/functions/pg-field-is-null.xml:1.6 --- phpdoc-fr/reference/pgsql/functions/pg-field-is-null.xml:1.5 Fri Jun 20 13:25:56 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-field-is-null.xml Wed Jul 16 11:18:08 2003 @@ -21,6 +21,27 @@ à &null;. Le champ peut être identifié avec son nom ou son index numérique (commençant à 0). </para> + <para> + <example> + <title>Exemple avec <function>pg_field_is_null</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbconn = pg_connect("dbname=publisher") or die ("Impossible de se connecter"); + $res = pg_query($dbconn, "select * from authors where author = 'Orwell'"); + if ($res) { + if (pg_field_is_null($res, 0, "annee") == 1) { + echo "La valeur du champs \"annee\" est null.\n"; + } + if (pg_field_is_null($res, 0, "year") == 0) { + echo "La valeur du champs \"annee\" n'est pas null.\n"; + } + } +?> +]]> + </programlisting> + </example> + </para> <note> <para> Auparavant, cette fonction s'appelait <literal>pg_fieldisnull()</literal>. Index: phpdoc-fr/reference/pgsql/functions/pg-field-name.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-field-name.xml:1.4 phpdoc-fr/reference/pgsql/functions/pg-field-name.xml:1.5 --- phpdoc-fr/reference/pgsql/functions/pg-field-name.xml:1.4 Fri Jun 20 13:25:56 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-field-name.xml Wed Jul 16 11:18:08 2003 @@ -19,6 +19,53 @@ résultat <parameter>result</parameter>. La numérotation des champs commence à 0. </para> + <para> + <example> + <title>Lire des informations sur les champs PostGreSQL</title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbconn = pg_connect("dbname=publisher") or die("Impossible de se connecter"); + + $res = pg_query($dbconn, "select * from authors where author = 'Orwell'"); + $i = pg_num_fields($res); + for ($j = 0; $j < $i; $j++) { + echo "column $j\n"; + $fieldname = pg_field_name($res, $j); + echo "Champ : $fieldname\n"; + echo "Taille affiche : ".pg_field_prtlen($res, $fieldname)." characters\n"; + echo "Taille de stockage : ".pg_field_size($res, $j)." bytes\n"; + echo "Type de champ : ".pg_field_type($res, $j)." \n\n"; +} +?> +]]> + </programlisting> + <para> + The above example would produce the following output: + </para> + <screen> +<![CDATA[ +column 0 +Champ : author +Taille affiche : 6 characters +Taille de stockage : -1 bytes +Type de champ : varchar + +column 1 +Champ : year +Taille affiche : 4 characters +Taille de stockage : 2 bytes +Type de champ : int2 + +column 2 +Champ : title +Taille affiche : 24 characters +Taille de stockage : -1 bytes +Type de champ : varchar +]]> + </screen> + </example> + </para> <note> <para> Auparavant, cette fonction s'appelait <literal>pg_fieldname()</literal>. Index: phpdoc-fr/reference/pgsql/functions/pg-insert.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-insert.xml:1.3 phpdoc-fr/reference/pgsql/functions/pg-insert.xml:1.4 --- phpdoc-fr/reference/pgsql/functions/pg-insert.xml:1.3 Fri Jun 20 13:25:56 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-insert.xml Wed Jul 16 11:18:08 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 --> <refentry id="function.pg-insert"> <refnamediv> @@ -17,10 +17,15 @@ </methodsynopsis> <para> <function>pg_insert</function> insère le tableau - <literal>assoc_array</literal> (bâtit sur le modèle - <literal>champ=>valeur</literal> dans la table <literal>table_name</literal>. - Si <literal>options</literal> est spécifié, <function>pg_convert</function> - est appliqué à <literal>assoc_array</literal> avec cette option. + <parameter>assoc_array</parameter> (bâtit sur le modèle + <parameter>champ=>valeur</parameter> dans la table <parameter>table_name</parameter>. + Si <parameter>options</parameter> est spécifié, + <function>pg_convert</function> est appliqué à + <parameter>assoc_array</parameter> avec cette option. + &return.success; + Si <parameter>options</parameter> est spcifie, + <function>pg_insert</function> s'applique + <parameter>assoc_array</parameter> avec l'option spcifie. </para> <example> <title>Exemple avec <function>pg_insert</function></title> @@ -40,6 +45,7 @@ ]]> </programlisting> </example> + &warn.experimental.func; <para> Voir aussi <function>pg_convert</function>. Index: phpdoc-fr/reference/pgsql/functions/pg-meta-data.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-meta-data.xml:1.2 phpdoc-fr/reference/pgsql/functions/pg-meta-data.xml:1.3 --- phpdoc-fr/reference/pgsql/functions/pg-meta-data.xml:1.2 Fri Jun 13 12:20:36 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-meta-data.xml Wed Jul 16 11:18:08 2003 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 --> <refentry id="function.pg-meta-data"> <refnamediv> <refname>pg_meta_data</refname> - <refpurpose>Lit les données méta de la table</refpurpose> + <refpurpose>Lit les données méta de la table PostGreSQL</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -18,6 +18,74 @@ <literal>table_name</literal> sous forme de tableau. Si une erreur survient, <function>pg_meta_data</function> retourne &false;. </para> + <para> + <example> + <title>Lire les mta-donnes d'une table PostGreSQL</title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbconn = pg_connect("dbname=publisher") or die("Impossible de se connecter"); + + $meta = pg_meta_data($dbconn,'authors'); + if (is_array ($meta)) { + echo '<pre>'; + var_dump ($meta); + echo '</pre>'; + } +?> +]]> + </programlisting> + <para> + L'exemple ci-dessus pourrait afficher : + </para> + <screen> +<![CDATA[ +array(3) { + ["author"]=> + array(5) { + ["num"]=> + int(1) + ["type"]=> + string(7) "varchar" + ["len"]=> + int(-1) + ["not null"]=> + bool(false) + ["has default"]=> + bool(false) + } + ["year"]=> + array(5) { + ["num"]=> + int(2) + ["type"]=> + string(4) "int2" + ["len"]=> + int(2) + ["not null"]=> + bool(false) + ["has default"]=> + bool(false) + } + ["title"]=> + array(5) { + ["num"]=> + int(3) + ["type"]=> + string(7) "varchar" + ["len"]=> + int(-1) + ["not null"]=> + bool(false) + ["has default"]=> + bool(false) + } +} +]]> + </screen> + </example> + </para> + &warn.experimental.func; <para> Voir aussi <function>pg_convert</function>. Index: phpdoc-fr/reference/pgsql/functions/pg-select.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-select.xml:1.3 phpdoc-fr/reference/pgsql/functions/pg-select.xml:1.4 --- phpdoc-fr/reference/pgsql/functions/pg-select.xml:1.3 Fri Jun 20 13:25:56 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-select.xml Wed Jul 16 11:18:08 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 --> <refentry id="function.pg-select"> <refnamediv> @@ -45,6 +45,7 @@ ]]> </programlisting> </example> + &warn.experimental.func; <para> Voir aussi <function>pg_convert</function>. Index: phpdoc-fr/reference/pgsql/functions/pg-send-query.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-send-query.xml:1.2 phpdoc-fr/reference/pgsql/functions/pg-send-query.xml:1.3 --- phpdoc-fr/reference/pgsql/functions/pg-send-query.xml:1.2 Thu Jun 12 13:09:47 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-send-query.xml Wed Jul 16 11:18:08 2003 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 --> <refentry id="function.pg-send-query"> <refnamediv> <refname>pg_send_query</refname> - <refpurpose>Exécute une requête asynchrone</refpurpose> + <refpurpose>Exécute une requête PostGreSQL asynchrone</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -33,6 +33,44 @@ il n'est pas possible d'envoyer plusieurs requêtes sur une connexion occupée. Si une requête est envoyée alors que la connexion est occupée, elle attendra que la requête précédente soit finie. + </para> + <para> + <example> + <title>Excute une requte PostGreSQL asynchrone</title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbconn = pg_connect("dbname=publisher") or die("Impossible de se connecter"); + + if (!pg_connection_busy($dbconn)) { + pg_send_query($dbconn,"select * from authors; select count(*) from authors;"); + } + + $res1 = pg_get_result($dbconn); + echo "Premier appel pg_get_result() : $res1\n"; + $rows1 = pg_num_rows($res1); + echo "$res1 has $rows1 records\n\n"; + + $res2 = pg_get_result($dbconn); + echo "Second appel pg_get_result() : $res2\n"; + $rows2 = pg_num_rows($res2); + echo "$res2 has $rows2 records\n"; +?> +]]> + </programlisting> + <para> + L'exemple ci-dessus pourrait afficher : + </para> + <screen> +<![CDATA[ +Premier appel pg_get_result() : Resource id #3 +Resource id #3 has 3 records + +Second appel pg_get_result() : Resource id #4 +Resource id #4 has 1 records +]]> + </screen> + </example> </para> <para> Voir aussi Index: phpdoc-fr/reference/pgsql/functions/pg-update.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-update.xml:1.2 phpdoc-fr/reference/pgsql/functions/pg-update.xml:1.3 --- phpdoc-fr/reference/pgsql/functions/pg-update.xml:1.2 Fri Jun 13 12:20:36 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-update.xml Wed Jul 16 11:18:08 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 --> <refentry id="function.pg-update"> <refnamediv> @@ -43,6 +43,7 @@ ]]> </programlisting> </example> + &warn.experimental.func; <para> Voir aussi <function>pg_convert</function>.
Index: phpdoc-fr/reference/pgsql/functions/pg-connection-busy.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-connection-busy.xml:1.1 phpdoc-fr/reference/pgsql/functions/pg-connection-busy.xml:1.2 --- phpdoc-fr/reference/pgsql/functions/pg-connection-busy.xml:1.1 Thu Nov 21 21:31:11 2002 +++ phpdoc-fr/reference/pgsql/functions/pg-connection-busy.xml Wed Jul 16 11:18:08 2003 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 --> <refentry id="function.pg-connection-busy"> <refnamediv> <refname>pg_connection_busy</refname> - <refpurpose>Vérifie si la connexion est occupée</refpurpose> + <refpurpose>Vérifie si la connexion PostGreSQL est occupée</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -17,6 +17,25 @@ connexion est occupe. Si elle est occupée, une requête a déjà été lancée, et est en cours. Si <function>pg_get_result</function> est appelé, elle sera alors bloquée. + </para> + <para> + <example> + <title>Exemple avec <function>pg_connection_busy</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbconn = pg_connect("dbname=publisher") or die("Impossible de se connecter"); + $bs = pg_connection_busy($dbconn); + if ($bs) { + echo 'La connexion est occupe'; + } + else { + echo 'La connexion est libre'; + } +?> +]]> + </programlisting> + </example> </para> <para> Voir aussi Index: phpdoc-fr/reference/pgsql/functions/pg-connection-status.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-connection-status.xml:1.1 phpdoc-fr/reference/pgsql/functions/pg-connection-status.xml:1.2 --- phpdoc-fr/reference/pgsql/functions/pg-connection-status.xml:1.1 Thu Nov 21 21:31:11 2002 +++ phpdoc-fr/reference/pgsql/functions/pg-connection-status.xml Wed Jul 16 11:18:08 2003 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 --> <refentry id="function.pg-connection-status"> <refnamediv> <refname>pg_connection_status</refname> - <refpurpose>Lit le statut de la connexion</refpurpose> + <refpurpose>Lit le statut de la connexion PostGreSQL</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -15,8 +15,22 @@ <para> <function>pg_connection_status</function> retourne le statut de la connexion <parameter>connection</parameter>. Les valeurs possibles - sont <literal>PGSQL_CONNECTION_OK</literal> (connexion correcte) et - <literal>PGSQL_CONNECTION_BAD</literal> (connexion abandonnée). + sont <constant>PGSQL_CONNECTION_OK</constant> (connexion correcte) et + <constant>PGSQL_CONNECTION_BAD</constant> (connexion abandonnée). + </para> + <para> + <example> + <title>Exemple avec <function>pg_connection_status</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbconn = pg_connect("dbname=publisher") or die("Impossible de se connecter"); + $stat = pg_connection_status($dbconn); + echo 'Etat de la connexion : '.$stat; +?> +]]> + </programlisting> + </example> </para> <para> Voir aussi Index: phpdoc-fr/reference/pgsql/functions/pg-convert.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-convert.xml:1.2 phpdoc-fr/reference/pgsql/functions/pg-convert.xml:1.3 --- phpdoc-fr/reference/pgsql/functions/pg-convert.xml:1.2 Fri Jun 13 12:20:36 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-convert.xml Wed Jul 16 11:18:08 2003 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 --> <refentry id="function.pg-convert"> <refnamediv> <refname>pg_convert</refname> - <refpurpose>Convertit un tableau associatif en une commande SQL</refpurpose> + <refpurpose>Convertit un tableau associatif en une commande PostGreSQL</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -18,7 +18,15 @@ <para> <function>pg_convert</function> vérifie et convertit le tableau associatif <literal>assoc_array</literal> en une requête SQL valide. + Pour que <function>pg_convert</function> fonctionne, il faut que la table + <literal>table_name</literal> existe, et contienne au moins autant de colonnes + que le tableau <parameter>assoc_array</parameter> a d'lments. Les noms des + champs de <parameter>table_name</parameter> doit correspondre aux index + du tableau <literal>assoc_array</literal>. <function>pg_convert</function> + retourne un tableau avec les valeurs converties, en cas de succs, et sinon, + &false;. </para> + &warn.experimental.func; <para> Voir aussi <function>pg_meta_data</function>. Index: phpdoc-fr/reference/pgsql/functions/pg-delete.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-delete.xml:1.3 phpdoc-fr/reference/pgsql/functions/pg-delete.xml:1.4 --- phpdoc-fr/reference/pgsql/functions/pg-delete.xml:1.3 Fri Jun 20 13:25:56 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-delete.xml Wed Jul 16 11:18:08 2003 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 --> <refentry id="function.pg-delete"> <refnamediv> <refname>pg_delete</refname> - <refpurpose>Efface des lignes</refpurpose> + <refpurpose>Efface des lignes PostGreSQL</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -41,6 +41,7 @@ ]]> </programlisting> </example> + &warn.experimental.func; <para> Voir aussi <function>pg_convert</function>. Index: phpdoc-fr/reference/pgsql/functions/pg-fetch-object.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-fetch-object.xml:1.2 phpdoc-fr/reference/pgsql/functions/pg-fetch-object.xml:1.3 --- phpdoc-fr/reference/pgsql/functions/pg-fetch-object.xml:1.2 Fri Jun 13 12:20:36 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-fetch-object.xml Wed Jul 16 11:18:08 2003 @@ -93,13 +93,6 @@ </programlisting> </example> </para> - <para> - Voir aussi - <function>pg_query</function>, - <function>pg_fetch_array</function>, - <function>pg_fetch_row</function> et - <function>pg_fetch_result</function>. - </para> <note> <para> Depuis 4.1.0, <parameter>row</parameter> est devenu optionnel. @@ -107,6 +100,14 @@ le pointeur interne de 1. </para> </note> + <para> + Voir aussi + <function>pg_query</function>, + <function>pg_fetch_array</function>, + <function>pg_fetch_assoc</function>, + <function>pg_fetch_row</function> et + <function>pg_fetch_result</function>. + </para> </refsect1> </refentry> Index: phpdoc-fr/reference/pgsql/functions/pg-field-is-null.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-field-is-null.xml:1.5 phpdoc-fr/reference/pgsql/functions/pg-field-is-null.xml:1.6 --- phpdoc-fr/reference/pgsql/functions/pg-field-is-null.xml:1.5 Fri Jun 20 13:25:56 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-field-is-null.xml Wed Jul 16 11:18:08 2003 @@ -21,6 +21,27 @@ à &null;. Le champ peut être identifié avec son nom ou son index numérique (commençant à 0). </para> + <para> + <example> + <title>Exemple avec <function>pg_field_is_null</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbconn = pg_connect("dbname=publisher") or die ("Impossible de se connecter"); + $res = pg_query($dbconn, "select * from authors where author = 'Orwell'"); + if ($res) { + if (pg_field_is_null($res, 0, "annee") == 1) { + echo "La valeur du champs \"annee\" est null.\n"; + } + if (pg_field_is_null($res, 0, "year") == 0) { + echo "La valeur du champs \"annee\" n'est pas null.\n"; + } + } +?> +]]> + </programlisting> + </example> + </para> <note> <para> Auparavant, cette fonction s'appelait <literal>pg_fieldisnull()</literal>. Index: phpdoc-fr/reference/pgsql/functions/pg-field-name.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-field-name.xml:1.4 phpdoc-fr/reference/pgsql/functions/pg-field-name.xml:1.5 --- phpdoc-fr/reference/pgsql/functions/pg-field-name.xml:1.4 Fri Jun 20 13:25:56 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-field-name.xml Wed Jul 16 11:18:08 2003 @@ -19,6 +19,53 @@ résultat <parameter>result</parameter>. La numérotation des champs commence à 0. </para> + <para> + <example> + <title>Lire des informations sur les champs PostGreSQL</title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbconn = pg_connect("dbname=publisher") or die("Impossible de se connecter"); + + $res = pg_query($dbconn, "select * from authors where author = 'Orwell'"); + $i = pg_num_fields($res); + for ($j = 0; $j < $i; $j++) { + echo "column $j\n"; + $fieldname = pg_field_name($res, $j); + echo "Champ : $fieldname\n"; + echo "Taille affiche : ".pg_field_prtlen($res, $fieldname)." characters\n"; + echo "Taille de stockage : ".pg_field_size($res, $j)." bytes\n"; + echo "Type de champ : ".pg_field_type($res, $j)." \n\n"; +} +?> +]]> + </programlisting> + <para> + The above example would produce the following output: + </para> + <screen> +<![CDATA[ +column 0 +Champ : author +Taille affiche : 6 characters +Taille de stockage : -1 bytes +Type de champ : varchar + +column 1 +Champ : year +Taille affiche : 4 characters +Taille de stockage : 2 bytes +Type de champ : int2 + +column 2 +Champ : title +Taille affiche : 24 characters +Taille de stockage : -1 bytes +Type de champ : varchar +]]> + </screen> + </example> + </para> <note> <para> Auparavant, cette fonction s'appelait <literal>pg_fieldname()</literal>. Index: phpdoc-fr/reference/pgsql/functions/pg-insert.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-insert.xml:1.3 phpdoc-fr/reference/pgsql/functions/pg-insert.xml:1.4 --- phpdoc-fr/reference/pgsql/functions/pg-insert.xml:1.3 Fri Jun 20 13:25:56 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-insert.xml Wed Jul 16 11:18:08 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 --> <refentry id="function.pg-insert"> <refnamediv> @@ -17,10 +17,15 @@ </methodsynopsis> <para> <function>pg_insert</function> insère le tableau - <literal>assoc_array</literal> (bâtit sur le modèle - <literal>champ=>valeur</literal> dans la table <literal>table_name</literal>. - Si <literal>options</literal> est spécifié, <function>pg_convert</function> - est appliqué à <literal>assoc_array</literal> avec cette option. + <parameter>assoc_array</parameter> (bâtit sur le modèle + <parameter>champ=>valeur</parameter> dans la table <parameter>table_name</parameter>. + Si <parameter>options</parameter> est spécifié, + <function>pg_convert</function> est appliqué à + <parameter>assoc_array</parameter> avec cette option. + &return.success; + Si <parameter>options</parameter> est spcifie, + <function>pg_insert</function> s'applique + <parameter>assoc_array</parameter> avec l'option spcifie. </para> <example> <title>Exemple avec <function>pg_insert</function></title> @@ -40,6 +45,7 @@ ]]> </programlisting> </example> + &warn.experimental.func; <para> Voir aussi <function>pg_convert</function>. Index: phpdoc-fr/reference/pgsql/functions/pg-meta-data.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-meta-data.xml:1.2 phpdoc-fr/reference/pgsql/functions/pg-meta-data.xml:1.3 --- phpdoc-fr/reference/pgsql/functions/pg-meta-data.xml:1.2 Fri Jun 13 12:20:36 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-meta-data.xml Wed Jul 16 11:18:08 2003 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 --> <refentry id="function.pg-meta-data"> <refnamediv> <refname>pg_meta_data</refname> - <refpurpose>Lit les données méta de la table</refpurpose> + <refpurpose>Lit les données méta de la table PostGreSQL</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -18,6 +18,74 @@ <literal>table_name</literal> sous forme de tableau. Si une erreur survient, <function>pg_meta_data</function> retourne &false;. </para> + <para> + <example> + <title>Lire les mta-donnes d'une table PostGreSQL</title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbconn = pg_connect("dbname=publisher") or die("Impossible de se connecter"); + + $meta = pg_meta_data($dbconn,'authors'); + if (is_array ($meta)) { + echo '<pre>'; + var_dump ($meta); + echo '</pre>'; + } +?> +]]> + </programlisting> + <para> + L'exemple ci-dessus pourrait afficher : + </para> + <screen> +<![CDATA[ +array(3) { + ["author"]=> + array(5) { + ["num"]=> + int(1) + ["type"]=> + string(7) "varchar" + ["len"]=> + int(-1) + ["not null"]=> + bool(false) + ["has default"]=> + bool(false) + } + ["year"]=> + array(5) { + ["num"]=> + int(2) + ["type"]=> + string(4) "int2" + ["len"]=> + int(2) + ["not null"]=> + bool(false) + ["has default"]=> + bool(false) + } + ["title"]=> + array(5) { + ["num"]=> + int(3) + ["type"]=> + string(7) "varchar" + ["len"]=> + int(-1) + ["not null"]=> + bool(false) + ["has default"]=> + bool(false) + } +} +]]> + </screen> + </example> + </para> + &warn.experimental.func; <para> Voir aussi <function>pg_convert</function>. Index: phpdoc-fr/reference/pgsql/functions/pg-select.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-select.xml:1.3 phpdoc-fr/reference/pgsql/functions/pg-select.xml:1.4 --- phpdoc-fr/reference/pgsql/functions/pg-select.xml:1.3 Fri Jun 20 13:25:56 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-select.xml Wed Jul 16 11:18:08 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 --> <refentry id="function.pg-select"> <refnamediv> @@ -45,6 +45,7 @@ ]]> </programlisting> </example> + &warn.experimental.func; <para> Voir aussi <function>pg_convert</function>. Index: phpdoc-fr/reference/pgsql/functions/pg-send-query.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-send-query.xml:1.2 phpdoc-fr/reference/pgsql/functions/pg-send-query.xml:1.3 --- phpdoc-fr/reference/pgsql/functions/pg-send-query.xml:1.2 Thu Jun 12 13:09:47 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-send-query.xml Wed Jul 16 11:18:08 2003 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 --> <refentry id="function.pg-send-query"> <refnamediv> <refname>pg_send_query</refname> - <refpurpose>Exécute une requête asynchrone</refpurpose> + <refpurpose>Exécute une requête PostGreSQL asynchrone</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -33,6 +33,44 @@ il n'est pas possible d'envoyer plusieurs requêtes sur une connexion occupée. Si une requête est envoyée alors que la connexion est occupée, elle attendra que la requête précédente soit finie. + </para> + <para> + <example> + <title>Excute une requte PostGreSQL asynchrone</title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbconn = pg_connect("dbname=publisher") or die("Impossible de se connecter"); + + if (!pg_connection_busy($dbconn)) { + pg_send_query($dbconn,"select * from authors; select count(*) from authors;"); + } + + $res1 = pg_get_result($dbconn); + echo "Premier appel pg_get_result() : $res1\n"; + $rows1 = pg_num_rows($res1); + echo "$res1 has $rows1 records\n\n"; + + $res2 = pg_get_result($dbconn); + echo "Second appel pg_get_result() : $res2\n"; + $rows2 = pg_num_rows($res2); + echo "$res2 has $rows2 records\n"; +?> +]]> + </programlisting> + <para> + L'exemple ci-dessus pourrait afficher : + </para> + <screen> +<![CDATA[ +Premier appel pg_get_result() : Resource id #3 +Resource id #3 has 3 records + +Second appel pg_get_result() : Resource id #4 +Resource id #4 has 1 records +]]> + </screen> + </example> </para> <para> Voir aussi Index: phpdoc-fr/reference/pgsql/functions/pg-update.xml diff -u phpdoc-fr/reference/pgsql/functions/pg-update.xml:1.2 phpdoc-fr/reference/pgsql/functions/pg-update.xml:1.3 --- phpdoc-fr/reference/pgsql/functions/pg-update.xml:1.2 Fri Jun 13 12:20:36 2003 +++ phpdoc-fr/reference/pgsql/functions/pg-update.xml Wed Jul 16 11:18:08 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 --> <refentry id="function.pg-update"> <refnamediv> @@ -43,6 +43,7 @@ ]]> </programlisting> </example> + &warn.experimental.func; <para> Voir aussi <function>pg_convert</function>.