| 1 |
|
| 2 |
------------------------------------ |
| 3 |
XBase and DBD::XBase |
| 4 |
------------------------------------ |
| 5 |
|
| 6 |
This is the README file for the XBase and DBD::XBase packages for work |
| 7 |
with *.dbf files. Please read it if you install this module for the |
| 8 |
first time or if there are any problems with the module. |
| 9 |
|
| 10 |
|
| 11 |
What is this module for: |
| 12 |
Module XBase provides access to XBase (dBase, Fox*) dbf files. |
| 13 |
It also handles memo files (dbt, fpt) and to certain extend |
| 14 |
index files (ndx, ntx, mdx, idx and cdx). The DBD::XBase is |
| 15 |
a database driver for DBI and provides simple SQL interface for |
| 16 |
reading and writing the database files. So this package offers |
| 17 |
two ways of accessing your beloved data in dbf files: XBase.pm |
| 18 |
and DBD::XBase. I recommend using DBD::XBase and only resort |
| 19 |
to XBase.pm if you need something special which is not |
| 20 |
supported by the DBI interface. |
| 21 |
|
| 22 |
You do not need any other servers/software, these modules |
| 23 |
directly read and write the dbf (and other) files. The main |
| 24 |
goal was to create a parser, mainly to work with data from |
| 25 |
your legacy applications. If you are looking for something |
| 26 |
more powerfull, check real relation database servers, such as |
| 27 |
Oracle, MySQL or PostgreSQL. |
| 28 |
|
| 29 |
|
| 30 |
How does the code look like: |
| 31 |
The DBI (DBD::XBase) way of doing things is |
| 32 |
|
| 33 |
use DBI; |
| 34 |
my $dbh = DBI->connect('dbi:XBase:/directory', |
| 35 |
undef, undef, { RaiseError => 1 }); |
| 36 |
my $data = $dbh->selectall_arrayref(q! |
| 37 |
select * from table |
| 38 |
!); |
| 39 |
|
| 40 |
which is the same as would be with any other database. |
| 41 |
Remember, this is only a simple parser, so no joins or |
| 42 |
subselecects are supported. |
| 43 |
|
| 44 |
If you want to use the base XBase.pm interface, you'd use code |
| 45 |
like |
| 46 |
|
| 47 |
use XBase; |
| 48 |
my $table = new XBase 'table.dbf'; |
| 49 |
my @data = $table->get_record(0); |
| 50 |
|
| 51 |
The distribution also includes a dbfdump script that prints |
| 52 |
the content of the table in readable form. |
| 53 |
|
| 54 |
|
| 55 |
Index support: |
| 56 |
The support for ndx/ntx/idx/mdx/cdx index files still needs |
| 57 |
quite a lot of work. It currently allows you to search |
| 58 |
directly to the record you want, using the |
| 59 |
prepare_select_with_index method of the XBase table object. |
| 60 |
But you cannot create the index, nor is the index updated |
| 61 |
when you change the dbf. Check the XBase::Index(3) man page |
| 62 |
and the eg/ directory for how you can help to make it better. |
| 63 |
|
| 64 |
Recently, support for SDBM index files was added. I hope to |
| 65 |
make it a fully working and reference implementation before |
| 66 |
attacking the world of undocumented mess of XBase index types |
| 67 |
again. |
| 68 |
|
| 69 |
|
| 70 |
Support, documentation: |
| 71 |
This module is provided in a hope you might find it useful. |
| 72 |
My intent is to support as many variations of formats as |
| 73 |
possible, but I do not have dBase/Fox* and do not plan to |
| 74 |
have, so send me examples of your data files if you feel your |
| 75 |
native XBase engines produce data incompatible with this |
| 76 |
module. |
| 77 |
|
| 78 |
Man pages for XBase, DBD::XBase, dbfdump, XBase::Index and |
| 79 |
XBase::SDBM are included, examples of little scripts can also |
| 80 |
be found in eg/ directory of the distribution. Read the DBI |
| 81 |
man page for DBI specific issues, and the XBase::FAQ page. |
| 82 |
|
| 83 |
|
| 84 |
Installation: |
| 85 |
For installation and problem and bug reporting, please read |
| 86 |
the INSTALL file. |
| 87 |
|
| 88 |
|
| 89 |
If it works for you: |
| 90 |
I'd appreciate any message if you use the module and find it |
| 91 |
usefull -- I'm just curious what tasks people use the module |
| 92 |
for and what they expect from it. You can of course also send |
| 93 |
something more valuable. |
| 94 |
|
| 95 |
|
| 96 |
Available: |
| 97 |
http://www.adelton.com/perl/DBD-XBase/ and from your favorite |
| 98 |
CPAN site in the authors/id/JANPAZ/ directory. |
| 99 |
|
| 100 |
Contact the author at jpx dash perl at adelton dot com. |
| 101 |
|
| 102 |
|
| 103 |
Copyright: (c) 1997--2016 Jan Pazdziora. |
| 104 |
All rights reserved. This package is free software; you can |
| 105 |
redistribute it and/or modify it under the same terms as Perl |
| 106 |
itself. |
| 107 |
|
| 108 |
|