Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-10

Cross-platform gdbm replacement

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alan Mead

I need to have some simple, cross-platform database functionality... at a minimum, I need to be able to write a datafile that is easily searched... kind of like a TStringList on disk. I think dbm/gdbm would suffice. If it had the ability to hold multiple columns and several indexes to those columns, that would be even better. I've considered something like MySQL but my needs are light-weight and I need a permissive license so it can be included with a commercial program and without having a seperate install/config. And it needs to work with FPC and Delphi.

I'll never need to use SQL or do a join.. the 'where' part will always be a simple field value. I will need to search a few million records quickly. Again, I need a way to write/rewrite the entire datafile once and if the indexes get corrupted, I might need to reindex. But basically, I'll only be reading from this data.

I looked at Delphi's TDataSet class and descendants briefly but that seems pretty complicated... I don't know if it's available in FPC.

Is this available in an existing package? If not, I think it wouldn't be more than a few nights hacking to make this degree of functionality... In fact, if it comes to that I'm torn between starting from scratch with my own format or trying to adapt Turbo Pascal code that can access existing file formats (e.g., Clipper).

Any thoughts or solutions would be appreciated.

-Alan

Reply by email

Matt Henley
to Alan Mead

Do a quick search on this list for sqlite. Its lightweight, cross platform and public domain. FPC has a unit to access it (somewhere in the fpc directory tree... dont have it up at the office) as well as at least one component that is being worked on.

Alan Mead wrote 33 lines
I need to have some simple, cross-platform database functionality... at a minimum, I need to be able to write a datafile that is easily searched... kind of like a TStringList on disk. I think dbm/gdbm would suffice. If it had the ability to hold multiple columns and several indexes to those columns, that would be even better. I've considered something like MySQL but my needs are light-weight and I need a permissive license so it can be included with a commercial program and without having a seperate install/config. And it needs to work with FPC and Delphi. I'll never need to use SQL or do a join.. the 'where' part will always be a simple field value. I will need to search a few million records quickly. Again, I need a way to write/rewrite the entire datafile once and if the indexes get corrupted, I might need to reindex. But basically, I'll only be reading from this data. I looked at Delphi's TDataSet class and descendants briefly but that seems pretty complicated... I don't know if it's available in FPC. Is this available in an existing package? If not, I think it wouldn't be more than a few nights hacking to make this degree of functionality... In fact, if it comes to that I'm torn between starting from scratch with my own format or trying to adapt Turbo Pascal code that can access existing file formats (e.g., Clipper). Any thoughts or solutions would be appreciated. -Alan _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Michael Van Canneyt
to Matt Henley
Matt Henley wrote
Do a quick search on this list for sqlite. Its lightweight, cross platform and public domain. FPC has a unit to access it (somewhere in the fpc directory tree... dont have it up at the office) as well as at least one component that is being worked on.

Yes.
The latest sqliteds in the FCL has good support for SQLite.

Or use TDbf, it uses DBase files, with as much indexes as you want.

I would suggest the latter, as you don't need external libraries. 100% Pascal code, and the DBase files can be opened with many other programs as well. (MS-Office, OpenOffice etc). Filter expressions are supported as well, so you can do your 'where' easily.

Michael.

Reply by email