mirror of
https://github.com/php/doc-es.git
synced 2026-03-25 16:02:13 +01:00
Use consistent line terminator. git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@317671 c90b9560-bf6c-de11-be94-00142212c4b1
103 lines
2.4 KiB
XML
103 lines
2.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: af4410a7e15898c3dbe83d6ea38246745ed9c6fb Maintainer: seros Status: ready -->
|
|
|
|
<chapter xml:id="dba.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
&reftitle.examples;
|
|
<section xml:id="dba.example">
|
|
<title>Uso básico</title>
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de DBA</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$id = dba_open("/tmp/test.db", "n", "db2");
|
|
|
|
if (!$id) {
|
|
echo "Falló dba_open\n";
|
|
exit;
|
|
}
|
|
|
|
dba_replace("key", "¡Este es un ejemplo!", $id);
|
|
|
|
if (dba_exists("key", $id)) {
|
|
echo dba_fetch("key", $id);
|
|
dba_delete("key", $id);
|
|
}
|
|
|
|
dba_close($id);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
DBA es seguro a nivel binario y no tiene límites arbitrarios.
|
|
Sin embargo, hereda todos los límites establecidos por la implementación
|
|
de la base de datos subyacente.
|
|
</para>
|
|
<para>
|
|
Todas las bases de datos basadas en ficheros deben proporcionar una manera de establecer el modo
|
|
de fichero de una nueva base de datos creada, si es posible. El
|
|
modo de fichero se pasa comúnmente como el cuarto argumento a
|
|
<function>dba_open</function> o <function>dba_popen</function>.
|
|
</para>
|
|
<para>
|
|
Se puede acceder a todas las entradas de una base de datos de forma lineal usando las
|
|
funciones <function>dba_firstkey</function> y <function>dba_nextkey</function>.
|
|
No se puede cambiar la base de datos mientras se la atraviesa.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Atravesar una base de datos</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
// ...abrir la base de datos...
|
|
|
|
$clave = dba_firstkey($id);
|
|
|
|
while ($clave != false) {
|
|
if (true) { // recuerde la clave para realizar alguna acción posterior
|
|
$handle_later[] = $clave;
|
|
}
|
|
$clave = dba_nextkey($id);
|
|
}
|
|
|
|
foreach ($handle_later as $val) {
|
|
dba_delete($val, $id);
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</section>
|
|
</chapter>
|
|
|
|
<!-- 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
|
|
-->
|
|
|