APPENDIX N How do I compile ESQL/C code for use with C++?


by Jonathan Leffler (johnl@informix.com)


                   TechInfo # 5563

Short Description:
Using ESQL/C with a C++ Compiler

Long Description:
From: johnl@informix.com (Jonathan Leffler)
Date: Tuesday 12th December 1995
Updated: Monday 24th November 1997
Subject: Using ESQL/C with C++

One of the more common requests these days is:

    How do I compile ESQL/C code for use with C++?

There have been a variety of answers, but not any one systematic answer.
Now there is what I believe is a definitive answer -- it's all in the
attached shell archive.

What do you get?
*   Updated ESQL/C prototypes for 4.00, 4.1x, 5.0x and 7.2x
*   An esql++ compiler
*   A pair of patch files for modifying your standard ESQL/C compiler.
    Only use these if your ESQL/C is version 4.1 or 5.x; later versions
    already have the necessary change).
*   A minimal test application.
*   No documentation apart from this message!

What do you need to do?
*   Unpack the shell archive.
*   Place the esql* headers in either $INFORMIXDIR/incl (version 4)
    or $INFORMIXDIR/incl/esql (version 5 or later)
*   Place the esql++ script in $INFORMIXDIR/bin
*   Decide which version of ESQL/C you are using and set the
    ESQLC_VERSION environment variable to a value such as:
    export ESQLC_VERSION=506    # 5.06.UC1
*   Optionally modify esql++ to give the correct default value of
    of ESQLC_VERSION.
*   Decide which C++ compiler you use -- if it isn't CC, set:
    export INFORMIXC=g++
*   Try compiling the test application:
    esql++ -o testapp testmain.ec testsub.ec
*   Run it against your local stores database -- it should say '2'.

What if you can't modify your INFORMIXDIR?
*   Copy $INFORMIXDIR/bin/esql to somewhere where you can modify it
    (eg /some/where/bin/esql)
*   Patch it if necessary.
*   Place the headers in another directory (eg /some/where/include).
*   Modify esql++ so that:
    -- arglist starts of with -I/some/where/include as one component
    -- ESQL defaults to /some/where/bin/esql
*   If you don't have to patch the esql script, you don't have to copy it
    to /some/where/bin and you don't need to make the corresponding
    modification in the esql++ script.

What about other versions of ESQL/C?
*   If you are still using a pre-4.00 version of ESQL/C, the chances are
    that the code which edits the 4.xx code will be useful.  However, the
    prototypes for the ESQL/C interface functions are not known and will
    have to be determined by inspection of the generated code.  Good luck!
    It will probably be easier to upgrade to a later version.
*   I haven't been able to test version 8.xx ESQL/C; it isn't available to
    me.  However, the indications are that it will need the same treatment
    as the other post-5.00 implementations of ESQL/C.
*   Testing with the version 9.10 ESQL/C compiler indicates that this
    script is still necessary.
*   Ideally, you won't need this script at all for post-9.xx versions.  If
    you are using some later version, you will need to revise the script so
    that the case statement on $ESQLC_VERSION handles the new (presumably
    4-digit) version number.
*   Note that ESQL/C 7.24 has some support for C++ built in.  In
    particular, it preprocesses files with the .ecpp extension and then
    compiles them with the C++ compiler.  It may not link the object code
    with the C++ compiler; if it doesn't, you'd have to do that by running
    the link command it with INFORMIXC="C++ compiler" in the environment.

Which versions of ESQL/C are are known to work with this?
*   The code has been tested against Informix-ESQL/C versions 4.12.UC1,
    5.06.UC1, 6.00.UE1, 7.13.UC1, 7.22.UC2, 9.10.UC2 on a Sun Sparc 20
    running Solaris 2.5.1 with both SUNWspro C++ SPARCompiler SC4.0.1 and
    GNU G++ 2.7.2.2.

Are there any known bugs?
*   Life will get very difficult if you pass arguments with quotes or
    spaces in them to your compiler:

        esql++ -DOPENQUOTE="'" -DSOMMAT="string with blanks" thingy.ec

    I do have a solution: it is another program called escape which
    deals with precisely that sort of problem.
        arglist="$arglist `escape $arg`"
    But that requires some more source and isn't generally necessary.
    Also, the underlying esql script does not work reliably with such
    arguments, so the changes needed are even more extensive.

*   The esql7_20.h header is needed until bug B73951 is fixed.

Any problems?  Better let me know.  Especially if you've got a fix.

---------------------------------------------------------------------------
NB: This material is supplied 'as is' with no warranty of any kind.  You
use it at your own risk.  It is not officially supported by Informix
Software Inc.
---------------------------------------------------------------------------

Jonathan Leffler
Informix Software Inc

