cvs: phpdoc-fr /reference/mssql/functions mssql-fetch-batch.xml mssql-field-length.xml mssql-field-type.xml mssql-free-result.xml

From: Date: Sun, 01 Feb 2009 13:07:16 +0000
Subject: cvs: phpdoc-fr /reference/mssql/functions mssql-fetch-batch.xml mssql-field-length.xml mssql-field-type.xml mssql-free-result.xml
Groups: php.doc.fr 
Request: Send a blank email to doc-fr+get-6546@lists.php.net to get a copy of this message
dams Sun Feb 1 13:07:16 2009 UTC Modified files: /phpdoc-fr/reference/mssql/functions mssql-fetch-batch.xml mssql-field-length.xml mssql-field-type.xml mssql-free-result.xml Log: synch with en

http://cvs.php.net/viewvc.cgi/phpdoc-fr/reference/mssql/functions/mssql-fetch-batch.xml?r1=1.12&r2=1.13&diff_format=u Index: phpdoc-fr/reference/mssql/functions/mssql-fetch-batch.xml diff -u phpdoc-fr/reference/mssql/functions/mssql-fetch-batch.xml:1.12 phpdoc-fr/reference/mssql/functions/mssql-fetch-batch.xml:1.13 --- phpdoc-fr/reference/mssql/functions/mssql-fetch-batch.xml:1.12 Thu Mar 27 22:35:04 2008 +++ phpdoc-fr/reference/mssql/functions/mssql-fetch-batch.xml Sun Feb 1 13:07:15 2009 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> -<!-- EN-Revision: 1.8 Maintainer: yannick Status: ready --> +<!-- $Revision: 1.13 $ --> +<!-- EN-Revision: 1.10 Maintainer: yannick Status: ready --> <!-- Reviewed: yes --> <refentry xml:id='function.mssql-fetch-batch' xmlns="http://docbook.org/ns/docbook"> @@ -52,17 +52,28 @@ <programlisting role="php"> <![CDATA[ <?php +// Connexion à MSSQL +$link = mssql_connect('MANGO\SQLEXPRESS', 'sa', 'phpfi'); +mssql_select_db('php', $link); + +// Envoi d'une requête +$result = mssql_query('SELECT * FROM [php].[dbo].[people]', $link, 100); +$records = 10; + +while($records >= 0) +{ + while($row = mssql_fetch_assoc($result)) + { + // Traitement + } -$resDb = mssql_connect('localhost', 'user', 'name'); -$result = mssql_query('SELECT * FROM MYTABLE', $resDb, 10000); - -$intNumRows = mssql_num_rows($result); + --$records; +} -while ($intNumRows > 0) { - while ($arrRow = mssql_fetch_assoc($result)) { - // Quelques instructions ... - } - $intNumRows = mssql_fetch_batch($result); +if($batchsize = mssql_fetch_batch($result)) +{ + // $batchsize est le nombre de ligne à lire + // dans le résultat, mais enocre à afficher } ?> ]]> http://cvs.php.net/viewvc.cgi/phpdoc-fr/reference/mssql/functions/mssql-field-length.xml?r1=1.15&r2=1.16&diff_format=u Index: phpdoc-fr/reference/mssql/functions/mssql-field-length.xml diff -u phpdoc-fr/reference/mssql/functions/mssql-field-length.xml:1.15 phpdoc-fr/reference/mssql/functions/mssql-field-length.xml:1.16 --- phpdoc-fr/reference/mssql/functions/mssql-field-length.xml:1.15 Sat Jun 21 20:51:38 2008 +++ phpdoc-fr/reference/mssql/functions/mssql-field-length.xml Sun Feb 1 13:07:15 2009 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.15 $ --> -<!-- EN-Revision: 1.8 Maintainer: yannick Status: ready --> +<!-- $Revision: 1.16 $ --> +<!-- EN-Revision: 1.10 Maintainer: yannick Status: ready --> <!-- Reviewed: yes --> <refentry xml:id="function.mssql-field-length" xmlns="http://docbook.org/ns/docbook"> @@ -14,7 +14,7 @@ <methodsynopsis> <type>int</type><methodname>mssql_field_length</methodname> <methodparam><type>resource</type><parameter>result</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>offset</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>offset</parameter><initializer>-1</initializer></methodparam> </methodsynopsis> <para> Retourne la longueur d'un champ numéro @@ -57,15 +57,48 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Exemple avec <function>mssql_field_length</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Connexion à MSSQL +mssql_connect('MANGO\SQLEXPRESS', 'sa', 'phpfi'); +mssql_select_db('php'); + +// Envoi d'une requête Select +$query = mssql_query('SELECT [name], [age] FROM [php].[dbo].[persons]'); + +// Affichage du type de champ et sa taille +echo 'Le champ \'age\' a la taille de ' . mssql_field_length($query, 1); + +// Free the query result +mssql_free_result($query); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Le champ 'age' a la taille de 4 +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="notes"> &reftitle.notes; <note> <title>Note pour les utilisateurs Windows</title> <para> À cause d'une limitation dans l'API utilisé par PHP (MS DbLib C API), - la longueur des champs VARCHAR est limitée à <emphasis>255</emphasis>. - Si vous avez besoin d'enregistrer plus de données, utilisez un champ - TEXT à la place. + la longueur des champs <literal>VARCHAR</literal> est limitée à + <emphasis>255</emphasis>. Si vous avez besoin d'enregistrer plus + de données, utilisez un champ <literal>TEXT</literal> à la place. </para> </note> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc-fr/reference/mssql/functions/mssql-field-type.xml?r1=1.13&r2=1.14&diff_format=u Index: phpdoc-fr/reference/mssql/functions/mssql-field-type.xml diff -u phpdoc-fr/reference/mssql/functions/mssql-field-type.xml:1.13 phpdoc-fr/reference/mssql/functions/mssql-field-type.xml:1.14 --- phpdoc-fr/reference/mssql/functions/mssql-field-type.xml:1.13 Sat May 24 12:15:58 2008 +++ phpdoc-fr/reference/mssql/functions/mssql-field-type.xml Sun Feb 1 13:07:15 2009 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.13 $ --> -<!-- EN-Revision: 1.7 Maintainer: yannick Status: ready --> +<!-- $Revision: 1.14 $ --> +<!-- EN-Revision: 1.10 Maintainer: yannick Status: ready --> <!-- Reviewed: yes --> <refentry xml:id="function.mssql-field-type" xmlns="http://docbook.org/ns/docbook"> @@ -14,7 +14,7 @@ <methodsynopsis> <type>string</type><methodname>mssql_field_type</methodname> <methodparam><type>resource</type><parameter>result</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>offset</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>offset</parameter><initializer>-1</initializer></methodparam> </methodsynopsis> <para> Retourne le type du champ numéro <parameter>offset</parameter> dans @@ -56,6 +56,41 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Exemple avec <function>mssql_field_type</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Connexion à MSSQL +mssql_connect('MANGO\SQLEXPRESS', 'sa', 'phpfi'); +mssql_select_db('php'); + +// Envoi d'une requête MSSQL +$query = mssql_query('SELECT [name] FROM [php].[dbo].[persons]'); + +// Affiche le type de champ et sa taille +echo '\'' . mssql_field_name($query, 0) . '\' est de type ' . + strtoupper(mssql_field_type($query, 0)) . + '(' . mssql_field_length($query, 0) . ')'; + +// Libère le résultat +mssql_free_result($query); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +'name' est de type CHAR(50) +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc-fr/reference/mssql/functions/mssql-free-result.xml?r1=1.12&r2=1.13&diff_format=u Index: phpdoc-fr/reference/mssql/functions/mssql-free-result.xml diff -u phpdoc-fr/reference/mssql/functions/mssql-free-result.xml:1.12 phpdoc-fr/reference/mssql/functions/mssql-free-result.xml:1.13 --- phpdoc-fr/reference/mssql/functions/mssql-free-result.xml:1.12 Mon Jul 23 19:06:59 2007 +++ phpdoc-fr/reference/mssql/functions/mssql-free-result.xml Sun Feb 1 13:07:15 2009 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> -<!-- EN-Revision: 1.6 Maintainer: yannick Status: ready --> +<!-- $Revision: 1.13 $ --> +<!-- EN-Revision: 1.7 Maintainer: yannick Status: ready --> <!-- Reviewed: yes --> <refentry xml:id="function.mssql-free-result" xmlns="http://docbook.org/ns/docbook"> @@ -48,6 +48,38 @@ &return.success; </para> </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Exemple avec <function>mssql_free_result</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Lit des données depuis une table +$query = mssql_query('SELECT * FROM [php].[dbo].[persons]', $link); + +// Traite le résultat ici + +// Quand on a fini, on libère les ressources occupées +// avec la fonction mssql_free_result +mssql_free_result($query); +]]> + </programlisting> + </example> + </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>mssql_free_statement</function></member> + </simplelist> + </para> + </refsect1> + </refentry> <!-- Keep this comment at the end of the file
« previous php.doc.fr (#6546) next »