Delphi : Migration from Paradox/Bde  to MYSQL5.x

Posted on 2011-09-14
Last Modified: 2013-11-23
Sorry to submit the same question again, but I am in desperate need of help
My company has many applications written in Delphi 2007 using paradox and bde.
Initially I was going to convert the code and use MYSQL 5.x but the company decided to migrate from Delphi to C# connecting to MYSQL on a remote Linux server
This project has stagnated and hence I have been asked to review the Delphi code as a short term solution
Please can somebody recommend the efficient method to do this, I assume I will have to replace in the code where I use tquery commands to view / add/delete/ edit tables which is going to time consuming
One of the main points will the option connect to MYSQL on a remote Linux server as well a local server
Question by:SSSIAN
  • 3
  • 2
  • 2
  • +1

Expert Comment

ID: 36535416
ADO has a lot more flexibility to switch to mssql/mysql/odbc/ole
LVL 25

Accepted Solution

epasquier earned 450 total points
ID: 36536083
Ah, the good old Delphi to C# projects...

I can't understand why a company having loads of Delphi legacy application would want to convert to C#.
I know the argument that there are much more low-cost developers available in C# than Delphi, but I would say that any good C# developer can learn Delphi in much less time and cost than the bunch necessary to rewrite the application(s).
And developers that cannot learn Delphi are not worth the effort anyway, even with a managed language they will most certainly create more bugs than features.
But that is so with deciders that do not want to invest in their people, and only follow the roads taken by the vast majority, and the cold feet saying MS is a more secure investment.

That said, my bad mood about this sensible issue being a bit quietened :
* BDE is deprecated since a very long time (even at the time of D2007, so it was already a bad choice)
* I will not even talk about Paradox, that is so old and deprecated that it has a list of issues with modern OS that would

So yes, there is a real need to change DB choices for these applications (But that certainly doesn't mean the language, Delphi, has to be changed). What can you do :

* ADO is a not so bad choice, it can work easily with all kind of server, located anywhere, with just a connection string to input as parameter (put it in INI file). Most of the code of your application should work the same after that, except for particular SQL functions that can differ from one DB to the other (try to avoid specific SQL)
But ADO is not very efficient. Of course, compared to Paradox+BDE, what an improvement it will be.....

* DBExpress : lots of pro and con about it. Some says it's not as good as ADO because of a restricted feature tests, but those are mostly old saying - ADO didn't changed much since 5, while DBx never stopped adding nice features. That is what they say, I never used it myself.

* Now, let's talk about the SERIOUS alternative, but that involve some political choice from the same guys that decided to go to C# : DevArt components @
DevArt is the White Wolf as far as DB connectivity is concerned : they have a very complete set of native connectivity for all DB. Ultra fast, efficient, feature set complete, and not too expensive. You can either BUY one component set specific to ONE DB - like ODAC (Oracle Data Access Components), or BUY the complete UniDAC huge set that will allow complete independence of the DB, and keeping very good performances nevertheless.
Well, in your case, I would go for MyDAC (MySQL DAC) , only 200$ for a single user licence in Pro version. And better prices for multi user licence of course.

If you can convince your boss that your time is worth 200$ of components set, then you have your best option. And maybe, when he will see the result, he will also decide to stick to Delphi....

Author Comment

ID: 36536126
To epasquier
Thank you for your rant and useful advise, if I converted to MyDac, would if be painfull task of replacing all calls via tquery / ttable and query commands
I did think about using this before, but on investigation there seemed to be lot of code change

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

LVL 25

Expert Comment

ID: 36537123
you cannot avoid a bit of work. But, if your code is well written, you don't have much dynamically generated SQL, it should remain fairly untouched, beyond the initialization of the connection.

By well written, I mean you use Params instead of building the SQL text, you use fields variables added at design time instead of constantly access those with FieldByName at run time etc...

Replacing the components can be helped a lot by 'Replace Components' function in GExperts for example
I haven't tried it on TTable but it worked miracles with buttons and other standard components replaced by Jedi more advanced components, and I upgraded my interface in all my projects in seconds.
LVL 45

Assisted Solution

aikimark earned 50 total points
ID: 36540550
I'll defer to epasquier on the specifics, but I think the only sane path would be to get the data into MySQL and upgrade the Delphi application to access the data.

Then look at a more current version of Delphi that can create .Net applications using Prism (VS IDE).  Once you have a .Net application, look at one of the .Net language translators that express an assembly in any given language -- select C# as the output.  I don't expect that the C# code will be pretty, but it is a starting point for the Delphi-to-C# migration.  You would transfer comments and variable/property/function names from Delphi to the C# code.

In general, I agree with epasquier's assertion that a language conversion (for conversion's sake) doesn't make sense.

Author Closing Comment

ID: 36541362
Thank you for confiming the solution already had in mind
LVL 25

Expert Comment

ID: 36541490
aikimark, if you were not so valuable to this community, I should hire assassins for your explaining how to migrate 'easily' from Delphi to .Net.
Another thing that saves you is that, while I haven't done it myself just in case I loose my soul in the process, I'm confident that it is not so easy to create the .Net application (even using Delphi language) if the code has not been very well written or is using too much specific code.
After that, sure, language translation is a great feature of .Net. But I would leave that easy part of the work to the next poor guy maintaining the project that doesn't understand Delphi syntax and need to makes his brain sorry reading poor unreadable C syntax.
(Never loose an occasion to resist if it's cheap)
LVL 45

Expert Comment

ID: 36543023

I didn't mean to infer that a Delphi-to-C# code migration would be easy or painless.  The source code produced from the assembly is (will be) ugly, possibly bordering on fugly.  The best way to stop such a task is to go through the steps to produce some C# code from some non-trivial Delphi program and show management the work that will need to be done to transform the C# code into a maintainable code base, suitable for production.

>>if you were not so valuable to this community
Thank you for that kind thought (and not calling out any assassins)

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question