Extract, Transform, Load – The Magic Behind HeidiSQL
HeidiSQL is a wildly successful open source database management tool. Apart from being extremely useful in the management of MySQL, SQL Server, PostgreSQL and SQLite databases it is also open source – and that source code is written in Delphi. We’ve taken a brief overview of it before but that time we only scratched the surface of this wonderfully artful example of Delphi programming at its best. The code itself is packed with really great techniques. Let’s take a closer look at it. Things you will need to compile the HeidiSQL code You need RAD Studio Delphi 10.4 or higher. I used Delphi 10.42. It’s easier if you have some form of Git source code control client installed. I used my favorite GitHub Desktop client. The HeidiSQL source relies on two custom components – the source for them is included in the HeidiSQL source download. You should also download and install madExcept. Installing madExcept If you haven’t come across madExcept before you’re missing out! It’s a really great tool for intercepting and reporting on program exceptions which occur while your program is running. The website explains in more detail but I thoroughly recommend it. Go to http://www.madshi.net/madExceptDescription.htm Download and run the installer Make sure you check madExcept v5. The installer is a little bit confusing – click on version 5 and it will select it to be installed (the default is not to install version 4 or 5 which has confused me in the past!) When it’s properly installed there will be an extra menu item added to your RAD Studio tools menu Getting the HeidiSQL source code Head on over to the HeidiSQL site and click on the “download source” button. This will take you to the following link: https://github.com/HeidiSQL/HeidiSQL Installing the required third-party components HeidiSQL relies on two additional components. Note that both components are very popular so make sure you don’t already have them installed. If you don’t have them installed follow the instructions below. The required items are: SynEdit to provide a syntax-highlighted query editor area. VirtualTreeView to implement a number of very fast tree and listview style UI views. Installing SynEdit Navigate to the .HeidiSQLcomponentssyneditPackagesDelphi10.4SynEdit.groupproj project and load it. Right click and compile the SynEdit_R project and then right click and select “install” for the SynEdit_D design-time package. Installing VirtualTreeView Navigate to the .HeidiSQLcomponentsvirtualtreeviewpackagesDelphi10.4VirtualTrees.groupproj and load it. Right click and compile the VirtualTreesR runtime package. Now right-click and select “install” for the VirtualTreesD design-time package. Compiling required resource (.res) files There’s a little bit of a gap in the steps I saw about compiling HeidiSQL from source code. There are a few .rc resource files for things like icons and fonts and there didn’t appear to be anywhere saying that they needed to be compiled. I may have missed them (I did try compiling the various group projects) in which case let me know in the comments and I’ll update this post with the correction – but until then do the following: Navigate to the .HeidiSQL root source folder. In there is a batch file called “build-res.bat” – run that file. It should complete without errors. Now navigate to the .HeidiSQLsourcevcl-styles-utils folder. In there is a file called “CompileResources.bat” Edit that file with a text editor and remove the paths at the start of the […]
