Page 1 of 1

Prepare ?

Posted: Mon 18 Sep 2006 00:20
by RH
Hi

I am a bit puzziled about the prepare method. I have seen in the dokumentation That the prepare method can be called for TMemDataSet, TCustomDASQL and TCustomDADataSet

1. Am I right in the assumption that the prepare method does pretty much the same thing for all these three classes, and that is cause the MySQL SERVER to prepare a query for execution ? Or is there some preperatin done in Delphi too ?

2. You can also set AutoPrepare in Options for a TQuery. What is this exactly ?

3. I have an application that initiates a new Tconnection, TQuery and TCommand for every user that logs in. For every user a series of queries are executed, but the same query is not executed more than once. Do I need to call the prepare method at all ?

Please Help.

Kind regards

Posted: Tue 19 Sep 2006 12:32
by Antaeus
1. Yes you are right Prepare method means the same for these three classes. Calling Prepare method leads to preparing SQL statement on the server. All preparation is performed on the server, Delphi's part is negligible.

2. AutoPrepare option set to True means that Prepare method is called before execution every unprepared statement. Note, Unprepare method is called automatically if you change SQL property.

3. Preparation can speed up your application if you have SQL statement that needs to be executed multiple times. Most likely in your case preparation will slow the application down.

Posted: Tue 19 Sep 2006 18:44
by RH
Hi

Thank you very much for your reply :D