Re: C++ & Pro*C v7

From: Lorne Schachter <lhsux_at_swingset.bae.bellcore.com>
Date: Thu, 15 Jul 93 12:14:00 GMT
Message-ID: <1993Jul15.121400.28660_at_porthos.cc.bellcore.com>


|> >>>>>>> On 9 Jul 93 21:38:42 GMT, Jim_Holt_at_aprdlgtr.sps.mot.com (Jim Holt)
|> >>>>>>> said:
 

|> >>> Anyone have a script which can repair the sins committed by the Pro*C
|> >>> precompiler so that C++ will compile it's output ? (I have one that
|> >>> works for Oracle version 6.XXXX but not for Oracle version 7.XXX,
|> >>> which apparently commits many more sins than the previous version)
|>
We run a sed script that does the appropriate cleanup for us as follows:

   export SQLPP="proc include=$DBMS_INCL ireclen=132 oreclen=132 \

		select_error=no sqlcheck=none mode=ORACLE dbms=V7 \
		code=ansi_c"

# On input the following environment variables must be set
#    SQLSUF must be:
#		 'pp' for CQL
#		 'ec' for Informix
#		 'pc' for Oracle
#   SQLPP must be:
#		 'sqlpp' for CQL
#		 'esql' for Informix
#		 'procc' for Oracle

NOEXT=`echo $1 | cut -d'.' -f1`
EXT=`echo $1 | cut -d'.' -f2`
rm -f $NOEXT.$SQLSUF $NOEXT.C 2> /dev/null && case "$DBMSFLAG" in
 ORACLE7 | ORACLE)
	ln -s $NOEXT.$EXT $NOEXT.$SQLSUF &&
	echo "y" | /bin/rm -f $NOEXT.tmp &&
	echo "y" | /bin/rm -f $NOEXT.lis &&
	$SQLPP iname=$NOEXT.$SQLSUF oname=$NOEXT.tmp &&
	sed 's/^extern.*sql...(.*);//' $NOEXT.tmp > $NOEXT.t;
	sed 's/static const struct sqlcxp/static struct sqlcxp/' $NOEXT.t > $NOE
		XT.u;
			sed 's/static const char/static char/' $NOEXT.u > $NOEXT.v
			sed 's/short  \*cud/const short \*cud/' $NOEXT.v > $NOEXT.C
			;;

		and then run CC on $NOEXT.C

		It's messy but it works.  We have had significant trouble from ORACLE in
		getting the correct prototypes, so many of our prototypes just use
		elipses.

							Lorne
Received on Thu Jul 15 1993 - 14:14:00 CEST

Original text of this message