Subject Re: [IBO] [IB_SQL] How to use IB_SQL like SqlMonitor
Author Stefano Campri
----- Original Message -----
From: "Paul Vinkenoog" <paul@...>
Newsgroups: egroups.ibobjects
To: <IBObjects@yahoogroups.com>
Sent: Friday, June 13, 2003 12:33 PM
Subject: Re: [IBO] [IB_SQL] How to use IB_SQL like SqlMonitor


> 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
>

You are right : this is another solution

i have yet got the long -awaite deadlock
locking the record via IB_SQL and
posting a new record from the test application

Now i have a new one question :

Setting LockWait = true the deadlock error is raised only when the lock
condition is removed

is it correct to intercept the deadlock and handle it
in the TIB_Queery.OnPostError ?

what's the best solution to intercept the deadlock
and try to post again ?

Thanks in advance

Stefano Campri