transactions

ploht

Member
I am evaluating DOA and cannot figure out how to start a transaction. With BDE compatible code it would look like

DataBase.StartTransaction;
try
DoSomeStuff
DataBase.Commit;
except
DataBase.RollBack;
end;

How do I do this with DOA? I see the rollback and commit methods of the session component, but no begin/start method.

Thanks
 
In Oracle a transaction is implicitly started with the first insert, update,
delete or lock statement. There is no real StartTransaction equivalent. You
code would therefore look like this:
Code:
try
  DoSomeStuff
  OracleSession.Commit;
except
  OracleSession.RollBack;
end;

------------------
Marco Kalter
Allround Automations
 
In Oracle you can explicitly start transaction using:

set transaction [read only|read write]
set transaction isolation level [serializable|read committed]
set transaction use rollback segment rbs_name

Joachim Rupik
 
Originally posted by mkalter:
In Oracle a transaction is implicitly started with the first insert, update,
delete or lock statement. There is no real StartTransaction equivalent. You
code would therefore look like this:
Code:
try
  DoSomeStuff
  OracleSession.Commit;
except
  OracleSession.RollBack;
end;


I have the same problem, replacing StartTransaction to some DOA alternative.

The solution you propose makes it look like you always have to do a commit to really post your changes to the database. Is this so? That would really make it a pain to convert all our applications to DOA. Having to add Commits to all units is almost unfeasable.

I noticed a property 'Autocommit' for the session component, but they advise against using it, as it would disapear in version 3.4.
So what it the right aproach then (I'm really puzzled)?

Best regards

Frank De prins
 
From mkalter "In Oracle a transaction is implicitly started with the first insert, update, delete or lock statement. There is no real StartTransaction equivalent."

Question-- how does this work in a multi-tier environment with using ClientDataSet.ApplyUpdates? I think that automatically tries to do a StartTransaction, but I could be mistaken.
 
Frank,

Yes, this means that all your singleton DML statements need an explicit commit. See my reply to "Tool available for converting from BDE to DOA?" started November 6th, 2001.
I would like to stress that IMHO the work involved is not really as bad as it looks, and is actually worthwhile from other points of view.
 
Note that if you post a record in a TOracleDataSet, it will be implicitly committed (if CommitOnPost = True and CachedUpdates = False).

TOracleSession.ApplyUpdates will also implicitly commit.

Only if you explicitly perform insert, update, or delete statements, or if you call stored program units that perform any of these DML statements, you would have to explicitly commit the transaction.

------------------
Marco Kalter
Allround Automations
 
Back
Top