Delphi Community Ed. database tutorials, part 1
Delphi Community ed. databases
It's a common misconception that with the free Delphi Community you can NOT build database applications. In several articles on the web, even on Embarcadero's site, it says that Delphi Community is for applications "without database connectivity", and that "database components and drivers are not included". That's not correct: Delphi Community definitely does contain TClientDataSet, TFDConnection (FireDac database), TDataSource, TDBGrid, TDBEdit, and more!
Introduction to databases
Let's consider the example of a database for a books library. The card catalog was a familiar sight to library users for generations. It contained catalog drawers for the books (with a reference card for each book), drawers with cards for the members (borrowers) and drawers for the lendings (loans). Additionally, there could be catalogs for authors, keywords, etc.
In the traditional books catalog, each card contains bibliographic information about one book, including the title, subject, authorís name, date of publication, ISBN number, and maybe even approximate location (on bookshelf).
In a digital database, we use the following designations:
In a Delphi database application, you need at least:
For this set of our tutorials, we'll use Delphi's TClientDataSet component. It represents an in-memory dataset, that can be used as a fully-functional, stand-alone, file-based dataset. It can read / write its data from/to a file on the hard disk.
Note: you can also use SQLite for database applications: see our SQLite tutorial.
MyBase: stand-alone ClientDataSet
For a single-user database application in Delphi, the simplest approach is to use a ClientDataSet component
and map it to a local file. This is different from the traditional data mapping to a file.
The traditional approach is to read from the file a record at a time.
MyBase is used as a synonym for ClientDataSet. It's also called the Briefcase Model. MyBase generally saves the data in XML format, although the binary CDS format is also available.