CVS update: php3/doc/functions

From: Date: Sun, 09 May 1999 21:34:42 +0000
Subject: CVS update: php3/doc/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5464@lists.php.net to get a copy of this message
Date: Sunday May 9, 1999 @ 17:34 Author: sas Update of /repository/php3/doc/functions In directory php:/tmp/cvs-serv19531 Modified Files: dba.sgml Log Message: cleanup, some examples Index: php3/doc/functions/dba.sgml diff -u php3/doc/functions/dba.sgml:1.1 php3/doc/functions/dba.sgml:1.2 --- php3/doc/functions/dba.sgml:1.1 Sun May 9 16:37:42 1999 +++ php3/doc/functions/dba.sgml Sun May 9 17:34:41 1999 @@ -1,5 +1,5 @@ <reference id="ref.dba"> - <title>dba functions</title> + <title>DBA functions</title> <titleabbrev>dba</titleabbrev> <partintro> @@ -27,11 +27,11 @@ dbm is the oldest (original) type of Berkeley DB style databases. You should avoid it, if possible. We do not support the compatibility functions built into DB2, because they are only compatible on the source - code level, but cannot handle the original db format. + code level, but cannot handle the original dbm format. <listitem><simpara> ndbm is a newer type and more flexible than dbm. It still has most of the - arcane limits of dbm. + arbitrary limits of dbm. <listitem><simpara> gdbm is the <ulink url="&url.gdbm;">GNU database manager</ulink>. It @@ -50,6 +50,58 @@ only reading operations. </itemizedlist> + + <para> + <example> + <title>DBA example</title> + <programlisting> +&lt;?php + +$id = dba_open("/tmp/test.db", "n", "db2"); + +if(!$id) { + echo "dba_open failed\n"; + exit; +} + +dba_replace("key", "This is an example!", $id); + +if(dba_exists("key", $id)) { + echo dba_fetch("key", $id); + dba_delete("key", $id); +} + +dba_close($id); +?&gt; +</programlisting></example> + + <para> + DBA is binary safe and does not have any arbitrary limits. It inherits all + limits set by the underlying database implementation. + + <para> + You can access all entries of a database in a linear way by using the + <function>dba_firstkey</function> and <function>dba_nextkey</function> + functions. You may not change the database while traversing it. + + <para> + <example> + <title>Traversing a database</title> + <programlisting> +&lt;?php + +# ...open database... + +$key = dba_firstkey($id); + +while($key != false) { + if(...) { # remember the key to perform some action later + $handle_later[] = $key; + } + $key = dba_nextkey($id); +} +?&gt; +</programlisting></example> </partintro> -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5464) next »