1XBase::FAQ(3)         User Contributed Perl Documentation        XBase::FAQ(3)
2
3
4

NAME

6       XBase::FAQ - Frequently asked questions about the XBase.pm/DBD::XBase
7       modules
8

DESCRIPTION

10       This is a list of questions people asked since the module has been
11       announced in fall 1997, and my answers to them.
12

AUTHOR

14       Jan Pazdziora, adelton@fi.muni.cz
15

Questions and answers

17       What Perl version do I need? What other modules?
18         You need perl at least 5.004. I test each new distribution agains
19         5.005* and 5.004_04 version of perl. You need DBI module version 1.00
20         or higher, if you want to use the DBD driver (which you should).
21
22       Can I use XBase.pm under Windows 95/NT?
23         Yes. It's a standard Perl module so there is no reason it shouldn't.
24         Or, actually, there are a lot of reasons why standard thing do not
25         work on systems that are broken, but I'm trying hard to workaround
26         these bugs. If you find a problem on these platform, send me a
27         description and I'll try to find yet another workaround.
28
29       Is there a choice of the format of the date?
30         The only possible format in which you can get the date and that the
31         module expect for inserts and updates is a 8 char string 'YYYYMMDD'.
32         It is not possible to change this format. I prefer to do the
33         formating myself since you have more control over it.
34
35       The "get_record" also returns deleted records. Why?
36         Because. You get the _DELETED flag as the first value of the array.
37         This gives you a possibility to decide what to do -- undelete,
38         ignore... It's a feature -- you say you want a record of given
39         number, you get it and get additional information, if the record is
40         or isn't marked deleted.
41
42       But with DBD::XBase, I do not see the deleted records.
43         That's correct: DBD::XBase only gives you records that are positively
44         in the file and not deleted. Which shows that XBase.pm is a lower
45         level tool because you can touch records that are marked deleted,
46         while DBD::XBase is higher level -- it gives you SQL interface and
47         let's you work with the file more naturaly (what is deleted should
48         stay deleted).
49
50       XBase.pm cannot read files created with [your favorite tool].
51         Describe exactly, what you expect and what you get. Send me the file
52         (I understand attachments, uuencode, tar, gzip and zip) so that I can
53         check what it going on and make XBase.pm undestand your file.  A
54         small sample (three rows, or so) are generally enough but you can
55         send the whole file if it doesn't have megabytes. Please understand
56
57       How to install the module when I do not have make?
58         On Win* platform and with ActiveState port, use ppm to install
59         DBD::XBase from ActiveState's site. You can also just copy the files
60         from the lib directory of the distribution to where perl can find
61         them. Also check whether your make doesn't hide under different names
62         (nmake, gmake). See "README".
63
64       I have make but I cannot install into default directory.
65         Ask your sysadmin to do it for your. If he refuses, fire the
66         sysadmin. See "README" for how to install into and use nonstandard
67         place for the module.
68
69       Can I access one dbf file both from Perl and (say) Clipper?
70         For reading -- yes. For writing -- XBase.pm has a locksh and lockex
71         method to lock the file. The question is to what extend Clipper (or
72         Fox* or whatever) uses the same system calls, documentation of native
73         XBase applications doesn't tell this. So the answer is that for
74         multiple updates you should probably consider real RDBMS system
75         (PostgreSQL, MySQL, Oracle, to name a few).
76
77       XBase.pm/DBD::XBase breaks my accented characters.
78         No, it doesn't. The character data is returned exactly as it appears
79         in the dbf/dbt file. You probably brought the file from different
80         system that uses differend character encodings. So some bytes in the
81         strings have different meaning on that system. You also probably have
82         fonts in different encoding on that system. In the Czech language, we
83         have about 6 different encoding that affect possition at which
84         accented characters appear.
85
86         So what you really want to do is to use some external utility to
87         convert the strings to encoding you need -- for example, when I bring
88         the dbf from Win*, it often is in the Windows-1250 or PC-Latin-2
89         encoding, while the standard is ISO-8859-2. I use my utility
90         Cz::Cstocs to do the conversion, you maight also try GNU program
91         recode or use Text::Iconv Perl module.
92
93       How do I access the fields in the memo file?
94         Just read the memo field, it will fetch the data from the memo file
95         for you transparently.
96
97       Matching with "field = '%str%'" doesn't work.
98         If you want to match wildcards with DBD::XBase, you have to use
99         "like":
100
101                 select * from table where field like '%str%'
102
103       Can I sue you if XBase.pm/DBD::XBase corrupts my data?
104         No. At least, I hope no. The software is provided without any
105         warranty, in a hope you might find is usefull. Which is by the way
106         the same as with most other software, even if you pay for that. What
107         is different with XBase.pm/DBD::XBase is the fact that if you find
108         out that the results are different from those expected, you are
109         welcome to contact me, describe the problem and send me the files
110         that give troubles to the module, and I'll try to find fix the
111         module.
112
113       What dbf/other files standard does the module support?
114         I try to support any file that looks reasonably as
115         dbf/dbt/fpt/smt/ndx/ntx/mdx/idx/cdx. There are many clones of XBase-
116         like software, each adding its own extension. The module tries to
117         accept all different variations. To do that, I need your cooperation
118         however -- usually good description of the problem, file sample and
119         expected results lead to rather fast patch.
120
121       What SQL standard does the DBD::XBase support?
122         If supports a reasonable subset of the SQL syntax, IMHO. So you can
123         do select, delete, insert and update, create and drop table. If there
124         is something that should be added, let me know and I will consider
125         it.  Having said that, I do not expect to ever support joins, for
126         example.  This module is more a parser to read files from your legacy
127         applications that a RDBMS -- you can find plenty of them around --
128         use them.
129
130       I downloaded you module I do not know how to install it.
131         Did you follow the steps in the "README" and "INSTALL" files? Where
132         did it fail? This module uses a standard way modules in Perl are
133         installed. If you've never installed a module on your system and your
134         system is so non-standard that the general instruction do not help,
135         you should contact your system administrator or the support for your
136         system.
137
138       "select max(field) from table" does not work.
139         Aggregate functions are not supported. It would probably be very
140         slow, since the DBD doesn't make use of indexes at the moment. I do
141         not have plans to add this support in some near future.
142
143       "DBI->connect" says that the directory doesn't exist ...
144         ... but it's there. Is DBD::XBase mad or what?
145
146         The third part of the first parameter to the connect is the directory
147         where DBD::XBase will look for the dbf files. During connect, the
148         module checks "if -d $directory". So if it says it's not there, it's
149         not there and the only thing DBD::XBase can do about it is to report
150         it to you. It might be that the directory is not mounted, you do not
151         have permissions to it, the script is running under different UID
152         than when you try it from command line, or you use relative patch and
153         run the script from a different directory (pwd) than you expect.
154         Anyway, add
155
156                 die "Error reading $dir: $!\n" unless -d $dir;
157
158         to your script and you will see that it's not DBD::XBase problem.
159
160       The XBase.pm/dbfdump.pl stops after reading n records ...
161         ... why doesn't it read all 10 x n records?
162
163         Check if the file isn't truncated. "dbfdump.pl -i file.dbf" will tell
164         you the expected number of records and length of one record, like
165
166                 Filename:       file.dbf
167                 Version:        0x03 (ver. 3)
168                 Num of records: 65
169                 Header length:  1313
170                 Record length:  1117
171                 Last change:    1998/12/18
172                 Num fields:     40
173
174         So the expected length of the file is at least 1313 + 65 * 1117. If
175         it's shorter, you've got damaged file and XBase.pm/dbfdump.pl only
176         reads as much rows as it can find in the dbf.
177
178       How is this DBD::XBase related to DBD::ODBC?
179         DBD::XBase reads the dbf files directly, using the (included)
180         XBase.pm module. So it will run on any platform with reasonable new
181         perl. With DBD::ODBC, you need an ODBC server, or some program, that
182         DBD::ODBC could talk to. Many proprietary software can serve as ODBC
183         source for dbf files, it just doesn't seem to run on Un*x systems.
184         And is also much more resource intensive, if you just need to read
185         the file record by record and convert it to HTML page or do similary
186         simple operation with it.
187
188       How do I pack the dbf file, after the records were deleted?
189         XBase.pm doesn't support this directly. You'd probably want to create
190         new table, copy the data and rename back. Patches are always welcome.
191
192       Foxpro doesn't see all fields in dbf created with XBase.pm.
193         Put 'version' => 3 options in to the create call -- that way we say
194         that the dbf file is dBaseIII style.
195
196
197
198perl v5.12.0                      2010-05-06                     XBase::FAQ(3)
Impressum