Build your own Database EngineIn our next series of lessons, we'll show you how to set up a "flat file" database based on CSV files.
A full blown database system is often overkill for simple storage and retrieval of data. Just format your data according to some simple rules and save them in a text file. That's good news if you're on a small budget: you don't need the quite expensive professional edition of Delphi with its database components, a personal version will do.
The CSV File Format
The CSV (Comma Separated Value) format is often used to exchange data between different applications. CSV has become a pseudo standard throughout the IT industry.
CSV files are set up according to the following rules:
A quick way for building a CSV file, is saving a Microsoft Excel
worksheet as a CSV file.
However, if you live in a country where a comma is used as decimal separator rather than the decimal dot (France, Belgium, Germany, Sweden,... versus USA, UK,...) Excel uses a semi-colon to separate the fields. For this, Excel looks at Windows' International settings. Example:
In the next lesson projects, we will stick to the original CSV format. We always use commas for the field separators and points (dots) for the decimal separators:
In order to make CSV files for testing, you can force Excel to use
the comma delimiter if it uses the semi-colon: just temporarily change
your Windows configuration. Or use a text editor to firstly replace the
commas with dots, next replace the semi-colons
Later on, we'll write a conversion utility for non-standard CSV files with semi-colons.