On 28 Aug 2018, at 11:52 am, Chuck Miller via 4D_Tech <[email protected]> 
wrote:
> 
> It does, but remember if you already have multiple transactions, you will 
> have to keep track and may have to suspend that many times

I don't think that is true. When you SUSPEND TRANSACTION, the effective 
Transaction level goes back to 0, so no matter how many levels deep you are, 
when you call START TRANSACTION after SUSPEND TRANSACTION, the Transaction 
level function always returns 1.

I'm pretty sure calling SUSPEND TRANSACTION more than once without resuming in 
between causes a run time error.

I just tried this and my changes are saved as I would expect:

QUERY([SomeTable];[SomeTable]UniqueId=1)
[SomeTable]Value:="ABC"
SAVE RECORD([SomeTable])
UNLOAD RECORD([SomeTable])

START TRANSACTION      ---> Transaction level = 1, In transaction = True, 
Active transaction = True
START TRANSACTION      ---> Transaction level = 2, In transaction = True, 
Active transaction = True
START TRANSACTION      ---> Transaction level = 3, In transaction = True, 
Active transaction = True

SUSPEND TRANSACTION      ---> Transaction level = 3, In transaction = True, 
Active transaction = False

START TRANSACTION      ---> Transaction level = 1, In transaction = True, 
Active transaction = True

QUERY([SomeTable];[SomeTable]UniqueId=1)
[SomeTable]Value:="XYZ"
SAVE RECORD([SomeTable])
UNLOAD RECORD([SomeTable])

VALIDATE TRANSACTION        ---> Transaction level = 3, In transaction = True, 
Active transaction = False

RESUME TRANSACTION        ---> Transaction level = 3, In transaction = True, 
Active transaction = True

CANCEL TRANSACTION      ---> Transaction level = 2, In transaction = True, 
Active transaction = True
CANCEL TRANSACTION      ---> Transaction level = 1, In transaction = True, 
Active transaction = True
CANCEL TRANSACTION      ---> Transaction level = 0, In transaction = False, 
Active transaction = False


QUERY([SomeTable];[SomeTable]UniqueId=1)

// [SomeTable]Value is now "XYZ"


**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to