reference/dbase/book.xml
a0ae28d3bc85f927c22649ebd9a590b921534b7d
...
...
@@ -2,22 +2,49 @@
2
2
<!-- $Revision$ -->
3
3
4
4
<book xml:id="book.dbase" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
-
<?phpdoc extension-membership="bundledexternal" ?>
5
+
<?phpdoc extension-membership="pecl" ?>
6
6
<title>dBase</title>
7
7
8
8
<!-- {{{ preface -->
9
9
<preface xml:id="intro.dbase">
10
10
&reftitle.intro;
11
+
<note>
12
+
<para>
13
+
&pecl.moved-ver;5.3.0.
14
+
</para>
15
+
</note>
11
16
<para>
12
17
These functions allow you to access records stored in dBase-format
13
18
(dbf) databases.
14
19
</para>
20
+
<warning>
21
+
<para>
22
+
We recommend against using dBase files as your production
23
+
database. Use <link xlink:href="&url.sqlite;">SQLite</link> or choose any real SQL server instead; <link
24
+
xlink:href="&url.mysql;">MySQL</link> or <link xlink:href="&url.pgsql;">Postgres</link>
25
+
are common choices with PHP. dBase support is here to allow you to
26
+
import and export data to and from your web database, because the
27
+
file format is commonly understood by Windows spreadsheets and
28
+
organizers.
29
+
</para>
30
+
</warning>
31
+
<caution>
32
+
<para>
33
+
As of dbase 7.0.0 the databases are automatically locked via
34
+
<function>flock</function>. There has been no support for locking earlier,
35
+
so two concurrent web server processes modifying the same dBase file would
36
+
have very likely ruined your database. This can happen even with dbase
37
+
7.0.0+ on systems which implement the locks at the process level with
38
+
multithreaded SAPIs.
39
+
</para>
40
+
</caution>
15
41
<para>
16
42
dBase files are simple sequential files of fixed length records.
17
-
Records are appended to the end of the file and delete records are
43
+
Records are appended to the end of the file and deleted records are
18
44
kept until you call <function>dbase_pack</function>.
19
45
</para>
20
46
<para>
47
+
Only dbf file levels 3 (dBASE III+) - 5 (dBASE V) are supported.
21
48
The types of dBase fields available are:
22
49
<table>
23
50
<title>Available types of fields</title>
...
...
@@ -44,33 +71,47 @@
44
71
<entry>The field length is limited to 8</entry>
45
72
</row>
46
73
<row>
74
+
<entry><literal>T</literal></entry>
75
+
<entry>DateTime</entry>
76
+
<entry><literal>YYYYMMDDhhmmss.uuu</literal></entry>
77
+
<entry>(FoxPro) No validity checks are done. Available as of dbase 7.0.0.</entry>
78
+
</row>
79
+
<row>
47
80
<entry><literal>N</literal></entry>
48
81
<entry>Number</entry>
49
82
<entry>A number</entry>
50
83
<entry>
51
84
You must declare a length and a precision (the number of digits
52
-
after the decimal point)
85
+
after the decimal point).
53
86
</entry>
54
87
</row>
55
88
<row>
89
+
<entry><literal>F</literal></entry>
90
+
<entry>Float</entry>
91
+
<entry>A float number</entry>
92
+
<entry>Same as <literal>N</literal>.</entry>
93
+
</row>
94
+
<row>
56
95
<entry><literal>C</literal></entry>
57
96
<entry>String</entry>
58
97
<entry>A string</entry>
59
98
<entry>You must declare a length. When retrieving data, the string
60
-
will be right-padded with spaces to fit the declared length.</entry>
99
+
will be right-padded with spaces to fit the declared length. Overlong
100
+
strings will be silently truncated when storing data.</entry>
61
101
</row>
62
102
<row>
63
103
<entry><literal>L</literal></entry>
64
104
<entry>Boolean</entry>
65
-
<entry><literal>T</literal> or <literal>Y</literal> for &true;,
66
-
<literal>F</literal> or <literal>N</literal> for &false;</entry>
67
-
<entry>Stored and returned as an integer (1 or 0)</entry>
68
-
</row>
69
-
<row>
70
-
<entry><literal>F</literal></entry>
71
-
<entry>Float</entry>
72
-
<entry>A float number</entry>
73
-
<entry>Support for this type of field was added in PHP 5.2.0</entry>
105
+
<entry>
106
+
<literal>T</literal> or <literal>Y</literal> for &true;,
107
+
<literal>F</literal> or <literal>N</literal> for &false;,
108
+
<literal>?</literal> for uninitialized.
109
+
</entry>
110
+
<entry>
111
+
As of dbase 7.0.0, returned as a <type>bool</type> (&true; or &false;),
112
+
or &null; for uninitialized fields.
113
+
Formerly, returned as an <type>int</type> (<literal>1</literal> or <literal>0</literal>).
114
+
</entry>
74
115
</row>
75
116
</tbody>
76
117
</tgroup>
...
...
@@ -78,25 +119,17 @@
78
119
</para>
79
120
<note>
80
121
<para>
81
-
&pecl.moved-ver;5.3.0.
122
+
As of dbase 7.0.0 nullable fields are supported for
123
+
<constant>DBASE_TYPE_FOXPRO</constant> databases. If a field is nullable,
124
+
passing &null; will set the respective flag, and on later retrieval the field
125
+
value will be &null;.
82
126
</para>
83
127
</note>
84
-
<warning>
128
+
<note>
85
129
<para>
86
-
There is no support for indexes or memo fields. There is no
87
-
support for locking, too. Two concurrent web server processes
88
-
modifying the same dBase file will very likely ruin your database.
130
+
There is no support for indexes or memo fields.
89
131
</para>
90
-
<para>
91
-
We recommend that you do not use dBase files as your production
92
-
database. Choose any real SQL server instead; <link
93
-
xlink:href="&url.mysql;">MySQL</link> or <link xlink:href="&url.pgsql;">Postgres</link>
94
-
are common choices with PHP. dBase support is here to allow you to
95
-
import and export data to and from your web database, because the
96
-
file format is commonly understood by Windows spreadsheets and
97
-
organizers.
98
-
</para>
99
-
</warning>
132
+
</note>
100
133
</preface>
101
134
<!-- }}} -->
102
135
103
136