mirror of
https://github.com/php/doc-es.git
synced 2026-03-26 08:22:08 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@336633 c90b9560-bf6c-de11-be94-00142212c4b1
134 lines
3.6 KiB
XML
134 lines
3.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 584b64bff5b56cc21a885926127e80ba5749a83d Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="pdo.sqlitecreatecollation" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>PDO::sqliteCreateCollation</refname>
|
|
<refpurpose>
|
|
Registra una función definida por el usuario para emplearla como función de cotejo en sentencias 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>
|
|
Nombre de la función de cotejo de SQL a crear o redefinir.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>callback</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El nombre de una función de PHP o una definida por el usuario para aplicarla como retrollamada, definiendo el comportamiento del cotejamiento. Debería aceptar dos cadenas y devolver lo mismo que strcmp(), es decir, debería devolver -1, 1, o 0 si la primera cadena es anterior en orden, posterior, o es igual a la segunda.
|
|
</para>
|
|
<para>
|
|
Es necesario definir esta función como:
|
|
<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>Ejemplo de <function>PDO::sqliteCreateCollation</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$bd = new PDO('sqlite::memory:');
|
|
$bd->exec("CREATE TABLE test (col1 string)");
|
|
$bd->exec("INSERT INTO test VALUES ('a1')");
|
|
$bd->exec("INSERT INTO test VALUES ('a10')");
|
|
$bd->exec("INSERT INTO test VALUES ('a2')");
|
|
|
|
$bd->sqliteCreateCollation('NATURAL_CMP', 'strnatcmp');
|
|
foreach ($bd->query("SELECT col1 FROM test ORDER BY col1") as $fila) {
|
|
echo $fila['col1'] . "\n";
|
|
}
|
|
echo "\n";
|
|
foreach ($bd->query("SELECT col1 FROM test ORDER BY col1 COLLATE NATURAL_CMP") as $fila) {
|
|
echo $fila['col1'] . "\n";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
a1
|
|
a10
|
|
a2
|
|
|
|
a1
|
|
a2
|
|
a10
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<para>
|
|
Este método no está disponible con el controlador de SQLite2.
|
|
Use la API de sqlite del estilo antiguo en su lugar.
|
|
</para>
|
|
</note>
|
|
</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
|
|
-->
|