cookson@uwovax.uwo.ca (03/02/90)
Hi out there, I'm hoping someone can give me some help. I'm using the Ingres dbms, particularly embedded sql in the C language. My problem is, this university does not have the companion guide for the C language for use of embedded sql. I know their exists a command called esqlc that converts the sql statements into C code. What I need to know is how to compile the resulting output file. I've typed: esqlc -foper2.c oper.c cc oper2.c - I get errors here - undefined command Do i need some switches on the cc command, or should the file be including anything? Also, are there any special language dependencies that I should know about. In particular, on the EXEC SQL WHENEVER SQLERROR command, how does one invoke a call to a subroutine. It keeps giving me errors related on the opening bracket of the parameter list for the function I want to call. Any and all hints and advice welcome. You can post to the net, or better yet send email to cookson@uwovax.uwo.ca or cookson@gaul.csd.uwo.ca Thanks in advance for any help! TTFN Mike Cookson
ron@augeas.AthabascaU.CA (Ron Haukenfrers) (03/06/90)
cookson@uwovax.uwo.ca writes: >Hi out there, I'm hoping someone can give me some help. I'm >using the Ingres dbms, particularly embedded sql in the C language. >My problem is, this university does not have the companion guide for >the C language for use of embedded sql. I know their exists a >command called esqlc that converts the sql statements into C code. >What I need to know is how to compile the resulting output file. >I've typed: >esqlc -foper2.c oper.c >cc oper2.c - I get errors here - undefined command >Do i need some switches on the cc command, or should the file be including >anything? Also, are there any special language dependencies that I should >know about. In particular, on the >EXEC SQL WHENEVER SQLERROR command, how does one invoke a call to a >subroutine. It keeps giving me errors related on the opening bracket of the >parameter list for the function I want to call. >Any and all hints and advice welcome. You can post to the net, or better >yet send email to >cookson@uwovax.uwo.ca or >cookson@gaul.csd.uwo.ca >Thanks in advance for any help! >TTFN >Mike Cookson Here we use the folowing to run files through esqlc. All our embedded SQL source files have the extension .sc to distinguish them from regular .c files: esqlc -p -o.h file.sc cc $(CFLAGS) file.c rm file.c The -p option tells esqlc to include #line commands in the .c output file so the c compiler will be able to print error messages referenced to the line number in the .sc file. The -o.h tells esqlc when including files using the EXEC SQL INCLUDE command, to convert them to the standard .h extension. Make sure they originate with some other extension, we use .i I have created a set of suffix rules that can be used in a makefile to automate the compile: ------------------------------------------------------------------------------ ESQL=esqlc EFLAGS=-p -o.h # # Redefine the suffix rules to allow INGRES files to # compile automatically. This also forces make to look for a .sc # file before a .c file when checking targets # .SUFFIXES: .SUFFIXES: .o .sc .sc~ .c .c~ .y .y~ .l .l~ .s .s~ .h .h~ .sh .sh~ .f .f~ .sc: $(ESQL) $(EFLAGS) $< $(CC) -c $(CFLAGS) $(LDFLAGS) $*.c -o $@ @ rm -f $*.c .sc~: $(GET) $(GFLAGS) $< $(ESQL) $(EFLAGS) $*.sc $(CC) -c $(CFLAGS) $(LDFLAGS) $*.c -o $@ @ rm -f $*.c $*.sc .sc.a: $(ESQL) $(EFLAGS) $< $(CC) -c $(CFLAGS) $*.c $(AR) $(ARFLAGS) $@ $*.o @ rm -f $*.[co] .sc~.a: $(GET) $(GFLAGS) $< $(ESQL) $(EFLAGS) $*.sc $(CC) -c $(CFLAGS) $*.c $(AR) $(ARFLAGS) $@ $*.o @ rm -f $*.[co] $*.sc .sc.o: $(ESQL) $(EFLAGS) $< $(CC) -c $(CFLAGS) $*.c @ rm -f $*.c .sc~.o: $(GET) $(GFLAGS) $< $(ESQL) $(EFLAGS) $*.sc $(CC) -c $(CFLAGS) $*.c @ rm -f $*.c $*.sc ------------------------------------------------------------------------------ Hope that helps you out. -- Ron Haukenfrers {alberta,cbmvax,decwrl}!atha!ron Educational Computing or ron@cs.AthabascaU.CA Athabasca University