Subject Re: [IBO] [IB_SQL] How to use IB_SQL like SqlMonitor
Author Paul Vinkenoog
Hi Stefano,

>>> i agree but how ? everything is done clicking the post button on
>>> the TIB_UpdateBar, there is no code
>>> how can i prevent a commit cliccking the post button ?
>>
>> You should look at your transaction component. If you don't have
>> one IBO will create one for you, with autocommit=True. So you must
>> have a transaction component, and control this with that component.
>
> in the example a TIB_Transaction object still exist and its property
> AutoCommit is set to True
>
> after setting AutoCommit = false in wich way i need to modify the
> code source ?
>
> where start and commit the transaction ?
>
> in everyway i think even after this modify is it impossible cause
> the deadlock in the manner explained

If you want the example to "work" (i.e. to deadlock), drop a
TIB_TransactionBar on the form and connect it to IB_Transaction1
(not 2). Make sure Transaction1 isn't AutoCommit.

Now, first make sure there are unused invoice numbers or the next
number will simply come from the generator. That is: generate some
invoice headers and then cancel a few.

Commit Transaction1 using the button on the bar. (If you Commit
instead of CommitRetaining you might need to explicitly start
Transaction1 again. You can use the bar for this too, if you add
tbStart to the VisibleButtons property).

Then, insert *and post* a new record in the first instance of your
app, but don't commit the transaction.

Having done that, try to insert *and post* a new record from within
the second instance of your app.

This should give you the long-awaited deadlock.


Greetings,
Paul Vinkenoog