Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transactions
Message
From
29/04/2002 13:09:26
 
 
To
29/04/2002 03:37:06
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00648654
Message ID:
00650476
Views:
29
>>Not quite sure that this is what you're looking for:
>>I have found that despite what the help file says TXNLEVEL() is scoped to the DATASESSION somehow. If you BEGIN TRANSACTION in one DATASESSION, change datasessions and check TXNLEVEL(), it shows 0.
>>
>>
>
>I try to be little more specific... When I call the code in the another object, TXNLEVEL() indicates that the transaction is active (TXNLEVEL() = 1).
>
>I'm quite confused because the tables are visible in all objects and the debugger shows that TXNLEVEL() is more than 0.
>
>I have tested my code in situations where two users start almost simultaneously an update, which launches this transaction. It updates five tables. In situation where the code is written directly into object another update fails and rollback&error message routine gets called. It works fine.
>
> But when I move the code in another object, partial updates occur and I get "update conflicts". Like there was no transaction at all. I am not sure can "update conflicts" happen within a transaction, but no partial updates anyway.
>
>My goal is to create a class that provide transaction management. That's why the ability to call others object's methods is important. (So that the transaction works, of course:))
>
>Hope this made the picture clearer...
>
>Thanks for your reply!

If I understand:
I don't think there is any way that a user can detect the TXNLEVEL() of another user. One wat to prevent another user from BEGIN TRANSACTION in the middle of your Transaction, is to lock all the files that will be updated before starting to Update.
llUpdate = .T.
DO WHILE !FLOCK(t1) or !FLOCK(t2) or !FLOCK(t3) or !FLOCK(t4) or !FLOCK(t5)
  IF INKEY() = 27    &&Escape pressed
    llUpdate = .F.
    EXIT
  ENDIF
ENDDO
IF llUpdate
  BEGIN TRANSACTION
    ..... (Update process here)
  END TRANSACTION
ENDIF
UNLOCK ALL
Bill Morris
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform