Re: ESQL/C
Posted in 1996
Assuming you are using 5.0x or later ESQL/C, you can use string-named cursors: EXEC SQL BEGIN DECLARE SECTION; char *c_name = "c_systables"; EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE :c_name CURSOR FOR SELECT * FROM SysTables; EXEC SQL OPEN :c_name; EXEC SQL FETCH :c_name; -- Needs an INTO clause, really EXEC SQL CLOSE :c_name; EXEC SQL FREE :c_name; This does what you want, and without you having to use malloc() -- unless you particularly want to use malloc(), in which case, of course, you can. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> >From: Andreas Stolle <100761.1473@compuserve.com> >Date: Mon, 09 Sep 1996 23:20:28 +0200 >X-Informix-List-Id: <news.27893> > >Is it possible to write an ESQL/C-Programm, using cursors assigned by >malloc. >For example: cursor = malloc(sizeof(CURSOR)); > $prepare cursor for ... > >This would help to write central Database-management routines, handling >with an unknown number of open cursors simultaneously. > >We've realized this problem using MS-SQL Server. >Is there a way for Informix ?? > >MFG > >Andreas >