The xDBMS sample shows you how use the TFDLocalSQL class to implement a cross-DBMS query application. To this end, each queryable dataset must be registered with the Local SQL engine using the DataSets collection property.Note: The Local SQL feature allows executing SQL commands, where the TDataSet descendants are used instead of the database tables.
Table of Contents
You can find the xDBMS sample project at:
- Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to:
Object PascalDatabaseFireDACSamplesComp LayerTFDLocalSQLxDBMS
- Subversion Repository:
- You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
How to Use the Sample
- Navigate to the location given above and open
- Press F9 or choose Run > Run.
|File in Delphi||Contains|
|The project itself.|
|The main form.|
To setup Local SQL engine for a cross-DBMS query application, the sample has to perform the following steps:
- Set up an in-memory SQLite local connection (FDConnection1) as a query source from the Local SQL engine (FDLocalSQL1).
- Perform a local SQL query (FDQuery1).
- Connect the datasets (qOrders and qDetails) to the Local SQL engine.
To this end, the sample implement the following steps:
- Setup connection and query to “Orders” table in SQLite database and link the dataset to the Local SQL engine. To this end, the following components are needed:
- Setup connection and query to “Orders Details” table in MSAccess database and link the dataset to the Local SQL engine. To this end, the sample uses the following components:
- Setup SQLite in-memory connection. To this end, the sample sets up the following components:
- Execute a SELECT query on above datasets using:
Note: All the configuration of these components is done using the Object Inspector at design time.
When you run the application, click on the Open/Close button in order to set the Active property of FDQuery1 to
True. It executes the SELECT query on the datasets registered with this Local SQL engine. Then, the records from the registered datasets are displayed on a TDBGrid component.
For more information about this sample you can refer to the link below: