Converting Delphi Datamodules from KADao to Firebird

For various reasons, I prototype databases in MS Access (accessed via KADao components) and later convert them to Firebird (accessed via Interbase components). Part of the process requires converting the datamodules.

In general, to create the datamodule you should follow the instructions in Connecting to a Firebird (Interbase) Database ... this page relates mostly to coding differences - ie, how to migrate existing code from one datamodule to another.

Database Connection | Select Queries | SQL | | Debugging Queries


Database Connection

There are acually quite a few differences here, this is the most important


Select Queries


SQL

This query is used with KADao components - the search string is in double quotes. This query is used with Interbase components - the table and field names are in double quotes, and the search string is in single quotes.


Select Query Code Fragments

These examples show the similarities and differences between MS Access and Firebird.

MS Access/KADao example

Interbase/Firebird example


Select Query Code Fragments

This demonstrates additional differences (square brackets) - this time attached to an SQL property.

MS Access/KADao example

Interbase/Firebird example - as shown, this fails because it contains expressions Note the use of a parameter - :Group_ID_Parameter - requires setting ParamType and ParamCheck.


Insert/Update Query Code Fragments

Insert, Update, and Delete queries are different from Select queries because they don't return a dataset.

In these examples, Sample_ID is a number.

MS Access/KADao example

Interbase/Firebird example (not tested ... yet)


Debugging Queries

With Interbase/Firebird, debugging queries is sometines a real pain - you edit the query and run it ... but there is no difference.

There is obviously some kind of cache, and simply restarting your program does not affect it.

Changing field names and intentionally introducing errors has no effect - the old results are still returned.


Other


Author: Robert Clemenzi - clemenzi@cpcug.org
URL: http:// cpcug.org / user / clemenzi / technical / Databases / Delphi / Firebird / Datamodule_Conversion.html