mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
new structure
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@79996 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
ab5c971226
commit
5150bed17e
1 changed files with 163 additions and 61 deletions
|
@ -1,10 +1,12 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<reference id="ref.dba">
|
||||
<title>Database (dbm-style) abstraction layer functions</title>
|
||||
<titleabbrev>dba</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
<section id="dba.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
These functions build the foundation for accessing Berkeley DB
|
||||
style databases.
|
||||
|
@ -17,21 +19,16 @@
|
|||
(This is not to be confused with IBM's DB2 software, which is
|
||||
supported through the <link linkend="ref.odbc">ODBC functions</link>.)
|
||||
</para>
|
||||
<para>
|
||||
The behaviour of various aspects depends on the implementation of the
|
||||
underlying database. Functions such as <function>dba_optimize</function>
|
||||
and <function>dba_sync</function> will do what they promise for one
|
||||
database and will do nothing for others.
|
||||
</para>
|
||||
<para>
|
||||
When invoking the <function>dba_open</function> or
|
||||
<function>dba_popen</function> functions, one of the following
|
||||
handler names must be supplied as an argument. The actually
|
||||
available list of handlers is displayed by invoking
|
||||
<function>phpinfo</function>. (To add support for any of the
|
||||
following handlers during the production of PHP, add the
|
||||
specified <literal>--with-XXXX</literal> configure switch to
|
||||
your PHP configure line.)
|
||||
</section>
|
||||
|
||||
<section id="dba.requirements">
|
||||
&reftitle.required;
|
||||
<para>
|
||||
The behaviour of various aspects depends on the implementation of the
|
||||
underlying database. Functions such as <function>dba_optimize</function>
|
||||
and <function>dba_sync</function> will do what they promise for one
|
||||
database and will do nothing for others. You have to download and install
|
||||
supported dba-Handlers.
|
||||
<table>
|
||||
<title>List of DBA handlers</title>
|
||||
<tgroup cols="2">
|
||||
|
@ -43,69 +40,172 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>dbm</literal></entry>
|
||||
<entry><literal>dbm</literal></entry>
|
||||
<entry>
|
||||
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 and gdbm, because
|
||||
they are only compatible on the source code level, but cannot
|
||||
handle the original dbm format. (<literal>--with-dbm</literal>)
|
||||
handle the original dbm format.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal>ndbm</literal></entry>
|
||||
<entry><literal>ndbm</literal></entry>
|
||||
<entry>
|
||||
Ndbm is a newer type and more flexible than dbm. It still has
|
||||
most of the arbitrary limits of dbm (therefore it is
|
||||
deprecated). (<literal>--with-ndbm</literal>)
|
||||
deprecated).
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal>gdbm</literal></entry>
|
||||
<entry><literal>gdbm</literal></entry>
|
||||
<entry>
|
||||
Gdbm is the <ulink url="&url.gdbm;">GNU database
|
||||
manager</ulink>. (<literal>--with-gdbm</literal>)
|
||||
manager</ulink>.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal>db2</literal></entry>
|
||||
<entry><literal>db2</literal></entry>
|
||||
<entry>
|
||||
DB2 is <ulink url="&url.sleepycat;">Sleepycat Software's
|
||||
DB2</ulink>. It is described as "a programmatic toolkit that
|
||||
provides high-performance built-in database support for both
|
||||
standalone and client/server applications." (<literal>--with-db2</literal>)
|
||||
standalone and client/server applications.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal>db3</literal></entry>
|
||||
<entry><literal>db3</literal></entry>
|
||||
<entry>
|
||||
DB3 is <ulink url="&url.sleepycat;">Sleepycat Software's
|
||||
DB3</ulink>. (<literal>--with-db3</literal>)
|
||||
DB3</ulink>.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal>cdb</literal></entry>
|
||||
<entry><literal>cdb</literal></entry>
|
||||
<entry>
|
||||
Cdb is "a fast, reliable, lightweight package for creating and
|
||||
reading constant databases." It is from the author of qmail and
|
||||
can be found <ulink url="&url.cdb;">here</ulink>. Since it is
|
||||
constant, we support only reading operations. (<literal>--with-cdb</literal>)
|
||||
constant, we support only reading operations.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>DBA example</title>
|
||||
<programlisting role="php">
|
||||
</para>
|
||||
<para>
|
||||
When invoking the <function>dba_open</function> or
|
||||
<function>dba_popen</function> functions, one of the
|
||||
handler names must be supplied as an argument. The actually
|
||||
available list of handlers is displayed by invoking
|
||||
<function>phpinfo</function>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="dba.installation">
|
||||
&reftitle.install;
|
||||
<para>
|
||||
By using the <option role="configure">--enable-dba=shared</option>
|
||||
configuration option you can build a dynamic loadable modul to enable PHP
|
||||
for basic support of dbm-style databases. You also have to add support
|
||||
for at least one of the following handlers by specifying the
|
||||
<literal>--with-XXXX</literal> configure switch to your PHP configure
|
||||
line.
|
||||
<table>
|
||||
<title>Supported DBA handlers</title>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Handler</entry>
|
||||
<entry>Configure Switch</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>dbm</literal></entry>
|
||||
<entry>
|
||||
To enable support for dbm add
|
||||
<option role="configure">--with-dbm[=DIR]</option>.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal>ndbm</literal></entry>
|
||||
<entry>
|
||||
To enable support for ndbm add
|
||||
<option role="configure">--with-ndbm[=DIR]</option>.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal>gdbm</literal></entry>
|
||||
<entry>
|
||||
To enable support for gdbm add
|
||||
<option role="configure">--with-gdbm[=DIR]</option>.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal>db2</literal></entry>
|
||||
<entry>
|
||||
To enable support for db2 add
|
||||
<option role="configure">--with-db2[=DIR]</option>.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal>db3</literal></entry>
|
||||
<entry>
|
||||
To enable support for db3 add
|
||||
<option role="configure">--with-db3[=DIR]</option>.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal>cdb</literal></entry>
|
||||
<entry>
|
||||
To enable support for cdb add
|
||||
<option role="configure">--with-cdb[=DIR]</option>.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="dba.runtime">
|
||||
&reftitle.runtime;
|
||||
&no.config;
|
||||
</section>
|
||||
|
||||
<section id="dba.resources">
|
||||
&reftitle.resources;
|
||||
<para>
|
||||
The functions <function>dba_open</function> and
|
||||
<function>dba_popen</function> return a handle to the specified
|
||||
database file to access which is used by all other dba-function calls.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="dba.constants">
|
||||
&reftitle.constants;
|
||||
&no.constants;
|
||||
</section>
|
||||
|
||||
<section id="dba.examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>DBA example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
|
@ -126,38 +226,38 @@ if (dba_exists ("key", $id)) {
|
|||
dba_close ($id);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
DBA is binary safe and does not have any arbitrary limits.
|
||||
However, it inherits all limits set by the underlying
|
||||
database implementation.
|
||||
</para>
|
||||
<para>
|
||||
All file-based databases must provide a way of setting the file
|
||||
mode of a new created database, if that is possible at all. The
|
||||
file mode is commonly passed as the fourth argument to
|
||||
<function>dba_open</function> or <function>dba_popen</function>.
|
||||
</para>
|
||||
<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>
|
||||
<para>
|
||||
<example>
|
||||
<title>Traversing a database</title>
|
||||
<programlisting role="php">
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
DBA is binary safe and does not have any arbitrary limits.
|
||||
However, it inherits all limits set by the underlying
|
||||
database implementation.
|
||||
</para>
|
||||
<para>
|
||||
All file-based databases must provide a way of setting the file
|
||||
mode of a new created database, if that is possible at all. The
|
||||
file mode is commonly passed as the fourth argument to
|
||||
<function>dba_open</function> or <function>dba_popen</function>.
|
||||
</para>
|
||||
<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>
|
||||
<para>
|
||||
<example>
|
||||
<title>Traversing a database</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
# ...open database...
|
||||
// ...open database...
|
||||
|
||||
$key = dba_firstkey ($id);
|
||||
|
||||
while ($key != false) {
|
||||
if (...) { # remember the key to perform some action later
|
||||
if (...) { // remember the key to perform some action later
|
||||
$handle_later[] = $key;
|
||||
}
|
||||
$key = dba_nextkey ($id);
|
||||
|
@ -168,9 +268,11 @@ for ($i = 0; $i < count($handle_later); $i++)
|
|||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</partintro>
|
||||
|
||||
&reference.dba.functions;
|
||||
|
|
Loading…
Reference in a new issue