mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Some cosmetic changes.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@18807 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
535988bf7d
commit
61c85ff417
1 changed files with 158 additions and 112 deletions
|
@ -5,11 +5,13 @@
|
|||
<partintro>
|
||||
<simpara>
|
||||
These functions allow you to access records stored in dBase-format
|
||||
(dbf) databases.</simpara>
|
||||
(dbf) databases.
|
||||
</simpara>
|
||||
<simpara>
|
||||
There is no support for indexes or memo fields. There is no support
|
||||
for locking, too. Two concurrent webserver processes modifying the
|
||||
same dBase file will very likely ruin your database.</simpara>
|
||||
There is no support for indexes or memo fields. There is no
|
||||
support for locking, too. Two concurrent webserver processes
|
||||
modifying the same dBase file will very likely ruin your database.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Unlike SQL databases, dBase "databases" cannot change the database
|
||||
definition afterwards. Once the file is created, the database
|
||||
|
@ -17,21 +19,23 @@
|
|||
otherwise organize your data. dBase files are simple sequential
|
||||
files of fixed length records. Records are appended to the end of
|
||||
the file and delete records are kept until you call
|
||||
<function>dbase_pack()</function>.</simpara>
|
||||
<function>dbase_pack()</function>.
|
||||
</simpara>
|
||||
<simpara>
|
||||
We recommend that you do not use dBase files as your production
|
||||
database. Choose any real SQL server instead; MySQL or Postgres
|
||||
are common choices with PHP. dBase support is here to allow you
|
||||
to import and export data to and from your web database, since the
|
||||
file format is commonly understood with Windows spreadsheets
|
||||
and organizers. Import and export of data is about all that
|
||||
dBase support is good for.</simpara>
|
||||
are common choices with PHP. dBase support is here to allow you to
|
||||
import and export data to and from your web database, since the
|
||||
file format is commonly understood with Windows spreadsheets and
|
||||
organizers. Import and export of data is about all that dBase
|
||||
support is good for.
|
||||
</simpara>
|
||||
</partintro>
|
||||
|
||||
<refentry id="function.dbase-create">
|
||||
<refnamediv>
|
||||
<refname>dbase_create</refname>
|
||||
<refpurpose>creates a dBase database</refpurpose>
|
||||
<refpurpose>Creates a dBase database</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
@ -41,49 +45,65 @@
|
|||
<paramdef>array <parameter>fields</parameter></paramdef>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
The <parameter>fields</parameter> parameter is an array of
|
||||
arrays, each array describing the format of one field in the
|
||||
database. Each field consists of a name, a character
|
||||
indicating the field type, a length, and a precision.</para>
|
||||
<para>
|
||||
The types of fields available are:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>L</term>
|
||||
<listitem><simpara>
|
||||
Boolean. These do not have a length or precision.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>M</term>
|
||||
<listitem><simpara>
|
||||
Memo. (Note that these aren't supported by PHP.)
|
||||
These do not have a length or precision.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>D</term>
|
||||
<listitem><simpara>
|
||||
Date (stored as YYYYMMDD). These do not have a length
|
||||
or precision.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>N</term>
|
||||
<listitem><simpara>
|
||||
Number. These have both a length and a precision (the
|
||||
number of digits after the decimal point).</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>C</term>
|
||||
<listitem><simpara>
|
||||
String.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist></para>
|
||||
<para>
|
||||
If the database is successfully created, a dbase_identifier
|
||||
is returned, otherwise false is returned.
|
||||
|
||||
The <parameter>fields</parameter> parameter is an array of
|
||||
arrays, each array describing the format of one field in the
|
||||
database. Each field consists of a name, a character indicating
|
||||
the field type, a length, and a precision.
|
||||
</para>
|
||||
<para>
|
||||
The types of fields available are:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>L</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Boolean. These do not have a length or precision.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>M</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Memo. (Note that these aren't supported by PHP.) These do
|
||||
not have a length or precision.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>D</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Date (stored as YYYYMMDD). These do not have a length or
|
||||
precision.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>N</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Number. These have both a length and a precision (the number
|
||||
of digits after the decimal point).
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>C</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
String.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
<para>
|
||||
If the database is successfully created, a dbase_identifier is
|
||||
returned, otherwise false is returned.
|
||||
<example>
|
||||
<title>Creating a dBase database file</title>
|
||||
<programlisting role="php">
|
||||
<programlisting role="php">
|
||||
// "database" name
|
||||
$dbname = "/tmp/test.dbf";
|
||||
|
||||
|
@ -100,16 +120,16 @@ $def =
|
|||
// creation
|
||||
if (!dbase_create($dbname, $def))
|
||||
print "<strong>Error!</strong>";
|
||||
|
||||
</programlisting>
|
||||
</example></para>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.dbase-open">
|
||||
<refnamediv>
|
||||
<refname>dbase_open</refname>
|
||||
<refpurpose>opens a dBase database</refpurpose>
|
||||
<refpurpose>Opens a dBase database</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
@ -119,19 +139,21 @@ if (!dbase_create($dbname, $def))
|
|||
<paramdef>int <parameter>flags</parameter></paramdef>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
The flags correspond to those for the open() system call.
|
||||
(Typically 0 means read-only, 1 means write-only, and 2
|
||||
means read and write.)</para>
|
||||
<para>
|
||||
Returns a dbase_identifier for the opened database, or
|
||||
false if the database couldn't be opened.</para>
|
||||
The flags correspond to those for the open() system call.
|
||||
(Typically 0 means read-only, 1 means write-only, and 2 means
|
||||
read and write.)
|
||||
</para>
|
||||
<para>
|
||||
Returns a dbase_identifier for the opened database, or false if
|
||||
the database couldn't be opened.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.dbase-close">
|
||||
<refnamediv>
|
||||
<refname>dbase_close</refname>
|
||||
<refpurpose>close a dBase database</refpurpose>
|
||||
<refpurpose>Close a dBase database</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
@ -140,14 +162,16 @@ if (!dbase_create($dbname, $def))
|
|||
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
Closes the database associated with <parameter>dbase_identifier</parameter>.</para>
|
||||
Closes the database associated with
|
||||
<parameter>dbase_identifier</parameter>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.dbase-pack">
|
||||
<refnamediv>
|
||||
<refname>dbase_pack</refname>
|
||||
<refpurpose>packs a dBase database</refpurpose>
|
||||
<refpurpose>Packs a dBase database</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
@ -156,15 +180,17 @@ if (!dbase_create($dbname, $def))
|
|||
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
Packs the specified database (permanently deleting all records
|
||||
marked for deletion using <function>dbase_delete_record</function>.</para>
|
||||
Packs the specified database (permanently deleting all records
|
||||
marked for deletion using
|
||||
<function>dbase_delete_record</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.dbase-add-record">
|
||||
<refnamediv>
|
||||
<refname>dbase_add_record</refname>
|
||||
<refpurpose>add a record to a dBase database</refpurpose>
|
||||
<refpurpose>Add a record to a dBase database</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
@ -174,17 +200,18 @@ if (!dbase_create($dbname, $def))
|
|||
<paramdef>array <parameter>record</parameter></paramdef>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
Adds the data in the <parameter>record </parameter>to the
|
||||
database. If the number of items in the supplied record isn't
|
||||
equal to the number of fields in the database, the operation
|
||||
will fail and false will be returned.</para>
|
||||
Adds the data in the <parameter>record </parameter>to the
|
||||
database. If the number of items in the supplied record isn't
|
||||
equal to the number of fields in the database, the operation will
|
||||
fail and false will be returned.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.dbase-replace-record">
|
||||
<refnamediv>
|
||||
<refname>dbase_replace_record</refname>
|
||||
<refpurpose>replace a record in a dBase database</refpurpose>
|
||||
<refpurpose>Replace a record in a dBase database</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
@ -197,21 +224,23 @@ if (!dbase_create($dbname, $def))
|
|||
<simpara>
|
||||
Replaces the data associated with the record
|
||||
<parameter>record_number</parameter> with the data in the
|
||||
<parameter>record</parameter> in the database. If the number of items in
|
||||
the supplied record is not equal to the number of fields in the database,
|
||||
the operation will fail and false will be returned.</simpara>
|
||||
|
||||
<parameter>record</parameter> in the database. If the number of
|
||||
items in the supplied record is not equal to the number of fields
|
||||
in the database, the operation will fail and false will be
|
||||
returned.
|
||||
</simpara>
|
||||
<simpara>
|
||||
<parameter>dbase_record_number</parameter> is an integer which spans from
|
||||
1 to the number of records in the database (as returned by
|
||||
<function>dbase_numrecords</function>).</simpara>
|
||||
<parameter>dbase_record_number</parameter> is an integer which
|
||||
spans from 1 to the number of records in the database (as
|
||||
returned by <function>dbase_numrecords</function>).
|
||||
</simpara>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.dbase-delete-record">
|
||||
<refnamediv>
|
||||
<refname>dbase_delete_record</refname>
|
||||
<refpurpose>deletes a record from a dBase database</refpurpose>
|
||||
<refpurpose>Deletes a record from a dBase database</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
@ -221,16 +250,17 @@ if (!dbase_create($dbname, $def))
|
|||
<paramdef>int <parameter>record</parameter></paramdef>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
Marks <parameter>record</parameter> to be deleted from the database.
|
||||
To actually remove the record from the database, you must
|
||||
also call <function>dbase_pack</function>.</para>
|
||||
Marks <parameter>record</parameter> to be deleted from the
|
||||
database. To actually remove the record from the database, you
|
||||
must also call <function>dbase_pack</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.dbase-get-record">
|
||||
<refnamediv>
|
||||
<refname>dbase_get_record</refname>
|
||||
<refpurpose>gets a record from a dBase database</refpurpose>
|
||||
<refpurpose>Gets a record from a dBase database</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
@ -240,43 +270,54 @@ if (!dbase_create($dbname, $def))
|
|||
<paramdef>int <parameter>record</parameter></paramdef>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
Returns the data from <parameter>record</parameter> in an array. The
|
||||
array is indexed starting at 0, and includes an associative
|
||||
member named 'deleted' which is set to 1 if the record has
|
||||
been marked for deletion (see <function>dbase_delete_record</function>.</para>
|
||||
Returns the data from <parameter>record</parameter> in an
|
||||
array. The array is indexed starting at 0, and includes an
|
||||
associative member named 'deleted' which is set to 1 if the
|
||||
record has been marked for deletion (see
|
||||
<function>dbase_delete_record</function>.
|
||||
</para>
|
||||
<para>
|
||||
Each field is converted to the appropriate PHP type. (Dates
|
||||
are left as strings.)</para>
|
||||
Each field is converted to the appropriate PHP type. (Dates are
|
||||
left as strings.)
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.dbase-get-record-with-names">
|
||||
<refnamediv>
|
||||
<refname>dbase_get_record_with_names</refname>
|
||||
<refpurpose>gets a record from a dBase database as an associative array</refpurpose>
|
||||
<refpurpose>
|
||||
Gets a record from a dBase database as an associative array
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<funcsynopsis>
|
||||
<funcdef>array <function>dbase_get_record_with_names</function></funcdef>
|
||||
<funcdef>array
|
||||
<function>dbase_get_record_with_names</function>
|
||||
</funcdef>
|
||||
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
|
||||
<paramdef>int <parameter>record</parameter></paramdef>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
Returns the data from <parameter>record</parameter> in an
|
||||
associative array. The array also includes an associative member
|
||||
named 'deleted' which is set to 1 if the record has been marked
|
||||
for deletion (see <function>dbase_delete_record</function>.</para>
|
||||
Returns the data from <parameter>record</parameter> in an
|
||||
associative array. The array also includes an associative member
|
||||
named 'deleted' which is set to 1 if the record has been marked
|
||||
for deletion (see <function>dbase_delete_record</function>.
|
||||
</para>
|
||||
<para>
|
||||
Each field is converted to the appropriate PHP type. (Dates
|
||||
are left as strings.)</para>
|
||||
Each field is converted to the appropriate PHP type. (Dates are
|
||||
left as strings.)
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.dbase-numfields">
|
||||
<refnamediv>
|
||||
<refname>dbase_numfields</refname>
|
||||
<refpurpose>find out how many fields are in a dBase database</refpurpose>
|
||||
<refpurpose>
|
||||
Find out how many fields are in a dBase database
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
@ -285,25 +326,29 @@ if (!dbase_create($dbname, $def))
|
|||
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
Returns the number of fields (columns) in the specified
|
||||
database. Field numbers are between 0 and dbase_numfields($db)-1,
|
||||
while record numbers are between 1 and dbase_numrecords($db).
|
||||
<example>
|
||||
<title>Using <function>dbase_numfields</function></title>
|
||||
<programlisting>
|
||||
Returns the number of fields (columns) in the specified
|
||||
database. Field numbers are between 0 and dbase_numfields($db)-1,
|
||||
while record numbers are between 1 and dbase_numrecords($db).
|
||||
<example>
|
||||
<title>Using <function>dbase_numfields</function></title>
|
||||
<programlisting role="php">
|
||||
$rec = dbase_get_record($db, $recno);
|
||||
$nf = dbase_numfields($db);
|
||||
for ($i=0; $i < $nf; $i++) {
|
||||
print $rec[$i]."<br>\n";
|
||||
}
|
||||
</programlisting></example></para>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.dbase-numrecords">
|
||||
<refnamediv>
|
||||
<refname>dbase_numrecords</refname>
|
||||
<refpurpose>find out how many records are in a dBase database</refpurpose>
|
||||
<refpurpose>
|
||||
Find out how many records are in a dBase database
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
@ -312,9 +357,10 @@ for ($i=0; $i < $nf; $i++) {
|
|||
<paramdef>int <parameter>dbase_identifier</parameter></paramdef>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
Returns the number of records (rows) in the specified
|
||||
database. Record numbers are between 1 and dbase_numrecords($db),
|
||||
while field numbers are between 0 and dbase_numfields($db)-1.</para>
|
||||
Returns the number of records (rows) in the specified
|
||||
database. Record numbers are between 1 and dbase_numrecords($db),
|
||||
while field numbers are between 0 and dbase_numfields($db)-1.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
@ -330,7 +376,7 @@ sgml-always-quote-attributes:t
|
|||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../manual.ced"
|
||||
sgml-default-dtd-file:"../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
|
|
Loading…
Reference in a new issue