Re: Dynamic SQL and Informix Online
Posted in 1998
On Mon, 31 Aug 1998, Tim Friest wrote: > Jonathan Leffler wrote: > > > How can I tell if I'm running low [on memory]? > > > > Things stop working with out of memory errors? > > I would prefer to know before things stop working ;-) There is no way on Unix to reliably tell whether you are about to run out of memory except by trying to allocate it and failing. If you are using Micro$oft Windows 95/98/NT, maybe you can do better -- but the techniques used to do so will be independent of Informix software. > > > My program needs to create a bunch of dynamic functions and leave > > > them around since they will be used repeatedly. > > > > What do you mean by dynamic functions? > > I meant that I could just prepare the procedures and keep them around, > executing them when I needed them... We have a communication disconnect here -- your language doesn't make sense to my Informix-attuned eyes. If you are talking about stored procedures, then they are prepared when they are created, and kept around in the database until you either use them or drop them. In your application, you might prepare statements (not procedures) which use those stored procedures, and you could prepare those statements up front (or on demand) and not release them until you have done with them. If you are talking about some other sort of procedure, then you are either using a product which I know nothing about (which product are you using?) or you are using a product where the program is compiled and then run. The preparation of the procedures is the compilation step; the running of the program is the execution step. Neither of these seems particularly close to what you are probably asking about, so I'm wondering what your background is and which product you are trying to simulate. > > > The only other way I can think of to do this is to dynamically > > > generate create procedure statements and run them... Is this a > > > better solution? > > > > Well, at least I understand this solution and it will work, provided > > that the software is resilient enough to handle multiple processes > > all creating (and, presumably, destroying) the procedures, or is > > coded to ensure that the procedures are not destroyed when they are > > still in use. Until I know what you mean by dynamic functions, I > > can't tell you whether this is the best method or not. > > > > These procedures would only be used by my program, so that isn't a > problem... It is a problem if someone else creates a stored procedure with the same name as one of yours. > I this will be the best solution, I'll just have to keep track of their > names and parameters... I think you have to do that, anyway. What you'd really like, I guess, is a private procedure or temp procedure, analogous to a private synonym or a temp table -- probably more like the temp table than a private synonym, in fact. AFAIK, that is not an available option. Yours, Jonathan Leffler (jleffler@informix.com) #include <witticism.h> Guardian of DBD::Informix v0.60 -- http://www.perl.com/CPAN Informix IDN for D4GL & Linux -- http://www.informix.com/idn