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: Sat, 12 Jul 2008 04:44:32 +0000 (UTC)



sqlite newdatabase.db

This creates a new database called newdatabase.db, assuming it doesn't already
exist.

Then at the sqlite> prompt, you type

.read filename.sql

Note this is .read not just read. The leading dot tells sqlite it's a
command for sqlite not just sql.

This will probably give you an error along the lines of

SQL error near line 9: no such table: postamt

This is because your script drops the table before recreating it, and the
table won't exist in your blank database.

Then if you type

select * from postamt;
select was not mentioned in the .help output.

This displays all fields (as columns of information, one record per line)

If I have fields A B C D....

select A, B from postamt displays just columns A and B
(Space optional after the comma)

I can start with:
sqlite -header postamt

Displays column headers but they are not lined up with the columns.
I could pad the headers to have spaces at their ends.

Maybe sqlite3 fixes this.

A|B|
Entry |Entry
Entry |Entry

sqlite -column postamt
Displays in columns, one record per line

sqlite -row postamt
Displays one field per row (similar to what dbf filename.dbf displays).

Up arrow works even within sqlite to repeat a previous command (including commands made during a previous usage, after quitting and restarting). Nice.

Minor drawback:

Unlike my DOS database programs (where hitting right arrow moves you to the next column and it is all lined up neatly, with some entries offscreen), if I have more than 80 columns it wraps instead of letting me scroll to the right. I could get 160 columns by using a framebuffer kernel and vga 793 (or a matrox video card that you can use fbset with). Any other ideas?

For some unknown reason my large database just now imported properly into a db file. I must have done something wrong before. I did not see 'syntax error' scroll by this time, but it does complain about \ (or was it /?) not being an acceptable character (in \' inside words, as opposed to ' that delimits field entries). But they don't seem to show up in the output (what you see onscreen with sqlite).

All I need to learn now is to edit, append, insert, copy, and sort entries, which are also not in the help output but may be in sqlite.gz man page.

Sindi




Archive powered by MHonArc 2.6.24.

Top of Page