Using "reFind" tool to migrate BDE app to FireDAC with Delphi 10.1

Posted by on in Data Modeling & Architecture

Two weeks ago I was contributing to a bigger Delphi migration webinar run by my colleague Stephen Ball the demonstration of actual steps of live migration of BDE-based source code to FireDAC.

Migration of existing VCL projects to the latest version of Delphi is the hot topic in Delphi community. Many migration tasks can be automated. Today at the Developer Conference in Tel Aviv Embarcadero MVP Oren Aviram is demonstrating "Software Modernization Made Easy" with his powerful Pascal Parser tool. For smaller and easier tasks you can use "refind" command-line tool that is based on regular expressions and can process arbitrary text files for replacing occurrences of certain text patterns, like for example references to units in "uses" clauses and types of components in class declarations.

One of the demos that comes with installation of RAD Studio 10.1 Berlin (C:\Users\Public\Documents\Embarcadero\Studio\18.0\Samples\Object Pascal\Database\FireDAC\Tool\reFind\BDE2FDMigration\) shows that it is very easy to migrate the source code of an existing BDE-based Delphi "Marine Adventures" SCUBA shop application to FireDAC database access framework, InterBase database and Windows 10 with "reFind" command line utility that comes with RAD Studio 10.1.

Make sure that you have Delphi, C++Builder or RAD Studio installed on your machine and just go to the Windows command line and type "refind". The RAD Studio "bin" directory is on the path, so you should see the output similar to this:

Luckily the architecture of FireDAC database access library in Delphi is very similar to now deprecated BDE ("Borland Database Engine") as one of its original design goals was to be "a replacement" for the BDE. The online docwiki article "Migrating BDE Application to FireDAC" has the detailed description of how different types maps to their counterparts in both libraries.

The "refind" tool can take as parameter the location of the "rules" file that tells the tool how to replace different BDE references to FireDAC. The actual migration of source code is just the matter of invoking "refind" tool and passing the "C:\Users\Public\Documents\Embarcadero\Studio\18.0\Samples\Object Pascal\Database\FireDAC\Tool\reFind\BDE2FDMigration\FireDAC_Migrate_BDE.txt" file to modify all *.pas and *.dfm files. The migrated "Marine Adventure" SCUBA diving equipment VCL app looks great under Windows 10 with "glossy" style:-)

You can watch the whole process of migrating the BDE app to FireDAC on YouTube.


Gold User, Rank: 9, Points: 364
Crazy about Delphi Programming!


Check out more tips and tricks in this development video: