Well flat-file databases are pretty generic, yet differ quite a bit from one another.
CSV is a popular way. Basically, you have to choose a couple delimiters (one for columns (Ex: ","), another for rows (Ex: "\n"), figure a way to set column names and types, have a way to sort by different columns, possibly some built in security, etc.
You might start with a folder with the name of the database. Then you can have either a multi-dimensional flat-file DB with folders, or just all the files in there.
You need to build a parser in whatever language will work for the application, but you MUST use generic functions for insert, update, sort, delete (for rows), create, alter, move, drop, or rename (for files/folders). If you do this custom each time or use different functions for different files it's not going to be very customizable. I'd let the delimiter be set inside each file, Ex: the first line can set the delimiters, after that you can set the columns, and then start inserting rows.
Select functions must be able to select a given amount of rows based on how they're sorted, what values they have, and of course, what file/folders are associated with it. Consider being able to dynamically join different files/folders of rows and select/sort through data from multiple files.
Ex: If Author is a row in each of the files: "comments, profiles, blogs", then you might want to grab all of that data where "Author" value is for example, "Craig". Consider conditional arguments. (For example: 'Column "Author" is ("Craig" or "Jeff")' ). Also some functionality for conditions based on multiple columns is essential.
For all of this functionality, you might as well create a parser for a query language. . For Example:
Code:
Use myDB.blog, myDB.comments, myDB.profiles where Column "Author" is ("Craig" or Jeff") and Column "Active" is (1) and Sort("Date", descending)
Idk... What's wrong with MySQL/MsSQL or pre-built flat file DBs already out there?