KAMXbase v1.2 PERL Module -- DBF to MySQL conversion with Memo Fields!

File Available from:

http://www.peregrinehw.com/downloads/perl/

------------------------
Credits:

PERL Based Module, based on a modification of:

	Module: Xbase.pm                                        Date: 01/23/1996
	Version: 1.07
	Author Source: http://eewww.eng.ohio-state.edu/~pereira/software/xbase/
	Author Address: pereira@ee.eng.ohio-state.edu

	-Pratap Pereira


As noted in the previous release, I have tried contacting the author without 
success.  This module consists mostly of his code with bug fixes and an 
additional program that utilizes this code.

Also based on code ripped from dbf2m(y)sql.c by Maarten Boekhold 
(boekhold@cindy.et.tudelft.nl).  Thanks to him and all his contributors for
their help.  He has been instrumental in helping get this done!

Additional Thanks to: Jon Shiring, Ryan Whelan, Mark Rorabaugh, Rob Shvern & 
The Camel Book!!!

-------------------------
The Story:

What I wanted was the ability to take a DBF file, parse the format, create an 
SQL table that was equivalent, and then import the information.

To that end, I searched and searched.  I found dbf2mysql which had a large
limitation for me in that it couldn't read memo fields.  So I kept searching...
I found programs everywhere... XBasethis, Xbasethat... 

Then I stumbled on Xbase v1.07.  It's an overloaded class module for reading DBF
formats INCLUDING memo fields.  This was the holy grail I was looking for.  It
had a few bugs in the open function and the status function.  I fixed them.

-------------------------
Documentation:

Then I added two important commands:

1 -- sql_create 

	This command is used to read the DBF format and pass back a query 
	string that would closely resemble the original DBF format.

	It does not handle: reserved word problems, primary keys, indexing,
	or not null features.  If MySQL chokes on a create, look at the 
	query and see if there is a reserved word.  Things like CHAR, TEXT,
	INT, etc.  They work in DBF format, but not in SQL.

* 	Added in v1.1 is the addindex feature

2 -- sql_num_fields

	This command simply returns the number of fields in the original DBF file.  
	Useful for loops such as:

	
		$j = 0;
                while ($j < $database->sql_num_fields) {
			#Do Some Stuff!
                        $j++;
                }

I then wrote one program called importdbf.pl.  Run it to get the current arguments!


This constitutes the entire packages purpose.  If you email changes, bugs, specs, etc., I can 
almost certainly add them in a timely manner.
---------------------------
Installation:

	This package requires MySQL, the MySQL DBD Perl extensions, and of course, Perl.

        To install simply run the following:

		perl Makefile.PL
        	make install

Right now, I'm not trying to replace Xbase, but supplement it.  If I can't reach the author
in the next few weeks, I'll begin officially replacing it.  And as of May of 2001, I will be
switching to using the xdb library if all goes well.


---------------------------
History:

	v1.0	Released in August of 1998.  Original release.  Extremely stable
		with no serious bugs reported for several months

	v1.1	Gave up on original author and have begun maintenance and rewrite
		of Xbase.  Renamed Pratap's module to KAMXbase and have begun the 
		modifications to replace this module
			
		Complete rewrite of importdbf to utilize the DBI/DBD interface.

		Found a bug in some database formats that store column numbers 
		incorrectly.  Fixed to return number of columns as whole integer
		only.  Who ever	heard of a database with 16.37 columns?

		Created installation script and modified POD documentation.

		Complete overhaul of importdbf for strict, local variables and 
		general upgrades in code.

		Complete overhaul of KAMXbase for strict use.

		Added a timing function to the main import loop for further testing 
		with Database Options, Code Changes, Etc.  This should allow for more
		optimization and testing to make the code as fast as possible.

		Gave both the importdbf and module the same version numbers for 
		consistency.
 
 		(08-25-2000) Corrected Database Structure for oms.dbc

	v1.1BETAX	After using the program constantly for the past few years,
                I have had to fix a few small bugs and add specialized support for
                individual users.  At this time, the program will be eternally in
                BETA, but the releases are VERY stable from what we have experienced.

                Complete Re-Write of Check Import.

        v1.2    Added a few reserved words to the list for mySQL 3.23 users and made
                a formal release.

        v?	Need to create a better system for command line parameters
	
---------------------------
Caveats:

This program has no warranties, implied or otherwise.  If you use it, you owe
me your 1st born daughter or son.  Seriously though, send any money to the
Ruth House in the name of the Perl Institute.  Any licensing is governed by
the included packages, at least for this release!

It has been used very successfully on several HUNDRED million records!

Good Luck!

Kevin A. McGrail
kmcgrail@peregrinehw.com
