[DUG] Chick or egg - My SQL Access

Graham Marsden graham at wk.planet.gen.nz
Mon Jun 25 14:03:20 NZST 2012


Hi Wallace

You mention TMyConnection which sounds like you are using the Devart components to connect to MySQL.so I 
am offering you my thoughts from this perspective.

My method with these components is to (as you do) store your MySQL login parameters in an ini file (encrypt the 
password of course)
Next on the app main form, place a TMyConnection and read in the login parameters (username, pw, database, 
host) from the ini file. Leave these fields blank in the compiled app as sometimes they don't get overwritten by the 
incoming ini options (have not full figured out why,  but it seems to work to leave them blank)
This connection BTW can be used by all forms in the app for subsequent queries once the connection is made. I 
have not encountered any need for more then 1 connection component no matter how many forms and queries 
are opened.

Rather than have one data module for the entire app I place the MySQL query components on the forms that use 
the query. This makes the app user-ready sooner and there are no complications with various forms moving the 
record pointer in a central query/dataset. Also I find each form has a slightly different query requirement anyway, 
so centralisation is no advantage.

So the 'egg' is the TMyConnection in the main form and the subsequent 'chickens' are the queries in the rest of the 
app's forms. As they are necessarily opened after the main for there should not be any sequencing problems.

Hope this helps - happy to go into more details on Devart components for MySQL if you need to.

Cheers

Graham Marsden.






More information about the Delphi mailing list