Creating a database
Posted on 2003-11-12
Im trying to create a database for my program, and I have some questions. Basically, the way I was thinking of setting it up was as follows:
[first 4 bytes to serve as a file signature][next 2 bytes say how many tables][list of table headers (1 per table)]
A table header being 24 bytes as follows:
[first 16 byes being a table name][next 4 bytes saying how many bytes per record][next 4 bytes says how many records in table]
Now my question is this:
First of all, is my above approach correct, and if not what suggestion do you have?
Also, what is the best way to interact with the database (should I read the whole thing into memory when I start my program, and then write it all back to the file when I close?).
The program that the database is for is rather simple, but I was my database to be flexible so that I could reuse it in other programs. All suggestions are very welcome.