Diman
Admin
 Admin
| Posts: 1495 |  | Karma: 19 |
|
RE: NCOCI Insert and Post Errors
|
|
Posted: 2000/08/01 18:50 |
|
|
|
|
1) This is because, when AutoCommit = False, then first DML command, that modify database, implicitly start transaction. And this TX become active until session end or COMMIT (in your case - until session end). You must use explicit transactions handling and AutoCommit = False or implicit transactions handling and AutoCommit = True.
2) The error (ora-907) was due to TOCIQuery automatically creates update query, using following technique: Original query = <some SQL query> Update query = UPDATE (<Original query> SET ... WHERE ... So, in your case update query will equal: UPDATE ( select * from <table> where key_field = <value> for update nowait ) SET ... WHERE ... But this is disallowed by Oracle syntax.
As i see, you want to use pessimistic locking. For that you should use TOCIUpdateSQL. Set TOCIQuery.UpdateObject to it. Set TOCIUpdateSQL.LockMode = lmPesimistic, LockPoint = lpImmediate. Exclude FOR UPDATE NOWAIT phrase from your query. Now query.edit will lock record, query.post will update database and unlock data.
But you can also override SQL's that TOCIQuery uses for database update / insert /... For that use TOCIUpdateSQL.SQL* properties.
|
|