Page 1 of 1

Why StartTransaction?

Posted: Tue 21 Nov 2006 07:53
by devmann
Hi,

I find that I can still successfully commit data to the database with the following codes even though I don't put a StartTransaction in the codes.
Why use StartTransaction?

Code: Select all

oraTable.ApplyUpdates;  // write data from memory to database
oraTable.Session.Commit;  // commit data
oraTable.CommitUpdates;  // clear cached memory
Is it because I'm in a client-server environment?

Then in what condition it is a must to use StartTransaction?

Thanx :D

dm

Posted: Wed 22 Nov 2006 14:39
by Challenger
This is Oracle specific. It allows to call Commit even if there is no active transaction.

Does it mean ...

Posted: Thu 23 Nov 2006 00:42
by devmann
Thanx. Does it mean I don't have to StartTransaction before a Commit as told in the ODAC online help?

Thanx
dm
challenger wrote:This is Oracle specific. It allows to call Commit even if there is no active transaction.

Posted: Fri 24 Nov 2006 14:52
by Challenger
No, this means that if you call the Commit method whithout call to the StartTransaction method you will not get error. But if you want to perform all the updates in a single transaction you should call StartTransaction before TOraTable.ApplyUpdates.