Re: Informix 7.2 ESQL/C Query Cancel Question
Posted in 1997
"Chez David" <dmitchell@SagentTech.com> wrote: :Hey, Readers, : :My DB is Informix-OnLine Version 7.20.TE1 for NT4.0. ( It's been up 1 day :6:53:09 :) ) :My client is also on NT 4.0. Esql7.20.TD1 : :I have this situation: : :Application 1 puts an exclusive lock on table A : : :Application 2 sets its lock mode to wait. In this case, no time-out period :is specified. :App 2 issues a select against table A, on which App 1 currently has an :exclusive lock. :App 2 has the capability to cancel SQL requests. :After several seconds, it "asks" the user if he or she would like to cancel :the request. :The user indicates yes, but the app still waits. :( The desired behavior is for app 2 to stop waiting ) :After several minutes, app 1 releases its exclusive lock on table A. :App 2 now wakes up and displays the results of the select. : :The question is: : :Does it sound reasonable that, since its mode has been set to wait, app 2 :would continue to wait ( block ), :even after there was an attempted SQL query cancellation? No it doesn't sound resonable, but not everything is reasonable in this world. I am not quite sure how you are able to ask the user for the cancel and then actually doing it while the application is waiting. Some kind of multithreading perhaps? Then I don't know ESQL/C too well, so may be there is a way to do this that ought to work. However there is another option that might be usefull. You might set the lock mode to wait a few seconds. You then have two options: 1. Ask the user if he wants to retry. 2. Do the retry immediately, but also ask the user if he wants to cancel. Then at the next end of the wait time (a few seconds) you would not retry any more if the user requested a cancel. You then simply loop retrying continously until the user hits the cancel button. Of course the last retry before the user hits cancel may be successfull, in which case you would have to decide what to do. If the user hit cancel, but got the data anyway it might get confusing. Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org