Package: Pg2Xbase
Author: Piotr Klaban <makler@man.torun.pl>
Current version: 2.4.1
Date: Feb 16 2005

   This package is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this distribution; if not, download it from the FSF web
   page at http://www.gnu.org/copyleft/gpl.html write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

You need to have the following libraries  and programs compiled and installed
already into you system:

-- xbase libxbase C++ library (at least xbase-2.0.0);
-- postgres libpq C (libpq++ C++ is needed for version less than 2.2.8) library.
   Postgres v6.5.1 is enough for 1.0-3. For Postgres v7.x use pg2xbase 2.x
   For PostgreSQL 7.3.x and 7.4 use pg2xbase 2.3.
-- make - GNU make utility for compiling the source;
-- C++ compiler - it is known that egcs' g++ compiles the programs very well;
   old compilers might have problems with templates.
-- since version 2.2.0 pg2xbase cleanly compiles with gcc-3

See README file for WWW/FTP addresses, where you can download the software
for the libraries. This distribution should cleanly compile under
Solaris and under Linux.

If you use xbase rpm - you have to rebuild xbase SRMP (rpmbuild --rebuild xbase*.src.rpm),
because C++ libraries need to be compiled against the same C++ library.

OVERVIEW

   I have not seen good program for converting postgres table into DBF file,
   and reverse. That is why I wrote this pg2xbase utility.

   There is a conversion table between different field types:

Description             Postgres Type        DBF Type
-----------------------------------------------------
Variable length text    text                 memo      M
Fixed length text       char(x)              character C
Logical                 bool                 logical   L
Date                    date                 date      D
Absolute Date		absdate              char. with length=32 (one-way conversion) 
Integer                 int                  numeric with decimal==0 N
Float and Numeric       float (alias real)   float and numeric with decimal>0
Numeric			numeric(p,q)         numeric with decimal=q

   Pg2Xbase was originaly based on excellent dbf2sql (v2.2) by Maarten Boekhold <boekhold@et.tudelft.nl>.
   The program for creating new xbase files and packing text postgres type
   contents as character DBF type, are also his idea.

   Pg2Xbase is also result of feedback from its users, and I wish
   to thank all the people who sent me bug reports and patches.
   It has big impact on the programs, and makes me think
   that pg2xbase is a useful package.

   Read the INSTALL file for compilation and installation instructions.
   There are a few executables after compilation completes:

- pg2xbase - program for converting Postgres table into the xbase dbf file;
- xbase2pg - program for converting xbase dbf file into the Postgres table;
- xbaseconv - program for converting one dbf file into another one
             with possibly different char encoding or case;
- xbasenew - program for creating new xbase file with header only;

   If you have problems with connecting to the database, then check if you
   need username and password. If so, then setup your environment variables
   before using pg2xbase or xbase2pg: use PGUSER and PGPASSWORD variables,
   setup them using e.g. "export PGUSER=username" or "setenv PGUSER username"
   shell commands.

   There are a few man pages for that programs. You can read them if you want
   to know how to use these programs.

If you would have problems with running the programs, or you would like to add
new features, please write e-mail to me (address is at the top of that file).

LINKS

   You can read more about Postgres at
        http://www.postgreSQL.org/
   and about Xbase library at
        http://linux.techass.com/projects/xdb/
        (old link at http://www.startech.keller.tx.us/xbase/xbase.html)
   pg2xbase and distribution is available for download at
        http://www.klaban.torun.pl/prog/pg2xbase/

 DBF/XBASE FORMAT
 
   Xbase file format was usualy available at:
        http://www.e-bachmann.dk/docs/xbase.htm
   but I could not view it lately, a strange popup window rise up etc.
   Then you can view the local copy of the Xbase format description.

DOWNLOAD

   PACKAGES

     If you need xbase-2.0.0 rpm packages - download them from xdb homepage
     
     You can build then your own pg2xbase rpm package with the command:

     rpmbuild -tb pg2xbase-2.4.1.tgz
     
   SOURCES
     
   Current version of pg2xbase is 2.4.1, and that works with libxbase-2.0
     and with PostgreSQL 7.2.
     
     Source: pg2xbase-2.4.1.tgz

   OLD / UNSUPPORTED
     
     For Postgres 6.x use pg2xbase v1.1.1
     (upgrade when possible, since there were problems with empty Logical fields).
     
     Unsupported versions: 0.9.1, 0.9a, 0.9.

     For those of you who can not download xbase library, here is
     rpm version 1.8.1 of xbase compiled under RedHat 6.0,
     and the xbase-1.8.1 sources. 

BUGS

There is strange problem with pg2xbase - SELECT query generates error randomly
(reported by Aleksey Naumov) - could not reproduce it, can not say when it
would be fixed. :-(

CHANGES

See CHANGES