Re: Quitting an SQL query in 4GL
Posted in 1992
Tony Heskett writes: > Thanks, very interesting. Be even better if they'd buy *me* 4.1 ;-) Personally, I didn't even want it. But we _had_ to upgrade to SunOS 4.1.2 (to run 1-2-3 :-(), and INF 4.0 isn't supported (we were told) under SunOS 4.1.2, so we _had_ to upgrade Informix to 4.1. Actually, some of the new features are things I've been hoping for. I'd be happy to upgrade if it were painless, as it should be. But ... > I'm not sure that this is a *good* way, but how 'bout something > like this ? You'll have to change the names to run it against > one of your own DBs, of course, but the general idea is that > exit_on_int() sets up the signal handling to call exit(2) when > you hit the interrupt key. At the same time, it saves the old > signal handler - the informix function which presumably does > "int_flag=1;" - so you can put it back later. (code and discussion deleted.) Well, I'm sure something like this can be made to work, if you've got the time. My experience leaves me reluctant to make assumptions about what the library routines are doing: some code I wrote early on worked fine for a year or two, but eventually required days of trouble-shooting to track down a bad interaction. And that piece of code seemed safer than this; tale of woe available upon request ;-( At least now when the upgrades aren't painless, I can blame it on Informix, instead of on back-door code of my own ;-) Rumor reaches me that an official, supported way of doing what we want may eventually be provided; my users have coped with 15 minute delays for interrupting big searches for several years now, so I figure they can wait another couple of years. Wrt your solution: is it really safe to call exit(2)? I would have thought you should call some Informix library routine to shut-down the back end, releasing any locks you might have seized, etc. The routine that gets called when you do an EXIT PROGRAM (whatever that might be) would seem to be the right thing. With 4.1 there's now a documented interface for calling 4gl code from C, and the new fgl_end() macro seems to be approximately what we want. But the documentation doesn't imply it can be used in the way we want, so unless someone at Informix vouches for it, I don't consider it safe. I hate to sound so cautious, but I just don't have time anymore to go poking around in undocumented internals. I'd rather tell my users "Sorry, it can't be done ..." -- Harry Bochner -- bochner@das.harvard.edu