php-doc-en/reference/dbase/book.xml
Christoph Michael Becker d759f85033 dBase is a PECL extension as of PHP 5.3.0
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@344869 c90b9560-bf6c-de11-be94-00142212c4b1
2018-04-27 15:39:19 +00:00

162 lines
5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<book xml:id="book.dbase" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<?phpdoc extension-membership="pecl" ?>
<title>dBase</title>
<!-- {{{ preface -->
<preface xml:id="intro.dbase">
&reftitle.intro;
<note>
<para>
&pecl.moved-ver;5.3.0.
</para>
</note>
<para>
These functions allow you to access records stored in dBase-format
(dbf) databases.
</para>
<warning>
<para>
We recommend against using dBase files as your production
database. Use <link xlink:href="&url.sqlite;">SQLite</link> or choose any real SQL server instead; <link
xlink:href="&url.mysql;">MySQL</link> or <link xlink:href="&url.pgsql;">Postgres</link>
are common choices with PHP. dBase support is here to allow you to
import and export data to and from your web database, because the
file format is commonly understood by Windows spreadsheets and
organizers.
</para>
</warning>
<caution>
<para>
As of dbase 7.0.0 the databases are automatically locked via
<function>flock</function>. There has been no support for locking earlier,
so two concurrent web server processes modifying the same dBase file would
have very likely ruined your database. This can happen even with dbase
7.0.0+ on systems which implement the locks at the process level with
multithreaded SAPIs such as ISAPI.
</para>
</caution>
<para>
dBase files are simple sequential files of fixed length records.
Records are appended to the end of the file and deleted records are
kept until you call <function>dbase_pack</function>.
</para>
<para>
Only dbf file levels 3 (dBASE III+) - 5 (dBASE V) are supported.
The types of dBase fields available are:
<table>
<title>Available types of fields</title>
<tgroup cols="3">
<thead>
<row>
<entry>Field</entry>
<entry>dBase Type</entry>
<entry>Format</entry>
<entry>Additional information</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>M</literal></entry>
<entry>Memo</entry>
<entry>n/a</entry>
<entry>This type is not supported by PHP, such field will be ignored</entry>
</row>
<row>
<entry><literal>D</literal></entry>
<entry>Date</entry>
<entry><literal>YYYYMMDD</literal></entry>
<entry>The field length is limited to 8</entry>
</row>
<row>
<entry><literal>T</literal></entry>
<entry>DateTime</entry>
<entry><literal>YYYYMMDDhhmmss.uuu</literal></entry>
<entry>(FoxPro) No validity checks are done. Available as of dbase 7.0.0.</entry>
</row>
<row>
<entry><literal>N</literal></entry>
<entry>Number</entry>
<entry>A number</entry>
<entry>
You must declare a length and a precision (the number of digits
after the decimal point).
</entry>
</row>
<row>
<entry><literal>F</literal></entry>
<entry>Float</entry>
<entry>A float number</entry>
<entry>Same as <literal>N</literal>. Available as of PHP 5.2.0</entry>
</row>
<row>
<entry><literal>C</literal></entry>
<entry>String</entry>
<entry>A string</entry>
<entry>You must declare a length. When retrieving data, the string
will be right-padded with spaces to fit the declared length. Overlong
strings will be silently truncated when storing data.</entry>
</row>
<row>
<entry><literal>L</literal></entry>
<entry>Boolean</entry>
<entry>
<literal>T</literal> or <literal>Y</literal> for &true;,
<literal>F</literal> or <literal>N</literal> for &false;,
<literal>?</literal> for uninitialized.
</entry>
<entry>
As of dbase 7.0.0, returned as a <type>bool</type> (&true; or &false;),
or &null; for uninitialized fields.
Formerly, returned as an <type>int</type> (<literal>1</literal> or <literal>0</literal>).
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<note>
<para>
As of dbase 7.0.0 nullable fields are supported for
<constant>DBASE_TYPE_FOXPRO</constant> databases. If a field is nullable,
passing &null; will set the respective flag, and on later retrieval the field
value will be &null;.
</para>
</note>
<note>
<para>
There is no support for indexes or memo fields.
</para>
</note>
</preface>
<!-- }}} -->
&reference.dbase.setup;
&reference.dbase.constants;
&reference.dbase.reference;
</book>
<!-- 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
-->