return value of TMyConnection.ExecSQL ?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
RH
Posts: 31
Joined: Sat 16 Sep 2006 06:32

return value of TMyConnection.ExecSQL ?

Post by RH » Thu 21 Sep 2006 00:27

Hi

I have a couple of questions, so I hope you bear with me please :mrgreen:

1- I can see from the dokumentation that TMyConnection.ExecSQL is a function that returns a variant. But what exactley does the return value mean ? When I try to inspect it, the return value is "NULL"....

2- The TMyConnection.ExecSQL takes two parameters, first is SQL statement, second is an array of variant. I do not have any params, so I just make the call: MyConnection1.ExecSQL(SQL, []); Is this the best way to do, when you dont have a any params ? or would this lead to unwanted overhead ?

3- If some error is returned from the MySQL server, can I trust that the TMyConnection.ExecSQL always returns an exception, so I know of the error ?

4- If one has the TMyConnection.ExecSQL, when do one need the TMyCommand ? that is, what advantages does the TMyCommand have over executing directly with TMyConnection.ExecSQL ?

5- And Finally: What is the TMyScript for ? couldnt we just use the TMyCommand or the direct TMyConnection.ExecSQL ? what are the advantages of TMyScript ?

And that concludes my LONG series of questions. I thank you for the good support in this forum. I think I now will be able to finish implimentation and start testing.

Kind regards :D

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 22 Sep 2006 12:26

1- Meanwhile this result value is always NULL and we do not plan to change this behaviour in the nearest future.
2- If you do not pass parameters to ExecSQL method then query is executed directly. If you pass one or more parameters then TMyCommand object is used.
3- Yes, you will know about all errors that are raised on the sever when addressing to it.
4- There is not a big difference between these two ways. But TMyCommand itself has some options that are not used by MyConnection.ExecSQL.
5- TMyScript separates multi-statement queries and executes them statement by statement. This is actual for old servers that do not support execution of multi-statement queries. Please pay attention on ExecuteNext method of the TMyScript.

RH
Posts: 31
Joined: Sat 16 Sep 2006 06:32

Post by RH » Mon 25 Sep 2006 07:23

2- If you do not pass parameters to ExecSQL method then query is executed directly. If you pass one or more parameters then TMyCommand object is used.
does this mean that my call:
MyConnection1.ExecSQL(SQL, [])
is correct ? that is it will be executed directley, and no call will be made to the TMyCommand ?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 25 Sep 2006 07:41

Yes, you are right.

RH
Posts: 31
Joined: Sat 16 Sep 2006 06:32

Post by RH » Mon 25 Sep 2006 16:04

OK thank you very much :mrgreen:

Post Reply