mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-24 17:02:18 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@350976 c90b9560-bf6c-de11-be94-00142212c4b1
128 lines
3.5 KiB
XML
128 lines
3.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 8d1ee58c3e2221d58050f162ec909cbe6d00cbaf Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
<refentry xml:id="pdo.sqlitecreatecollation" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>PDO::sqliteCreateCollation</refname>
|
|
<refpurpose>
|
|
Enregistre une fonction PHP ou définie par l'utilisateur pour l'utiliser comme une fonction de collecte dans les requêtes SQL.
|
|
</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>bool</type><methodname>PDO::sqliteCreateCollation</methodname>
|
|
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
|
<methodparam><type>callable</type><parameter>callback</parameter></methodparam>
|
|
</methodsynopsis>
|
|
&warn.experimental.func;
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>name</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Nom de la fonction de collecte SQL à créer ou à re-définir
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>callback</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le nom d'une fonction PHP ou définie par l'utilisateur à appliquer comme fonction de
|
|
rappel, définissant le comportement de la collecte. Elle doit accepter deux chaînes et
|
|
retourner comme le fait la fonction strcmp(), i.e. elle doit retourner
|
|
-1, 1, ou 0 si la première chaîne trie avant, après ou pareil que la seconde.
|
|
</para>
|
|
<para>
|
|
Cette fonction doit être définie comme ceci :
|
|
<methodsynopsis>
|
|
<type>int</type><methodname><replaceable>collation</replaceable></methodname>
|
|
<methodparam><type>string</type><parameter>string1</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>string2</parameter></methodparam>
|
|
</methodsynopsis>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>PDO::sqliteCreateCollation</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$db = new PDO('sqlite::memory:');
|
|
$db->exec("CREATE TABLE test (col1 string)");
|
|
$db->exec("INSERT INTO test VALUES ('a1')");
|
|
$db->exec("INSERT INTO test VALUES ('a10')");
|
|
$db->exec("INSERT INTO test VALUES ('a2')");
|
|
|
|
$db->sqliteCreateCollation('NATURAL_CMP', 'strnatcmp');
|
|
foreach ($db->query("SELECT col1 FROM test ORDER BY col1") as $row) {
|
|
echo $row['col1'] . "\n";
|
|
}
|
|
echo "\n";
|
|
foreach ($db->query("SELECT col1 FROM test ORDER BY col1 COLLATE NATURAL_CMP") as $row) {
|
|
echo $row['col1'] . "\n";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
a1
|
|
a10
|
|
a2
|
|
|
|
a1
|
|
a2
|
|
a10
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</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
|
|
-->
|