Just for the record, the 5 minute mark refers to the time you need to read and understand the content. The actual migration took me 30 minutes.
Still, it is one of the major things that makes Delphi a very valuable product to me. A customer wanted me to make changes to an application that I wrote during the XE4 days. Just to be on the same page:
That means I touched this code in mid-2013 for the last time. About 4 years ago!
Normally, I would install XE4 in another Virtual Machine and go from there. This time, however, as it was a database-heavy VCL desktop application to input data, I decided to assess the time-frame needed to migrate the application to the current version.
The application also used several TMS components. As I still use their component sets and they already offer everything for Tokyo, I was opimistic, but I still expected some issues.
So, after getting the HEAD revision out of my versioning control system, I opened the project in Delphi Tokyo. I selected Clean and Build to see how many problems I would have to fight in order to make a decision:
Well, I was quite surprised. One issue:
Oh, right. Back then FireDAC was already called FireDAC, but the units and components still carried the “AD” moniker from “AnyDAC”.
Migrating FireDAC is the only thing to do. All TMS components worked out of the box!
Kudos to TMS. They always put reliability, longevity and compatibility first. Using their components paid off.
However, the remaining issue got very visible when opening one of the data modules:
Entering “Migrating FireDAC AnyDAC docwiki embarcadero” into Google yielded this as a result:
Perfect. Embarcadero provides tooling to do the migration.
Thus, I opened PowerShell and had a look at the mentioned “reFind” tool:
Excellent. Embarcadero provides several “Rule Files” that will make sure the migration will run smoothly. In my case, as I was using FireDAC as if it still were AnyDAC, I needed to go to
to find the rule sets I needed.
I then used the following two lines in my project directory to migrate the source code:
<RAD Studio>\Bin\reFind *.pas *.dpk *.dpr *.dproj *.inc /S /Y /I /W /B:0 /X:<RAD Studio Demos>\Delphi\Database\FireDAC\Tool\reFind\AD2FDMigration\FireDAC_Rename_Units.txt <RAD Studio>\Bin\reFind *.pas *.dfm *.dpk *.dpr *.inc /S /Y /I /B:0 /X:<RAD Studio Demos>\Delphi\Database\FireDAC\Tool\reFind\AD2FDMigration\FireDAC_Rename_API.txt
And that was it!
So the uses clauses that looked like this …
uses System.SysUtils, System.Classes, uADStanIntf, uADStanOption, uADStanError, uADGUIxIntf, uADPhysIntf, uADStanDef, uADStanPool, uADStanAsync, uADPhysManager, uADGUIxFormsWait, uADCompGUIx, uADPhysODBCBase, uADPhysMSSQL, Data.DB, uADCompClient, uADStanParam, uADDatSManager, uADDAptIntf, uADDAptManager, uADCompDataSet, System.IOUtils, Forms, Graphics;
…have been migrated to this:
uses System.SysUtils, System.Classes, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt, Data.DB, FireDAC.Comp.Client, FireDAC.Comp.DataSet, FireDAC.Phys.ODBCBase, FireDAC.Phys.MSSQL, FireDAC.VCLUI.Wait, FireDAC.Comp.UI, FireDAC.Phys.MSSQLDef;
Note that all AD-refrences have been updated with FireDAC.
Furthermore, all component references have been updated.
Connection : TADConnection; tblLanguages: TADTable; tblCountries: TADTable; qryLocCountries: TADQuery; ADPhysMSSQLDriverLink1: TADPhysMSSQLDriverLink; ADGUIxWaitCursor1: TADGUIxWaitCursor;
Connection: TFDConnection; tblLanguages: TFDTable; tblCountries: TFDTable; qryLocCountries: TFDQuery; ADPhysMSSQLDriverLink1: TFDPhysMSSQLDriverLink; ADGUIxWaitCursor1: TFDGUIxWaitCursor;
These are just some issues that are being automatically resolved. Also changes to the components and enumeration types etc. are being migrated.
The next clean, build-cycle did yield a working solution already.
A desktop-only VCL database application migrated from XE4 to Tokyo in less than an hour! And I even had to read the documentation, i.e. the actual process to execute the steps necessary was much faster!
Considering that I had desktop applications written in C# using Entity Framework or even Microsoft Lightswitch I was expecting much more of a hassle. Delphi has proven once again to be very much compatible with previous versions. When it comes to major changes, Embarcadero will provide proper tooling.
In case you still have a database application that relies on the BDE, there are also scripts available to convert all BDE components to FireDAC components. There will be more manual work needed, but it will provide you with a good start to get the job done in no time…