Skip to Content.
Sympa Menu

baslinux - Re: [BL] dbf to sql convertor, was Re: Spanish dollybase,

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: baslinux AT lists.ibiblio.org
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] dbf to sql convertor, was Re: Spanish dollybase,
  • Date: Sun, 13 Jul 2008 22:33:12 +0000 (UTC)

sqlite 3
Also imports csv files.
I can't figure out how this works.

I created database.csv which I wanted to make into database.db
csv has comma rather than | as separator

sqlite3 database.db
.separator ',' .import database.csv database

(instructions are .import FILE TABLE)

TABLE appears NOT to refer to the name of my database file.


dbf convertor can convert dbf to csv, a much shorter format.
I am hoping any garbage will get removed from my file by converting dbf to
csv and thence to sqlite db format.

I found documentation for the later dbf (0.9.0) but as dbf.sgml, for which an hour's online hunting did not find me a convertor to HMTL. You apparently need to have the sgml creating package to get docbook-to-manand then use man2html (which I do have). Anyway, I read (between the many large tags) about the --trim command, recommended for making much smaller sql files. r - l - or b (b is both left and right). I think it removes stray spaces.

dbf --trim b --sql file.sql file.dbf

(The --trim b must precede the --sql.)

My 437K dbf file, without trimming, produced 548K sql > 1MB db
Trimming produced 347K sql and 152K db. Which makes sqlite's format much more efficient than dbf or even csv (294K because of all the " ") even despite a lot of garbage.

There is still lots of garbage in the file (created by my buggy dbf database program) but about 640K less of it. Fragments of records are found in the header section. Long stretches of ^@ are found at random intervals.

Also, sqlite chopped off the entire first page (25 lines or so) of records from the sql file when reading it in. (It did not do this to the small non-buggy sample file, just my big actual buggy one).

I can enter this infomratoin back manually while referring to the dbf file,
once I figure out how.

Sindi




Archive powered by MHonArc 2.6.24.

Top of Page