Re: sqlexit()
Posted in 1997
}From: Mike Segel <Postmaster@127.0.0.1.informix.com> }Aka: Mikey@NOSPAM.KingofMyDomain.MAPSON.Segel.com, I'm only responding to this because the answer is wrong. }Date: Wed, 03 Sep 1997 13:41:36 +0100 }X-Informix-List-Id: <news.42451> } }Art S. Kagel wrote: }> Rich Sedman wrote: }> > Hi, I havn't been following this group so sorry if this has already been }> > covered or is in the faq. Anyway, I need to disconnect from a database }> > and server in 4gl 6.0 and above (online and SE) so that I can bring the }> > server down. I've found reference to a function sqlexit() but this }> > doesn't seem to exist. 'close database' doesn't quit the sql process }> > either. Anybody come across this before or got any better ideas how I }> > can do the equivalent of a 'disconnect all' in 4gl. }> }> The 6.0 4GL libraries do indeed have both sqlexit() and sqldetach() }> (do: nm $INFORMIXDIR/lib/tools/*.a | fgrep sqlexit to search). But, }> both are "C" functions which take no arguments and returns an integer }> (0 if successful <0 if not successful). You will have to write 4GL }> callable wrappers for these. }> }This kinda falls into the "Whydcha wanto dothat" (Why do you want to }do that) category. Because the program is a menu application which reads a menu system from the database and then presents the menu to the user. The menu options all run programs which interact with the database, but the menu program itself never interacts with the database again. }Implicitly, you want to connect to the informix engine if you have a 4gl }Program. Normally, this is the case. There are many special cases where that is not true. }So why would you want to have a 4GL program without a connection to the }engine? } }IMHO, I don't think that it is possible. IMNSHO, you're wrong. }Anyone take the time to walk through the C code generated by the 4GL }preprocessor? It would give you a clue how you could hack a way to do }this. (And it would be a nasty hack!) No, it isn't! In the I4GL code, you write: CALL i4gl_sqlexit() The C code that is compiled need only be: int i4gl_sqlexit(int n) { if (n != 0) fgl_fatal("i4gl_sqlexit()", 1, -1318); sqlexit(); return(0); } If you want to return the status from sqlexit(), then you refine the code to read: retint(sqlexit()); return(1); But first you check that sqlexit() really does return a usable value. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> PS: Warning I do not (normally) reply to messages with anti-spam in the return path.