Re: sqlexit()
Posted in 1997
Jonathan Leffler wrote:
[SNIP]
You are right. After looking at sql_exit()
it should disconnect all references including the shared
memory segment so you should be able to effectively
shutdown Informix.
Since I haven't had to write a 4GL program in 3+ years, I have
gotten a little rusty. (Yes there is life outside Informix ;-)
Here is a simple test:
Foo.4gl
MAIN
DATABASE sysmaster
DISPLAY "THIS IS A TEST"
SLEEP 5
RUN "a2"
DISPLAY "BACK TO MAIN"
SLEEP 5
DISPLAY "Goodbye"
CALL i4gl_sqlexit()
WHILE (TRUE)
SLEEP 5
END WHILE
END MAIN
Retz.c (Code by Jonathan)
> int i4gl_sqlexit(n)
> int n;
> {
> if (n != 0){
> fgl_fatal("i4gl_sqlexit()", 1, -1318);
> }
> sqlexit();
> return(0);
> }
Bar.4gl
MAIN
DISPLAY "THIS IS BAR"
SLEEP 5
DISPLAY "ENDING BAR"
END MAIN
{ c4gl foo.4gl retz.c -o a1 }
{ c4gl bar.4gl -o a2 }
Now, you are probably wondering why I created bar.4gl.
This was to test informix about having a connection open
from a menu when I call a different program to run.
Informix does keep the calling program alive so that when
the child finishes, the calling program resumes. Hence
the database connection stays active until the end of the main
program.
OK, so lets see about having the program do an onmode -ky (?)
Add the statement:
RUN "onmode -ky"
just before the WHILE loop.
Works fine.
Again, I am leary of writing a 4GL program to control the engine.
(Yes Informix does it, but you are talking about an applicaion
which you have to support and may have some serious side effects.)
Most home grown DBA tools are shell scripts and there are some
compelling reasons in keeping them that way.
-Mikey
--
#include <std_disclaimer.h> /* Mike Segel (MS385) */
#include <No_Spam.h>
#ifdef OFFENDED_BY_CONTENT
The author takes no responsibility for this post.
Any resemblence to a coherent rational thought is purely coincidence.
-The Management.
#endif
*****************************
Due to AGIS's Refusal to Act Responsibly
We are blocking all of their domains at the packet level.
This block will exist until AGIS modifies their policies to
conform to existing RFCs and net community standards.
We encourage all ISPs and domain holders to do the same.
*****************************