Page 1 of 1

TUniQuery, UniDirectional=TRUE and ExecSQL

Posted: Wed 21 Jul 2010 15:05
by RobertNoeth
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

Posted: Thu 22 Jul 2010 15:33
by Dimon
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.