[Lazarus] Embedded database for Lazarus/Linux

Jürgen Hestermann juergen.hestermann at gmx.de
Fri Jun 18 18:39:07 CEST 2010



Hans-Peter Diettrich schrieb:
>> i still find it amazing, though, that in today's world, so many opt to 
>> use a sql database of some kind even for smallish projects where a 
>> nice simple self-designed binary data file would suffice... in many 
>> cases, it is akin to swatting a fly with a hydrogen bomb ;)
> What are the alternatives? If you already had to update a binary file 
> format, for required extensions, you'll know about the problems with the 
> conversion from the old to the new format, and with the synchronization 
> of the load and store procedures. A database should do all that 
> automatically, whenever the common model is updated.

Forgive me my naivity (I never used a database yet)
but just as an example: 
If you want to read a complete directory branch 
(with thousands of files and directories) every 5 
minutes in a loop and want to store this information 
together with other information (like date/time
of first appearance) at the end of each loop so 
that it's available even after a reboot, would 
you use a database for this?
If yes, how would the tree structure be defined 
in the database?

I just did this using a simple binary file and 
it was quite easy to do and it's speed is amazing. 
If my data changes, I simply delete the file 
and start from cratch. 
I also wrote programs that read multiple versions
of such binary files and I found it quite easy to maintain.
When using a database instead of a binary file I would 
need to feed the data from it into the data structures 
of my program in the same way anyway.

If I see the delays that applictions like Thunderbird
produce when simply moving an email to another folder 
(the hard disk spins for a minute or so) then 
I am happy that I never was forced to use a database.
Nearly all (PC) programs that I know and which use 
a database for relatively simple data are awfully slow
with anoying delays in unexpected situations.

Of course, for huge data amounts of data you cannot avoid 
using a database but I would prefer if programmers think
about performance a bit and not use databases for every
small junk.





More information about the Lazarus mailing list