- If you haven't done so already, create a new folder \DelphiLand.
- If you haven't done so already, create directory SQLiteGeo
- Next, download sqlitegeo.zip and
unzip it to this directory.
A closer look
- Start Delphi and open sqlitegeo.dpr.
- In the the menu, select Project / Options...
- In the dialog that appears, select Delphi Compiler / Output directory
Clear this option and click OK.
That way, you avoid the need to enter a hardwired full path when setting FDConnection.Params.Database (see later).
- Open Delphi's File menu and click Save All.
The structure of the table Countries of database Geo.sqlite is as follows:
- In Design Mode, let's have a look at the components:
- FDConnection1 is a FireDac connection: it defines the connection parameters, establishes
a connection to a DBMS
(DataBase Management System) and manages the associated datasets.
- qCountries is a TDFQuery (FireDAC Query). Its property Connection is set to
FDConnection1 and its property SQL is set to
select * from countries
...meaning: select all fields from table countries
- dsCountries is a TDataSource, the interface between a dataset component
and data-aware controls. Its property DataSet is set to qCountries.
- gridCountries is a TDBGrid (DataBase Grid) that is used to visualize the contents
of the table Countries. Its property DataSource is set to dsCountries.
- DBNavigator1 is used to move through the data in the dataset and perform operations on the data,
such as inserting a record or posting a record. Its property DataSource is set to dsCountries.
- FDGUIxWaitCursor1 is a component that is needed for every FireDac application.
- Since most work has been done in Design Mode, the source code for this project is really minimal:
procedure TForm1.FormShow(Sender: TObject);
procedure TForm1.FormDestroy(Sender: TObject);
Crash Course Delphi