Delphi XE5 shipped with a smart search and replace tool, further enhanced in Update 2, and now coming also with a BDE to FireDAC components migration script. As blogged recently by Stephen Ball, reFind is a command line tool available in RAD Studio bin folder. As the documenttion states, " reFind is a command-line utility for search and replacement of Perl RegEx text patterns in a text file ". In other words, you can find occurrences using regular expressions, and even do some input / output transformations. Here is its output, in a command window:
The complete documentation, with some demo commands, is at docwiki.embarcadero.com /RADStudio/XE5/en/ ReFind.exe, the Search and Replace Utility Using Perl RegEx Expressions. You can use reFInd with individual commands (like, replace this class name with this new class name in these PAS and DFM files) or pass to is a script with a collection of rules, to apply to one or more files. Delphi ships with some of these rules, as I'll explain in a second.
Now we might be wondering why we added this tool to Delphi. The answer is simple. With the introduction of FireDAC we needed a way to help developers migrate their code to the new library naming (that is, AnyDAC to FireDAC) and also migrate BDE components to their FireDAC equivalents. Under the RAD Studio Demos repository, there is a folder for reFind (Samples\Delphi\Database\FireDAC\Tool\reFind) and the two predefined scripts we ship, for these two conversions. In each folder you'll find the script with the rules. Note you might have to udpate the demos from the subversions repository, as there have been some changes in this section since XE5 shipped.
These are some sample lines of the BDE conversion script, with elements to remove, units to remove from uses, and conversion which might imply using specific units:
#unuse BDE.DBTables #migrate uaRetry -> eaRetry #remove SessionName #migrate TTransIsolation -> TFDTxIsolation, FireDAC.Stan.Option
While this BDE migration script won't automate the entire process (and you might also have to migrate the data), it can certainly get you started and perform most of the time-consuming automatic conversions, leaving you also to clean up the details. I'm compiling a document with an overview of the BDE migration that should be available shortly, but in the meantime you can refer to docwiki.embarcadero.com/RADStudio/XE5/en/Migrating_BDE_Applications_to_FireDAC.
The many new features, the current upgrade offer, and the migration tools make upgrading to XE5 before the end of the year a great idea! Give those old Delphi applications a new life!
PS: I'm wondering if we (or external Delphi developers) should try to prepare more scripts for Unicode migration, ADO migration, reports conversions, and the like. I know, this is not a full parser, so the rules are somehow limited...