[fpc-pascal]Databases and FPC

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Tue May 6 18:06:53 CEST 2003


On Wed, 7 May 2003, James Mills wrote:

> On Mon, May 05, 2003 at 01:36:03PM +0200, Peter Brooks wrote:
> > Use a KSAM/ISAM [Keyed/Indexed Sequential Access Method] file. They are much
> > faster than databases, particularly relational ones and very easy to code
> > up.
> >
> > All you need to do is make the size of the file around 40% bigger than you
> > expect it ever to be (and if it gets up to 50% then rebuild an re-populate
> > it) then produce a hash number from the names and write to that address. You
> > have to have a good hash algorithm (tons about) and a policy for migrating
> > secondaries but it is all fairly straightforward. If your records are large
> > you might have two files, one for the keys and one for the data, then you
> > don't even need a hash key, you just insert the names in batches (say each
> > evening or every hour if it is really busy) where you re-sort the whole key
> > file and add the items in alphabetical order, a quick sort [maybe literally
> > if you like it] will yield the name and you simply add the records to the
> > end of the other file.
>
> This particular method you are talking about, KSAM/ISAM. Could you point
> me to some usefull tutorials on the web that explain this fairly well in
> programming terms (perhaps even in pascal) ?

You might try to use the gdbm units provided standard with Free Pascal.
There are examples included.

Michael.




More information about the fpc-pascal mailing list