Acquainted with the
post about working with MySQL on Delphi.
Since I myself have been developing for a long time, I want to share my experience with readers.
What is needed:1. Delphi. I used 7 and 2007 versions. You can use any other, to the taste of the programmer.
2. MySQL. Any, starting with version 5.0. The DBMS is developing quite dynamically, it is important to use a stable version. Together with MySQL you will also receive the library libMySQL.dll - the client library, which can be put in the folder with the project for use in our "mercenary" purposes.
3. Last but not least, the library libMySQL.dll and MySQL.pas is the API interface for the library. This module describes all the constants and functions used in libMySQL.dll.
The best way to learn how to fully work with MySQL is to connect the MySQL.pas module to the project and directly use the functions from it.
Fortunately, there is a very good
manual for all the necessary functions.
This method is the best in terms of prospects, if the programmer wants to maximally manage the data in the process. But there is a minus - this path is not the shortest.
')
In order to “shorten” it, our colleague
Vitaly Leshchenko wrote a great wrapper class
MySQLClasses.pas .
Observed advantages of this approach:+ In the first place, of course, is mobility. You do not need to add any additional components to Delphi for use. Your project will open quickly and easily in any version of Delphi. After all, only 3 additional files are needed for use in the project folder: MySQLClasses.pas, MySQL.pas and, actually, libMySQL.dll itself.
+ Plus, which does not appear immediately, but will have a serious weight over time - understanding the principles of working with MySQL.
+ After using this approach in Delphi, PHP programming + MySQL will be almost the same as Delphi + MySQL (except for the syntax, of course). Similarly for C programmers and possibly some other languages.
Well and cons, of course:- The first minus, serious enough for newbies, - it takes time and some effort to understand this approach. But how can it be otherwise? After all, knowledge is not given differently.
- If you use only the source file MySQL.pas, then, in my opinion, this is somewhat inconvenient in terms of increasing the code. Sooner or later, you still want to write either your wrapper, or use a finished one, for example,
this one .
- If the programmer is faced with a trivial task - to show the entire contents of the table in the database in DBGrid, then perhaps this method will be somewhat longer than the others. But as soon as the task goes beyond the trivial, this method will be like a scalpel in the skilled hands of a surgeon (© D. Richie).
Summing up my story, I want to say that I have been using this method for about 4 years. And I have never regretted it.