TUniQuery, UniDirectional=TRUE and ExecSQL

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
RobertNoeth
Posts: 1
Joined: Wed 21 Jul 2010 14:53

TUniQuery, UniDirectional=TRUE and ExecSQL

Post by RobertNoeth » Wed 21 Jul 2010 15:05

Hi everybody,

I'm using Universal Data Access 3.0.010 to access a mysql 5.1 database.

Today the following has surprised me:

I'am using a tUniQuery to update some data with generated sql-statemens like

insert into foo(bar) values (:bar)

in the TUniQuery.SQL property. Then i execute the Insert with the TUniQuery.ExecSQL method. Because of some other testing in this TUniQuery-Component was UniDirectional set to TRUE.

This has been used in a loop so about 1.000 times. Because of the poor performance i checked the mysql.log-file and find out that every call to ExecSQL opens a new connection, execute the insert and close the connection afterwards.

Setting UniDirectional back to FALSE (the default) anything works as expected: 1 connection, many inserts and 1 disconnection.

Can anyone tell me what's wrong with UniDirectional=true and .ExecSQL?

Thank you
Robert

EDIT: I forget to mention, i use Delphi 2006

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 22 Jul 2010 15:33

To solve the problem set the CreateConnection specific option of TUniQuery to False, like this:

Code: Select all

UniQuery.SpecificOptions.Values['CreateConnection'] := 'False';
You can find more detailed information about this option in the UniDAC help.

Post Reply