SQL Interrupt bug ??
Posted in 1993
Hello fellow Informix users,
Lately I thought it was a good idea to build in the option 'SQL INTERRUPT ON'
in an Informix report program, to allow the users to abort a report which
they started by accident. As you know, some reports can take quite a while
and when you know beforehand that you don't want these data anyway ...
In doing so I encountered two problems:
- Despite of what our Manual Supplement of release 4.1 says, the program is
aborted after the SQL interrupt. But one can catch this with WHENEVER ERROR
CONTINUE, asking for the status and acting according to the value of it.
So no real problem here, only that the program does not quite do what the
manual says :-|
- I am able to interrupt the program when the cursor is OPENed, but when I
hit the interrupt key after that, ie. when the program is FETCHing the
records, it simply keeps going on processing.
I can hit Ctrl-C as many times (and as hard) as I like, the program just
keeps on running :-(
As far as this second problem concerns: I made a small example program to test
things out and that worked !!
So what's going wrong or am I missing something ??
The basic program looks like this (sort of pseudo-Informix-code):
MAIN
WHENEVER ERROR CONTINUE
DECLARE cursor FOR
SELECT field FROM table
CALL open()
START REPORT report TO "file"
CALL fetch()
FINISH REPORT report
END MAIN
FUNCTION open()
OPEN cursor
IF status = -213 THEN
EXIT PROGRAM
END IF
END FUNCTION
FUNCTION fetch()
DEFINE variable LIKE table.field
WHILE TRUE
FETCH cursor INTO variable
IF status = -213 THEN
EXIT PROGRAM
END IF
IF status = NOTFOUND THEN
EXIT WHILE
END IF
OUTPUT TO REPORT report(variable)
END WHILE
END FUNCTION
REPORT report(variable)
DEFINE variable LIKE table.field
FORMAT
ON EVERY ROW
PRINT variable
END REPORT
In this example it looks kind a strange to open and fetch the cursor in two
different functions, but the real program is much more complex and there it
sure makes sense to do it this way.
I also could use a FOREACH in this example, but the real program first
PREPAREs the SELECT-statement, then DECLAREs a cursor for that statement and
then has to use an explicit OPEN, because it has to fill in some variables
when opening it with the USING clause.
Now in the example-program I can interrupt the creation of the report if I hit
Ctrl-C a few times after another ! But in the real, much more complex thing,
it seems that the program does not catch the interrupt signal at all.
So it looks to me that Informix has problems catching the interrupt signal
when FETCHing records and processing them in a REPORT.
Am I right and is there a work-around for this or will it be or is it fixed
in a next release ??
For your information: we are running Informix SE version 4.10.UD1 on
Intergraph machines under CLIX 3.1 r.6.5.7 (which is Intergraph's version
of Unix SysV R3).
--
Marien de Clercq ___ "Don't believe half of what
Intergraph European Mfg. bv. /|/| // you see
Nijmegen - The Netherlands / | __// And none of what you hear"
E-mail: clercqm@nijmeg.ingr.com / |/_/ \\___ - Lou Reed