Migrating AnyDAC Applications to FireDAC

From RAD Studio
Jump to: navigation, search

Go Up to Migrating to FireDAC


This topic summarizes the refactoring changes made during integration of AnyDAC into RAD Studio FireDAC, and describes how to migrate an existing AnyDAC code base to FireDAC.

Changes to FireDAC Compared to AnyDAC

If you are familiar with FireDAC's first incarnation (AnyDAC), here are some significant differences:

  • The API was renamed, including new unit names and new API prefixes.
    • Hierarchical namespaces are now implemented.
      • The previous unit names had the form:
        uAD<Layer><Role>.pas
      • The new FireDAC unit names, in general, have the form:
        FireDAC.<Layer>.<Role>.pas
      • Here are several examples:
        uADCompClient -> FireDAC.Comp.Client
        uADStanOption -> FireDAC.Stan.Option
        uADPhysIB -> FireDAC.Phys.IB
  • For FireDAC components, the name prefix changed from TADXxxx to TFDXxxx.
    • For global functions, the name prefix changed from ADXxx to FDXxx.
    • For exception classes, the name changed from EADXxx to EFDXxx.
      Several examples:
  • Run-time packages were renamed:
    • FireDACCommon190, FireDACCommonDriver190, FireDACADSDriver190, FireDACASADriver190, FireDACDataSnapDriver190, FireDACDb2Driver190, FireDACDBXDriver190, FireDACIBDriver190, FireDACMSAccDriver190, FireDACMSSQLDriver190, FireDACMySQLDriver190, FireDACODBCDriver190, FireDACOracleDriver190, FireDACPgDriver190, FireDACSqliteDriver190, FireDAC190, fmxFireDAC190, vclFireDAC190
  • Configuration files were renamed from ADXxx.ini to FDXxx.ini and relocated to C:\Users\Public\Documents\Embarcadero\Studio\21.0\FireDAC:
    • The FireDAC configuration registry key was relocated to HKCU\Software\Embarcadero\FireDAC.
      The key values are pointing to FireDAC configuration files:
      • DriverFile to FDDrivers.ini
      • ConnectionDefFile to FDConnectionDefs.ini
  • FireDAC samples are available in <RAD Studio Samples>\Delphi\Database\FireDAC.
    For more information about the samples/demos, see Samples Descriptions.
  • Support has been dropped for tools used with releases of RAD Studio before XE5.

Online Help for FireDAC

Migrating from AnyDAC to FireDAC

To simplify and automate migration of your applications from old to new FireDAC API, we provide:

reFind is a command-line utility, which uses Perl Compatible Regular Expressions (PCRE) to rename entities in the files.

Follow these steps to migrate an AnyDAC app to FireDAC:

  1. Make a backup copy of your application.
  2. Open the MS Windows command-line window.
  3. Go to your project sources root folder.
  4. For units and members, run the next two commands:
    • <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
  5. If your application is built with run-time packages, then rename the package references according to the package names given above.
  6. If your application is using driver configuration and/or persistent connection definition files, then rename the files according to the configuration file names given above.
  7. Review the modifications made by reFind.
Notes:
  • This approach does not guarantee 100% automatic and successful migration, as it is rule-based and there is not an exact, one-to-one name match.
  • We strongly suggest that you first create a backup copy of all your projects, although you can also use reFind to create backup copies of the changed files.

See Also