@(#)$Id: ifaqn.htm,v 1.9 1998/10/13 15:00:10 root Exp $

:	"@(#): shar.sh,v 1.10 1997/06/02 21:45:00 johnl Exp $"
#! /bin/sh
#
#	This is a shell archive.
#	Remove everything above this line and run sh on the resulting file.
#	If this archive is complete, you will see this message at the end:
#	"All files extracted"
#
#	Created: Mon Nov 24 13:20:22 PST 1997 by johnl at Informix Software Ltd.
#	Files archived in this archive:
#	esql4_00.h
#	esql4_10.h
#	esql5_00.h
#	esql7_20.h
#	esqlc.h
#	esqllib.h
#	esql++.sh
#	esql.v4.patch
#	esql.v5.patch
#	Makefile
#	testapp.h
#	testmain.ec
#	testsub.ec
#
#--------------------
if [ -f esql4_00.h -a "$1" != "-c" ]
then echo shar: esql4_00.h already exists
else
echo 'x - esql4_00.h (1129 characters)'
sed -e 's/^X//' >esql4_00.h <<'SHAR-EOF'
X/*
X@(#)File:            $RCSfile: ifaqn.htm,v $
X@(#)Version:         $Revision: 1.9 $
X@(#)Last changed:    $Date: 1998/10/13 15:00:10 $
X@(#)Purpose:         Function prototypes for ESQL/C Version 4.00
X@(#)Author:          J Leffler
X@(#)Copyright:       (C) JLSS 1992-93,1995-97
X@(#)Product:         :PRODUCT:
X*/
X
X/*TABSTOP=4*/
X
X/*
X** Function prototypes for functions found in:
X** Informix ESQL/C application-engine interface library Version 4.00.
X** List of names derived from output of "strings $INFORMIXDIR/lib/esqlc"
X** iec_stop() is called by WHENEVER ERROR STOP.
X*/
X
X#ifndef ESQL4_00_H
X#define ESQL4_00_H
X
X#ifdef MAIN_PROGRAM
X#ifndef lint
Xstatic const char esql4_00_h[] = "@(#)$Id: ifaqn.htm,v 1.9 1998/10/13 15:00:10 root Exp $";
X#endif	/*lint */
X#endif	/*MAIN_PROGRAM */
X
X#ifdef __cplusplus
Xextern "C" {
X#endif /* __cplusplus */
X
X#include "esql4_10.h"
X
Xextern int      sqgetdbs(int *ret_fcnt,
X                         char **fnames,
X                         int fnsize,
X                         char *farea,
X                         int fasize);
X
X#ifdef __cplusplus
X}
X#endif /* __cplusplus */
X
X#endif	/* ESQL4_00_H */
SHAR-EOF
chmod 444 esql4_00.h
if [ `wc -c <esql4_00.h` -ne 1129 ]
then echo shar: esql4_00.h unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f esql4_10.h -a "$1" != "-c" ]
then echo shar: esql4_10.h already exists
else
echo 'x - esql4_10.h (5539 characters)'
sed -e 's/^X//' >esql4_10.h <<'SHAR-EOF'
X/*
X@(#)File:            $RCSfile: ifaqn.htm,v $
X@(#)Version:         $Revision: 1.9 $
X@(#)Last changed:    $Date: 1998/10/13 15:00:10 $
X@(#)Purpose:         Function prototypes for ESQL/C Version 4.10
X@(#)Author:          J Leffler
X@(#)Copyright:       (C) JLSS 1992-93,1995-97
X@(#)Product:         :PRODUCT:
X*/
X
X/*TABSTOP=4*/
X
X/*
X** Function prototypes for functions found in:
X** Informix ESQL/C application-engine interface library Version 4.10.
X** Same as for Version 4.00 except: sqgetdbs() does not link in 4.10!
X** List of names derived from output of "strings $INFORMIXDIR/lib/esqlc"
X** iec_stop() is called by WHENEVER ERROR STOP.
X*/
X
X#ifndef ESQL4_10_H
X#define ESQL4_10_H
X
X#ifdef MAIN_PROGRAM
X#ifndef lint
Xstatic const char esql4_10_h[] = "@(#)$Id: ifaqn.htm,v 1.9 1998/10/13 15:00:10 root Exp $";
X#endif	/*lint */
X#endif	/*MAIN_PROGRAM */
X
X#ifdef __cplusplus
Xextern "C" {
X#endif /* __cplusplus */
X
X#include <sqlhdr.h>
X#include <sqlda.h>
X
X/* Pre-declare struct value to keep compilers quiet */
Xstruct value;
X
Xextern int      _iqbeginwork(void);
Xextern int      _iqclose(_SQCURSOR *cursor);
Xextern int      _iqcommit(void);
Xextern int      _iqcopen(_SQCURSOR *cursor,
X                         int icnt,
X                         struct sqlvar_struct *ibind,
X                         struct sqlda *idesc,
X                         struct value *ivalues,
X                         int useflag);
Xextern int      _iqdatabase(char *db_name,
X                            int exclusive,
X                            int icnt,
X                            struct sqlvar_struct *ibind);
Xextern int      _iqdbclose(void);
Xextern int      _iqdclcur(_SQCURSOR *cursor,
X                          char *curname,
X                          char **cmdtxt,
X                          int icnt,
X                          struct sqlvar_struct *ibind,
X                          int ocnt,
X                          struct sqlvar_struct *obind,
X                          int flags);
Xextern int      _iqddclcur(_SQCURSOR *cursor,
X                           char *curname,
X                           int flags);
Xextern int      _iqdscribe(_SQCURSOR *cursor, struct sqlda **descp);
Xextern int      _iqeximm(char *stmt);
Xextern int      _iqflush(_SQCURSOR *cursor);
Xextern int      _iqfree(_SQCURSOR *cursor);
Xextern int      _iqftch(_SQCURSOR *cursor,
X                        int ocnt,
X                        struct sqlvar_struct *obind,
X                        struct sqlda *odescriptor,
X                        int chkind);
Xextern int      _iqinsput(_SQCURSOR *cursor,
X                          int icnt,
X                          struct sqlvar_struct *ibind,
X                          struct sqlda *idesc,
X                          struct value *ivalues);
Xextern int      _iqnftch(_SQCURSOR *cursor,
X                         int ocnt,
X                         struct sqlvar_struct *obind,
X                         struct sqlda *odescriptor,
X                         int fetch_type,
X                         long val,
X                         int icnt,
X                         struct sqlvar_struct *ibind,
X                         struct sqlda *idescriptor,
X                         int chkind);
Xextern int      _iqpclose(_SQCURSOR *cursor);
Xextern int      _iqpdclcur(_SQCURSOR *cursor,
X                           char *cursor_name,
X                           int statement_type,
X                           char *table_name,
X                           char **select_list,
X                           char **orderby_list,
X                           char **where_text,
X                           int icnt,
X                           struct sqlvar_struct *ibind,
X                           int ocnt,
X                           struct sqlvar_struct *obind,
X                           int for_update);
Xextern int      _iqpdelete(_SQCURSOR *cursor);
Xextern int      _iqpopen(_SQCURSOR *cursor,
X                         int icnt,
X                         struct sqlvar_struct *ibind,
X                         struct sqlda *idesc,
X                         struct value *ivalues,
X                         int useflag);
Xextern int      _iqpput(_SQCURSOR *cursor,
X                        int icnt,
X                        struct sqlvar_struct *ibind,
X                        struct sqlda *idesc,
X                        struct value *ivalues);
Xextern int      _iqprepare(_SQCURSOR *cursor, char *stmt);
Xextern int      _iqpupdate(_SQCURSOR *cursor,
X                           char **ucolumn_list,
X                           int icnt,
X                           struct sqlvar_struct *ibind);
Xextern int      _iqrollback(void);
Xextern int      _iqslct(_SQCURSOR *cursor,
X                        char **cmdtxt,
X                        int icnt,
X                        struct sqlvar_struct *ibind,
X                        int ocnt,
X                        struct sqlvar_struct *obind,
X                        int chkind);
Xextern int      _iqstmnt(_SQSTMT *scb,
X                         char **cmdtxt,
X                         int icnt,
X                         struct sqlvar_struct *ibind,
X                         struct value *ivalues);
Xextern int      _iqxecute(_SQCURSOR *cursor,
X                          int icnt,
X                          struct sqlvar_struct *ibind,
X                          struct sqlda *idesc,
X                          struct value *ivalues);
Xextern int      iec_stop(void);
Xextern int      sqlbreak(void);
Xextern int      sqlexit(void);
Xextern int      sqlstart(void);
X
X#ifdef __cplusplus
X}
X#endif /* __cplusplus */
X
X#endif	/* ESQL4_10_H */
SHAR-EOF
chmod 444 esql4_10.h
if [ `wc -c <esql4_10.h` -ne 5539 ]
then echo shar: esql4_10.h unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f esql5_00.h -a "$1" != "-c" ]
then echo shar: esql5_00.h already exists
else
echo 'x - esql5_00.h (6135 characters)'
sed -e 's/^X//' >esql5_00.h <<'SHAR-EOF'
X/*
X@(#)File:            $RCSfile: ifaqn.htm,v $
X@(#)Version:         $Revision: 1.9 $
X@(#)Last changed:    $Date: 1998/10/13 15:00:10 $
X@(#)Purpose:         Function prototypes for ESQL/C Versions 5.00..5.07
X@(#)Author:          J Leffler
X@(#)Copyright:       (C) JLSS 1992-93,1995-97
X@(#)Product:         :PRODUCT:
X*/
X
X/*
X**	@(#)Informix ESQL/C Version 5.0x ANSI C Function Prototypes
X*/
X
X/*
X**  Beware:
X**  ESQL/C version 5.00 has a 4-argument version of _iqlocate_cursor(), but
X**  ESQL/C versions 5.02 and upwards (to 5.07 at least) have a 3-argument
X**  version of _iqlocate_cursor().  Opinion is divided on whether version
X**  5.01 used 3 or 4 arguments.  On SunOS 4.1.3, 5.01.UC1 used 4 arguments.
X**  You must set ESQLC_VERSION accurately.
X*/
X
X#ifndef ESQL5_00_H
X#define ESQL5_00_H
X
X#ifdef __cplusplus
Xextern "C" {
X#endif /* __cplusplus */
X
X/* There is an unprototyped declaration of _iqlocate_cursor() in <sqlhdr.h> */
X#undef _iqlocate_cursor
X#define _iqlocate_cursor _iq_non_existent
X#include <sqlhdr.h>
X#undef _iqlocate_cursor
X
X#include <sqlda.h>
X#include <value.h>
X
X#ifdef MAIN_PROGRAM
X#ifndef lint
Xstatic const char esql5_00_h[] = "@(#)$Id: ifaqn.htm,v 1.9 1998/10/13 15:00:10 root Exp $";
X#endif	/* lint */
X#endif	/* MAIN_PROGRAM */
X
X#ifdef __cplusplus
X#define ESQLC_STRICT_PROTOTYPES
X#endif /* __cplusplus */
X
X#ifdef ESQLC_STRICT_PROTOTYPES
X/* A non-prototyped declaration for _iqnprep() is emitted by the compiler */
Xextern _SQCURSOR *_iqnprep(const char *name, char *stmt, short cs_sens);
X#else
Xextern _SQCURSOR *_iqnprep();
X#endif /* ESQLC_STRICT_PROTOTYPES */
X
X#ifdef ESQLC_SLOPPY_CONST
Xtypedef char **CCPCCPC;
X#else
X/* The code generator emits a dubious declaration for the cmdtxt parameter. */
X/* The CCPCCPC (const char pointer to const char pointer to const) typedef */
X/* isn't entirely accurate (because the called code isn't prototyped, much */
X/* less declared with const attributes, but the code in the called routines */
X/* honours the restrictions (it doesn't modify anything), so it does OK. */
Xtypedef const char *const *const CCPCCPC;
X#endif /* ESQLC_SLOPPY_CONST */
X
X#if ESQLC_VERSION == 500 || ESQLC_VERSION == 501
Xextern _SQCURSOR *_iqlocate_cursor(const char *name, int type, int cs, int xx);
X#else
Xextern _SQCURSOR *_iqlocate_cursor(const char *name, int type, int cs);
X#endif /* ESQLC_VERSION in {500, 501} */
X
Xextern int      _iqalloc(char *descname, int occurrence);
Xextern int      _iqbeginwork(void);
Xextern int      _iqcdcl(_SQCURSOR *cursor,
X                        char *curname,
X                        CCPCCPC cmdtxt,
X                        struct sqlda *idesc,
X                        struct sqlda *odesc,
X                        int flags);
Xextern int      _iqcddcl(_SQCURSOR *cursor,
X                         const char *curname,
X                         _SQCURSOR *stmt,
X                         int flags);
Xextern int      _iqcftch(_SQCURSOR *cursor,
X                         struct sqlda *idesc,
X                         struct sqlda *odesc,
X                         char *odesc_name,
X                         _FetchSpec *fetchspec);
Xextern int      _iqclose(_SQCURSOR *cursor);
Xextern int      _iqcommit(void);
Xextern int      _iqcopen(_SQCURSOR *cursor,
X                         int icnt,
X                         struct sqlvar_struct *ibind,
X                         struct sqlda *idesc,
X                         struct value *ivalues,
X                         int useflag);
Xextern int      _iqcput(_SQCURSOR *cursor,
X                        struct sqlda *idesc,
X                        char *desc_name);
Xextern int      _iqcrproc(char *fname);
Xextern int      _iqdbase(char *db_name, int exclusive);
Xextern int      _iqdbclose(void);
Xextern int      _iqdcopen(_SQCURSOR *cursor,
X                          struct sqlda *idesc,
X                          char *desc_name,
X                          char *ivalues,
X                          int useflag);
Xextern int      _iqdealloc(char *desc_name);
Xextern int      _iqdescribe(_SQCURSOR *cursor,
X                            struct sqlda **descp,
X                            char *desc_name);
Xextern int      _iqexecute(_SQCURSOR *cursor,
X                           struct sqlda *idesc,
X                           char *desc_name,
X                           struct value *ivalues);
Xextern int      _iqeximm(char *stmt);
Xextern int      _iqexproc(_SQCURSOR *cursor,
X                          CCPCCPC cmdtxt,
X                          int icnt,
X                          struct sqlvar_struct *ibind,
X                          int ocnt,
X                          struct sqlvar_struct *obind,
X                          int chkind);
Xextern int      _iqflush(_SQCURSOR *cursor);
Xextern int      _iqfree(_SQCURSOR *cursor);
Xextern int      _iqgetdesc(char *desc_name,
X                           int sqlvar_num,
X                           struct hostvar_struct *hosttab,
X                           int xopen_flg);
Xextern int      _iqprepare(_SQCURSOR *cursor, char *stmt);
Xextern int      _iqrollback(void);
Xextern int      _iqsetdesc(char *desc_name,
X                           int sqlvar_num,
X                           struct hostvar_struct *hosttab,
X                           int xopen_flg);
Xextern int      _iqslct(_SQCURSOR *cursor,
X                        CCPCCPC cmdtxt,
X                        int icnt,
X                        struct sqlvar_struct *ibind,
X                        int ocnt,
X                        struct sqlvar_struct *obind,
X                        int chkind);
Xextern int      _iqstmnt(_SQSTMT *scb,
X                         CCPCCPC cmdtxt,
X                         int icnt,
X                         struct sqlvar_struct *ibind,
X                         struct value *ivalues);
Xextern void     iec_stop(void);
Xextern int      sqgetdbs(int *ret_fcnt,
X                         char **fnames,
X                         int fnsize,
X                         char *farea,
X                         int fasize);
Xextern int      sqlbreak(void);
Xextern void     sqldetach(void);
Xextern void     sqlexit(void);
Xextern int      sqlstart(void);
X
X#ifdef __cplusplus
X}
X#endif /* __cplusplus */
X
X#endif	/* ESQL5_00_H */
SHAR-EOF
chmod 444 esql5_00.h
if [ `wc -c <esql5_00.h` -ne 6135 ]
then echo shar: esql5_00.h unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f esql7_20.h -a "$1" != "-c" ]
then echo shar: esql7_20.h already exists
else
echo 'x - esql7_20.h (1320 characters)'
sed -e 's/^X//' >esql7_20.h <<'SHAR-EOF'
X/*
X@(#)File:            $RCSfile: ifaqn.htm,v $
X@(#)Version:         $Revision: 1.9 $
X@(#)Last changed:    $Date: 1998/10/13 15:00:10 $
X@(#)Purpose:         Function prototypes for ESQL/C Versions 7.20..7.22
X@(#)Author:          J Leffler
X@(#)Copyright:       (C) JLSS 1997
X@(#)Product:         :PRODUCT:
X*/
X
X/*TABSTOP=4*/
X
X#ifndef ESQL7_20_H
X#define ESQL7_20_H
X
X#ifdef MAIN_PROGRAM
X#ifndef lint
Xstatic const char esql7_20_h[] = "@(#)$Id: ifaqn.htm,v 1.9 1998/10/13 15:00:10 root Exp $";
X#endif	/* lint */
X#endif	/* MAIN_PROGRAM */
X
X/*
X** The 7.2x ESQL/C compiler can generate calls to the following functions
X** but sqlhdr.h does not define prototypes for these functions.  Although
X** byfill() is declared in esqllib.h, this is not normally needed by 7.x
X** ESQL/C compilations (though if byfill() is missing, there is room to
X** think that other functions may be missing too).
X*/
Xextern void  byfill(char *to, int len, char ch);
Xextern void  iec_dclcur(char *, char **, int, int, int);
Xextern void  iec_free(char *);
Xextern void  iec_hostbind(struct hostvar_struct *, int, int, int, int, char *);
Xextern void  iec_ibind(int, char *, int, int, char *, int);
Xextern void  iec_obind(int, char *, int, int, char *, int);
Xextern void *iec_alloc_isqlda(int);
Xextern void *iec_alloc_osqlda(int);
X
X#endif	/* ESQL7_20_H */
SHAR-EOF
chmod 444 esql7_20.h
if [ `wc -c <esql7_20.h` -ne 1320 ]
then echo shar: esql7_20.h unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f esqlc.h -a "$1" != "-c" ]
then echo shar: esqlc.h already exists
else
echo 'x - esqlc.h (3788 characters)'
sed -e 's/^X//' >esqlc.h <<'SHAR-EOF'
X/*
X@(#)File:            $RCSfile: ifaqn.htm,v $
X@(#)Version:         $Revision: 1.9 $
X@(#)Last changed:    $Date: 1998/10/13 15:00:10 $
X@(#)Purpose:         Include all relevant ESQL/C type definitions
X@(#)Author:          J Leffler
X@(#)Copyright:       (C) JLSS 1992-93,1995-97
X@(#)Product:         :PRODUCT:
X*/
X
X#ifndef ESQLC_H
X#define ESQLC_H
X
X#ifdef MAIN_PROGRAM
X#ifndef lint
Xstatic const char esqlc_h[] = "@(#)$Id: ifaqn.htm,v 1.9 1998/10/13 15:00:10 root Exp $";
X#endif	/* lint */
X#endif	/* MAIN_PROGRAM */
X
X/* Backwards compatability -- will be removed after 1st January 1998.  */
X#ifndef ESQLC_VERSION
X#ifdef ESQLC_4_10
X#define ESQLC_VERSION 410
X#endif /* ESQLC_4_00 */
X#ifdef ESQLC_4_00
X#define ESQLC_VERSION 400
X#endif /* ESQLC_4_00 */
X#ifdef ESQLC_5_00
X#define ESQLC_VERSION 500
X#endif /* ESQLC_5_00 */
X#ifdef ESQLC_6_00
X#define ESQLC_VERSION 600
X#endif /* ESQLC_6_00 */
X#ifdef ESQLC_7_00
X#define ESQLC_VERSION 700
X#endif /* ESQLC_7_00 */
X#ifdef ESQLC_7_10
X#define ESQLC_VERSION 710
X#endif /* ESQLC_7_10 */
X#ifdef ESQLC_7_20
X#define ESQLC_VERSION 720
X#endif /* ESQLC_7_20 */
X#endif /* ESQLC_VERSION */
X
X/* If it still isn't defined, use version 0 */
X#ifndef ESQLC_VERSION
X#define ESQLC_VERSION 0
X#endif /* ESQLC_VERSION */
X
X/*
X** On DEC OSF/1 and 64-bits machines, __STDC__ is not necessarily defined,
X** but the use of prototypes is necessary under optimization to ensure that
X** pointers are treated correctly (sizeof(void *) != sizeof(int)).
X** The <sqlhdr.h> prototypes for version 6.00 and above are only active if
X** __STDC__ is defined (whether 1 or 0 or something else does not matter).
X** Ensure that the compilation options set __STDC__.
X*/
X
X#ifdef __cplusplus
Xextern "C" {
X#endif /* __cplusplus */
X
X/* -- Include Files	*/
X
X#include <datetime.h>
X#include <decimal.h>
X#include <locator.h>
X#include <sqlca.h>
X#include <sqlda.h>
X#include <sqlstype.h>
X#include <sqltypes.h>
X
X#if ESQLC_VERSION >= 400
X#include <varchar.h>
X#endif /* ESQLC_VERSION >= 400 */
X
X/* _WIN32 (Windows 95/NT code from Harald Ums <Harald.Ums@sevensys.de> */
X
X#if ESQLC_VERSION < 400
X/* No prototypes available -- for earlier versions, you are on your own! */
X#elif ESQLC_VERSION < 410
X#include "esql4_00.h"
X#include "esqllib.h"
X#elif ESQLC_VERSION < 500
X#include "esql4_10.h"
X#include "esqllib.h"
X#elif ESQLC_VERSION < 600
X#ifdef _WIN32
X#include <windows.h>
X#include <sqlhdr.h>
X#include <sqlproto.h>
X#else
X#include "esql5_00.h"
X#include "esqllib.h"
X#endif /* _WIN32 */
X#else
X/* For later versions, sqlhdr.h contains the requisite declarations. */
X/* However, these declarations are protected by __STDC__ so you need */
X/* to ensure that your compiler has it defined.  Note that compilers */
X/* on some machines do complain if you try to define __STDC__.       */
X#include <sqlhdr.h>
X
X#ifdef _WIN32
X#include <sqlproto.h>
X#else
X#if ESQLC_VERSION >= 720 && ESQLC_VERSION < 800
X#include "esql7_20.h"
X#endif /* ESQLC_VERSION is 7.2x */
X
Xextern int      sqgetdbs(int *ret_fcnt,
X                         char **fnames,
X                         int fnsize,
X                         char *farea,
X                         int fasize);
X#endif /* _WIN32 */
X
X#endif /* ESQLC_VERSION */
X
X/* -- Constant Definitions */
X
X/* A table name may be: database@server:"owner".table */
X/* This contains 5 punctuation characters and a null */
X#define SQL_NAMELEN	18
X#define SQL_USERLEN	8
X#define SQL_TABNAMELEN	(3 * SQL_NAMELEN + SQL_USERLEN + 6)
X
X#define loc_mode	lc_union.lc_file.lc_mode
X#define sqlva		sqlvar_struct
X
X/* -- Type Definitions */
X
Xtypedef loc_t	        Blob;
Xtypedef struct decimal	Decimal;
Xtypedef struct dtime	Datetime;
Xtypedef struct intrvl	Interval;
Xtypedef struct sqlca_s	Sqlca;
Xtypedef struct sqlda	Sqlda;
Xtypedef struct sqlva	Sqlva;
X
X#ifdef __cplusplus
X}
X#endif /* __cplusplus */
X
X#endif	/* ESQLC_H */
SHAR-EOF
chmod 444 esqlc.h
if [ `wc -c <esqlc.h` -ne 3788 ]
then echo shar: esqlc.h unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f esqllib.h -a "$1" != "-c" ]
then echo shar: esqllib.h already exists
else
echo 'x - esqllib.h (3788 characters)'
sed -e 's/^X//' >esqllib.h <<'SHAR-EOF'
X/*
X@(#)File:            $RCSfile: ifaqn.htm,v $
X@(#)Version:         $Revision: 1.9 $
X@(#)Last changed:    $Date: 1998/10/13 15:00:10 $
X@(#)Purpose:         ESQL/C Library Function Prototypes
X@(#)Author:          J Leffler
X@(#)Copyright:       (C) JLSS 1992-93,1995-97
X@(#)Product:         :PRODUCT:
X*/
X
X/*TABSTOP=4*/
X
X#ifndef ESQLLIB_H
X#define ESQLLIB_H
X
X#ifdef MAIN_PROGRAM
X#ifndef lint
Xstatic const char esqllib_h[] = "@(#)$Id: ifaqn.htm,v 1.9 1998/10/13 15:00:10 root Exp $";
X#endif	/* lint */
X#endif	/* MAIN_PROGRAM */
X
X#ifdef __cplusplus
Xextern "C" {
X#endif /* __cplusplus */
X
X/* DATE */
Xextern int      rdayofweek(long jdate);
Xextern int      rdefmtdate(long *jdate, char *fmt, char *inp);
Xextern int      rfmtdate(long jdate, char *fmt, char *res);
Xextern int      rjulmdy(long jdate, short mdy[3]);
Xextern int      rleapyear(int year);
Xextern int      rmdyjul(short mdy[3], long *jdate);
Xextern int      rstrdate(char *str, long *jdate);
Xextern int      rdatestr(long jdate, char *str);
Xextern void     rtoday(long *today);
X
X/* DECIMAL */
Xextern int      decadd(dec_t *op1, dec_t *op2, dec_t *res);
Xextern int      deccmp(dec_t *op1, dec_t *op2);
Xextern int      deccpy(dec_t *op1, dec_t *op2);
Xextern int      deccvasc(char *cp, int len, dec_t *np);
Xextern int      deccvdbl(double i, dec_t *np);
Xextern int      deccvint(int i, dec_t *np);
Xextern int      deccvlong(long i, dec_t *np);
Xextern int      decdiv(dec_t *op1, dec_t *op2, dec_t *res);
Xextern char    *dececvt(dec_t *np, int ndigit, int *decpt, int *sign);
Xextern char    *decfcvt(dec_t *np, int ndigit, int *decpt, int *sign);
Xextern int      decmul(dec_t *op1, dec_t *op2, dec_t *res);
Xextern int      decround(dec_t *np, int n);
Xextern int      decsub(dec_t *op1, dec_t *op2, dec_t *res);
Xextern int      dectoasc(dec_t *np, char *cp, int len, int right);
Xextern int      dectodbl(dec_t *np, double *ip);
Xextern int      dectoint(dec_t *np, int *ip);
Xextern int      dectolong(dec_t *np, long *ip);
Xextern int      dectrunc(dec_t *np, int n);
X
X/* FORMAT USING */
Xextern int      rfmtdec(dec_t *np, char *fmt, char *outbuf);
Xextern int      rfmtdouble(double np, char *fmt, char *outbuf);
Xextern int      rfmtlong(long np, char *fmt, char *outbuf);
X
X/* DATETIME/INTERVAL */
Xextern int      dtcvasc(char *str, dtime_t *dt);
Xextern int      dtcvfmtasc(char *str, char *fmt, dtime_t *dt);
Xextern int      dtextend(dtime_t *id, dtime_t *od);
Xextern int      dttoasc(dtime_t *dt, char *str);
Xextern int      incvasc(char *str, intrvl_t *dt);
Xextern int      incvfmtasc(char *str, char *fmt, intrvl_t *dt);
Xextern int      intoasc(intrvl_t *dt, char *str);
Xextern void     dtcurrent(dtime_t *dt);
X
X/* LIBRARY */
Xextern char    *rtypname(int sqltype);
Xextern int      bycmpr(char *b1, char *b2, int len);
Xextern int      byleng(char *fr, int len);
Xextern int      rgetmsg(short msgnum, char *msgstr, short msglen);
Xextern int      risnull(int type, char *ptrvar);
Xextern int      rsetnull(int type, char *ptrvar);
Xextern int      rstod(char *str, double *val);
Xextern int      rstoi(char *str, int *val);
Xextern int      rstol(char *str, long *val);
Xextern int      rtypalign(int pos, int type);
Xextern int      rtypmsize(int sqltype, int sqllen);
Xextern int      rtypwidth(int sqltype, int sqllen);
Xextern int      stcmpr(char *s1, char *s2);
Xextern int      stcopy(char *fr, char *to);
Xextern int      stleng(char *s);
Xextern void     bycopy(char *fr, char *to, int len);
Xextern void     byfill(char *to, int len, char ch);
Xextern void     ldchar(char *fr, int len, char *to);
Xextern void     rdownshift(char *s);
Xextern void     rupshift(char *s);
Xextern void     stcat(char *s, char *dest);
Xextern void     stchar(char *fr, char *to, int cnt);
X
X#ifdef __cplusplus
X}
X#endif /* __cplusplus */
X
X#endif	/* ESQLLIB_H */
SHAR-EOF
chmod 444 esqllib.h
if [ `wc -c <esqllib.h` -ne 3788 ]
then echo shar: esqllib.h unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f esql++.sh -a "$1" != "-c" ]
then echo shar: esql++.sh already exists
else
echo 'x - esql++.sh (4717 characters)'
sed -e 's/^X//' >esql++.sh <<'SHAR-EOF'
X:	"@(#)$Id: ifaqn.htm,v 1.9 1998/10/13 15:00:10 root Exp $"
X#
X#   ESQL/C++ compiler script
X#   For Informix-ESQL/C Versions 4.00, 4.1x, 5.0x, 6.0x, 7.1x or later
X
X#TABSTOP=4
X
X#################################################################
X# Prerequisite (mandatory) change to installed esql script for
X# Version 4.00, 4.1x, 5.0x ESQL/C compiler scripts.
X# diff old.esql new.esql
X# < CC="cc"
X# --
X# > CC=${INFORMIXC:-"cc"}
X# Note that this is not sufficient if you are also using the -g,
X# -G or -nln options.  You then need to find the lines which read
X# CC="cc -g" and change them to CC="${CC} -g", or some equivalent
X# but more complex change.  The '-G' option is a confounded
X# nuisance if you are trying to create shared libraries on
X# SVR4-base Unix.
X#################################################################
X# Additional prerequisite for all versions of ESQL/C:
X# -- The esql*.h headers (esqlc.h, esqllib.h, esql7_20.h, esql5_00.h,
X#    esql4_10.h, esql4_00.h) must be installed in:
X#    * $INFORMIXDIR/incl/esql -- Version 5.00 or later
X#    * $INFORMIXDIR/incl      -- Version 4.1x or 4.00
X#################################################################
X
X: ${ESQL:=esql}
X: ${ESQLC_VERSION:=600}
X
X# Some C++ compilers are strict and insist on .C as the extension for
X# C++ source files; others are lax and accept .C, .c, .cc or .cpp as
X# the extension.  Set ESQLC_CPLUSPLUS_EXTENSION to suit your C++ compiler
X# and local conventions.  The extension generated by the ESQL/C compiler
X# is fixed as '.c' in all current versions of ESQL/C, but this is documented
X# in the variable $G.  This script removes the generated file after editing
X# it into the appropriate C++ source file.
X# NB: if ESQL_CPLUSPLUS_EXTENSION is also '.c', the temporary file is needed.
XX=${ESQLC_CPLUSPLUS_EXTENSION:-'.cc'}
XG='.c'
X
X# Primarily for testing!  Define as ':' to leave C code file around.
X: ${ESQLC_RM_COMMAND:="rm -f"}
X
XINFORMIXC=${INFORMIXC:-CC}
Xexport INFORMIXC
X
Xif [ "$X" = "$G" ]
Xthen
X	tmpfile=${TMPDIR:-/tmp}/esql.$$
X	trap "rm -f $tmpfile; exit 1" 0 1 2 3 13 15
Xfi
X
Xesqlc_version="-DESQLC_VERSION=${ESQLC_VERSION}"
Xestat=0
Xarglist=""
Xwhile [ $# -gt 0 ]
Xdo
X	arg=$1
X	case "$arg" in
X	-DESQLC_VERSION=*)
X		esqlc_version=""
X		ESQLC_VERSION=`expr $arg : '-DESQLC_VERSION=\(.*\)'`
X		arglist="$arglist '$arg'"
X		;;
X	*.ec)
X		bname=`basename $arg .ec`
X		oname=$bname$X
X		gname=$bname$G
X		if [ "$X" = "$G" ]
X		then outfile=$tmpfile
X		else outfile=$oname
X		fi
X		if eval $ESQL $arglist -e $arg
X		then : OK
X		else estat=1
X		fi
X		# NB: Version 8.xx has never been tested!
X		case $ESQLC_VERSION in
X		4[0-9][0-9])
X			# NB: in numerous places the generated code contains '(char *)0'
X			# where some structure pointer is required.  In the fully-
X			# prototyped C++ environment, leaving all these as just 0 fixes
X			# the problem.
X			{
X			echo '#include "esqlc.h"'
X			sed '/_iq[a-z]/s/(char \*) *0/0/g' $gname
X			} > $outfile
X			[ "$X" = "$G" ] && mv $outfile $oname
X			;;
X		[5-7][0-9][0-9])
X			# NB: Version 8.xx has never been tested!
X			# NB: in 5.0x ESQL/C, the calls to _iq functions are
X			# mostly clean, unless you are using SQL descriptors
X			# instead of sqlda structures.  The delete operations
X			# remove the generated, non-prototyped declaration of
X			# _iqnprep().
X			{
X			echo '#include "esqlc.h"'
X			sed -e '1,/^$/d' -e '/_iq[a-z]/s/(char \*) *0/0/g' $gname
X			} > $outfile
X			[ "$X" = "$G" ] && mv $outfile $oname
X			;;
X		9[0-9][0-9])
X			# It appears that 9.10.UC2 ESQL/C includes just <sqlhdr.h> and
X			# that it, in turn, includes almost all the headers that
X			# esqlc.h includes too.  It does not separately include
X			# sqlca.h, nor does it declare _iqnprep().  This makes the
X			# echo/sed script below redundant.  Earlier 9.0x versions may
X			# not be as clean, in which case the script below should be
X			# used instead.  With luck, the edit for _iq[a-z] should be
X			# unnecessary in all 9.0x versions.  The copy of 9.03.UC1
X			# ESQL/C which I was using got removed, unfortunately.
X			#{
X			#echo '#include "esqlc.h"'
X			#sed -e '1d' $gname
X			#} > $outfile
X			#[ "$X" = "$G" ] && mv $outfile $oname
X			[ "$X" = "$G" ] || mv $gname $oname
X			;;
X		*)
X			arg0=`basename $0 .sh`
X			echo "$arg0: unknown ESQLC_VERSION = $ESQLC_VERSION" 1>&2
X			exit 1;;
X		esac
X		${ESQLC_RM_COMMAND} $gname
X		arglist="$arglist $oname"
X		;;
X	*.o | *.c | *.cc | *.cpp | *.C)
X		arglist="$arglist $arg"
X		;;
X	-o)
X		if [ $# -lt 1 ]
X		then error "-o option requires argument"
X		fi
X		shift
X		output="-o $1"
X		;;
X	-V)
X		exec $ESQL $arg
X		;;
X	*)
X		arglist="$arglist '$arg'"
X		;;
X	esac
X	shift
Xdone
X
Xif [ "$X" = "$G" ]
Xthen
X	rm -f $tmpfile
X	trap 0 1 2 3 13 15
Xfi
X
Xif [ $estat != 0 ]
Xthen exit 1
Xfi
X
Xeval exec $ESQL $arglist $output
SHAR-EOF
chmod 444 esql++.sh
if [ `wc -c <esql++.sh` -ne 4717 ]
then echo shar: esql++.sh unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f esql.v4.patch -a "$1" != "-c" ]
then echo shar: esql.v4.patch already exists
else
echo 'x - esql.v4.patch (1162 characters)'
sed -e 's/^X//' >esql.v4.patch <<'SHAR-EOF'
X#	@(#)$Id: ifaqn.htm,v 1.9 1998/10/13 15:00:10 root Exp $
X#
X# To apply this patch (assuming that this file is called $RCSfile: ifaqn.htm,v $,
X# and that the current directory is distinct from $INFORMIXDIR/bin):
X#	cp $INFORMIXDIR/bin/esql .
X#	patch < $RCSfile: ifaqn.htm,v $
X
X*** esql	Fri Jan 24 12:34:17 1997
X--- esql.v4.new	Fri Jan 24 12:35:27 1997
X***************
X*** 25,31 ****
X  : '
X  INFDIR=${INFORMIXDIR=/usr/informix}
X  PREPCC=${INFDIR}/lib/esqlc
X! CC="cc"
X  STAT=0
X  TYPE=unix
X  ANSI=
X--- 25,31 ----
X  : '
X  INFDIR=${INFORMIXDIR=/usr/informix}
X  PREPCC=${INFDIR}/lib/esqlc
X! CC="${INFORMIXC:-cc}"
X  STAT=0
X  TYPE=unix
X  ANSI=
X***************
X*** 94,110 ****
X  	    shift
X  	    ;;
X  	-g )
X! 	    CC="cc -g"
X  	    PA="$PA $1"
X  	    shift
X  	    ;;
X  	-G )
X! 	    CC="cc -g"
X  	    PA="$PA $1"
X  	    shift
X  	    ;;
X  	-nln )
X! 	    CC="cc -g"
X  	    PA="$PA $1"
X  	    shift
X  	    ;;
X--- 94,110 ----
X  	    shift
X  	    ;;
X  	-g )
X! 	    CC="${CC} -g"
X  	    PA="$PA $1"
X  	    shift
X  	    ;;
X  	-G )
X! 	    CC="${CC} -g"
X  	    PA="$PA $1"
X  	    shift
X  	    ;;
X  	-nln )
X! 	    CC="${CC} -g"
X  	    PA="$PA $1"
X  	    shift
X  	    ;;
SHAR-EOF
chmod 444 esql.v4.patch
if [ `wc -c <esql.v4.patch` -ne 1162 ]
then echo shar: esql.v4.patch unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f esql.v5.patch -a "$1" != "-c" ]
then echo shar: esql.v5.patch already exists
else
echo 'x - esql.v5.patch (1168 characters)'
sed -e 's/^X//' >esql.v5.patch <<'SHAR-EOF'
X#	@(#)$Id: ifaqn.htm,v 1.9 1998/10/13 15:00:10 root Exp $
X#
X# To apply this patch (assuming that this file is called $RCSfile: ifaqn.htm,v $,
X# and that the current directory is distinct from $INFORMIXDIR/bin):
X#	cp $INFORMIXDIR/bin/esql .
X#	patch < $RCSfile: ifaqn.htm,v $
X
X*** esql	Fri Jan 24 12:34:52 1997
X--- esql.v5.new	Fri Jan 24 12:35:47 1997
X***************
X*** 25,31 ****
X  : '
X  INFDIR=${INFORMIXDIR=/usr/informix}
X  PREPCC=${INFDIR}/lib/esql/esqlc
X! CC="cc"
X  STAT=0
X  TYPE=unix
X  A=
X--- 25,31 ----
X  : '
X  INFDIR=${INFORMIXDIR=/usr/informix}
X  PREPCC=${INFDIR}/lib/esql/esqlc
X! CC="${INFORMIXC:-cc}"
X  STAT=0
X  TYPE=unix
X  A=
X***************
X*** 100,116 ****
X  	    shift
X  	    ;;
X  	-g )
X! 	    CC="cc -g"
X  	    PA="$PA $1"
X  	    shift
X  	    ;;
X  	-G )
X! 	    CC="cc -g"
X  	    PA="$PA $1"
X  	    shift
X  	    ;;
X  	-nln )
X! 	    CC="cc -g"
X  	    PA="$PA $1"
X  	    shift
X  	    ;;
X--- 100,116 ----
X  	    shift
X  	    ;;
X  	-g )
X! 	    CC="${CC} -g"
X  	    PA="$PA $1"
X  	    shift
X  	    ;;
X  	-G )
X! 	    CC="${CC} -g"
X  	    PA="$PA $1"
X  	    shift
X  	    ;;
X  	-nln )
X! 	    CC="${CC} -g"
X  	    PA="$PA $1"
X  	    shift
X  	    ;;
SHAR-EOF
chmod 444 esql.v5.patch
if [ `wc -c <esql.v5.patch` -ne 1168 ]
then echo shar: esql.v5.patch unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f Makefile -a "$1" != "-c" ]
then echo shar: Makefile already exists
else
echo 'x - Makefile (603 characters)'
sed -e 's/^X//' >Makefile <<'SHAR-EOF'
X#	@(#)$Id: ifaqn.htm,v 1.9 1998/10/13 15:00:10 root Exp $
X#
X#	Makefile for ESQL++ Test Application
X
XCPLUSPLUS = g++
XDEBRIS    = a.out core *.rej *.orig
XESQL      = INFORMIXC="${CPLUSPLUS}" ${ESQL_CMD} -DESQLC_VERSION=${ESQL_VERS}
XESQLJUNK  = ${ESQLSRC:.ec=.c} ${ESQLSRC:.ec=.cc}
XESQLOBJ   = ${ESQLSRC:.ec=.o}
XESQLSRC   = testmain.ec testsub.ec
XESQL_CMD  = esql++
XESQL_VERS = 720
XRM        = rm -f
XTESTAPP   = testapp
X
X.SUFFIXES: .ec
X
X.ec.o:
X	${ESQL} -c $*.ec
X	${RM} $*.c $*.cc
X
Xall: ${TESTAPP}
X
X${TESTAPP}:	${ESQLOBJ}
X	${ESQL} -o $@ ${ESQLOBJ}
X
Xclean:
X	${RM} ${TESTAPP} ${ESQLOBJ} ${ESQLJUNK} ${DEBRIS}
SHAR-EOF
chmod 444 Makefile
if [ `wc -c <Makefile` -ne 603 ]
then echo shar: Makefile unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f testapp.h -a "$1" != "-c" ]
then echo shar: testapp.h already exists
else
echo 'x - testapp.h (428 characters)'
sed -e 's/^X//' >testapp.h <<'SHAR-EOF'
X/*
X@(#)File:            $RCSfile: ifaqn.htm,v $
X@(#)Version:         $Revision: 1.9 $
X@(#)Last changed:    $Date: 1998/10/13 15:00:10 $
X@(#)Purpose:         Header for ESQL++ Test Application
X@(#)Author:          J Leffler
X@(#)Copyright:       (C) JLSS 1997
X@(#)Product:         :PRODUCT:
X*/
X
X/*TABSTOP=4*/
X
X#ifndef TESTAPP_H
X#define TESTAPP_H
X
Xextern void sqlerror(void);
Xextern int sql_select(char *);
X
X#endif	/* TESTAPP_H */
SHAR-EOF
chmod 444 testapp.h
if [ `wc -c <testapp.h` -ne 428 ]
then echo shar: testapp.h unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f testmain.ec -a "$1" != "-c" ]
then echo shar: testmain.ec already exists
else
echo 'x - testmain.ec (819 characters)'
sed -e 's/^X//' >testmain.ec <<'SHAR-EOF'
X/*
X@(#)File:            $RCSfile: ifaqn.htm,v $
X@(#)Version:         $Revision: 1.9 $
X@(#)Last changed:    $Date: 1998/10/13 15:00:10 $
X@(#)Purpose:         Simple test application for ESQL++
X@(#)Author:          J Leffler
X@(#)Copyright:       (C) JLSS 1997
X@(#)Product:         :PRODUCT:
X*/
X
X/*TABSTOP=4*/
X
X#include <iostream.h>
X#include "testapp.h"
X
X#ifndef lint
Xstatic const char sccs[] = "@(#)$Id: ifaqn.htm,v 1.9 1998/10/13 15:00:10 root Exp $";
X#endif
X
Xint main()
X{
X
X	cout << "ESQL/C++ Test Application -- compiled with ESQL/C Version ";
X	cout << ESQLC_VERSION << endl;
X	EXEC SQL WHENEVER ERROR CALL sqlerror;
X	EXEC SQL DATABASE stores;
X
X	int tabid = sql_select("SELECT Tabid FROM Systables"
X							" WHERE TabName = 'syscolumns'");
X
X	cout << "TabID of SysColumns table is " << tabid << endl;
X
X	return(0);
X}
SHAR-EOF
chmod 444 testmain.ec
if [ `wc -c <testmain.ec` -ne 819 ]
then echo shar: testmain.ec unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f testsub.ec -a "$1" != "-c" ]
then echo shar: testsub.ec already exists
else
echo 'x - testsub.ec (1085 characters)'
sed -e 's/^X//' >testsub.ec <<'SHAR-EOF'
X/*
X@(#)File:            $RCSfile: ifaqn.htm,v $
X@(#)Version:         $Revision: 1.9 $
X@(#)Last changed:    $Date: 1998/10/13 15:00:10 $
X@(#)Purpose:         Simple test application for ESQL++
X@(#)Author:          J Leffler
X@(#)Copyright:       (C) JLSS 1997
X@(#)Product:         :PRODUCT:
X*/
X
X/*TABSTOP=4*/
X
X#include <stdlib.h>
X#include <iostream.h>
X#include "testapp.h"
X
X#ifndef lint
Xstatic const char sccs[] = "@(#)$Id: ifaqn.htm,v 1.9 1998/10/13 15:00:10 root Exp $";
X#endif
X
Xvoid sqlerror(void)
X{
X	cerr << "SQL = " << sqlca.sqlcode;
X	if (sqlca.sqlerrd[1] != 0)
X		cerr << ", ISAM = " << sqlca.sqlerrd[1];
X	cerr << endl;
X	exit(1);
X}
X
Xint sql_select(char *txt)
X{
X	EXEC SQL BEGIN DECLARE SECTION;
X	char *stmt = txt;
X	int	retval;
X	EXEC SQL END DECLARE SECTION;
X
X	EXEC SQL WHENEVER ERROR CALL sqlerror;
X
X	EXEC SQL PREPARE p_select FROM :stmt;
X	EXEC SQL DECLARE c_select CURSOR FOR p_select;
X	EXEC SQL OPEN c_select;
X	EXEC SQL FETCH c_select INTO :retval;
X	EXEC SQL CLOSE c_select;
X	EXEC SQL FREE c_select;
X
X#if ESQLC_VERSION >= 600
X	EXEC SQL FREE p_select;
X#endif
X
X	return(retval);
X}
SHAR-EOF
chmod 444 testsub.ec
if [ `wc -c <testsub.ec` -ne 1085 ]
then echo shar: testsub.ec unpacked with wrong size
fi
# end of overwriting check
fi
echo All files extracted
exit 0
;