Using Transactions

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
chkaufmann
Posts: 82
Joined: Sat 01 Jul 2006 11:42

Using Transactions

Post by chkaufmann » Thu 22 May 2008 12:36

I have a question regarding using transactions. I create all components from scratch:

conn := TUniConnection.Create(nil);
trans := TUniTransaction.Create(nil);

qry1 := TUniQuery.Create(nil);
qry1.Connection := conn;
qry1.Transaction := trans;

qry2 := TUniQuery.Create(nil);
qry2.Connection := conn;
qry2.Transaction := trans;

My questions are:
1) should I call the StartTransaction/Commit methods of my TUniConnection or my TUniTransaction. What's the difference?

2) Many single calls to qry1.Execute and/or qry2.Execute are not wrapped in StartTransaction/Commit. I just let it be done by "AutoCommit".
When I do something with a large number of Execute calls. I wrap these calls in StartTransaction/Commit calls.
Will this work fine like this? Checking with the debugger, I think, even then, CommitRetaining is called after each Execute call. So can I change the AutoCommit Flag of a TUniQuery at runtime?

3) Is there a document about good practice to use transactions with UniDAC?

cu Christian

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Thu 22 May 2008 13:07

Please refer to the "Working with transactions" topiс in UniDAC Help.

Post Reply