Is Query.Close necessary after Query.ExecSQL?

In Delphi, when I use TQuery to perform SELECT on a database, I follow Query.Open with a try. Finally, with Query.Close in the finally section. This makes sense to me, since Query will still store data (using memory) without the need otherwise.

But my question is when I use Query to execute INSERT or DELETE, which requires SQL to be run with Query.ExecSQL My question is: should I use Query.Close after Query.ExecSQL?

My thoughts, because this is a command that should be executed in a database that does not seem to return any data in Query, there is no need to do Query.Close But maybe someone out there has more in-depth knowledge about what, if anything, can be returned and stored in the query after the Query.ExecSQL query, for which Query.Close would be useful?

Thank.

+4
source share
1 answer

No, it is not needed because it ExecSQLdoes not support a set of records.

from the documentation (my attention):

SQL . ExecSQL SQL, SQL. ExecSQL , (, INSERT, UPDATE, DELETE CREATE TABLE).

. SELECT Open ExecSQL.

ExecSQL SQL , . , Prepare ExecSQL .

+4

All Articles