Re: Question: Can I embed SQL in C++
Posted in 1992
In article <9713@emory.mathcs.emory.edu> dave.snyder@snide.com (Dave Snyder) writes: Path: news.mr.med.ge.com!uwm.edu!rpi!zaphod.mps.ohio-state.edu!wupost!emory!snide.com From: dave.snyder@snide.com (Dave Snyder) } } I would like to know if anybody has any experience/success writing } embedded SQL statements inside a C++ program. } } We have an Informix database and a ESQL pre-processor meant } for C. According to the local agent from Informix, the SQL } pre-processor works only on C files, not C++ files. } We intend to use GCC as our C++ compiler, but we do not know } how to make the pre-processor work with GCC. } } Is there any way to work around the abovementioned problem? } To make the ESQL/C pre-processor work with gcc, do this: 1) vi $INFORMIXDIR/bin/esql 2) Change the "cc" near the bottom of the file to "gcc" 3) save your changes As for the C++ thing, you're on your own. It's not pretty but it's possible. You can't make SQL calls directly from C++ methods but you can but the calls into C functions and then call them from C++ using the extern C function prototypes. Look in you C++ manual for a section on calling C functions from C++. The worst stuff you will probably run into is managing host variables. -- Katharine C. Holder Computer People Unlimited, Inc. email: holderk@positron.med.ge.com "These opinions are my own and not necessarily those of the client for whom I am working or Computer People Unlimited, Inc."