HP 3000 Manuals

Sample Preprocessor Generated Include Files [ ALLBASE/SQL C Application Programming Guide ] MPE/iX 5.0 Documentation


ALLBASE/SQL C Application Programming Guide

Sample Preprocessor Generated Include Files 

Figures 2-10 through Figure 2-12 illustrate, respectively, the type,
variable, and externals include files that correspond to the modified
source file in Figure 2-9.  Note that the preprocessor inserts the
following three C compiler directives to reference the include files:

          #include "sqltype"
          #include "sqlvar"
          #include "sqlextn"

These three directives are always inserted into the static or global
declaration part of the program. 
_________________________________________
|                                       |
|     typedef char  ownername_type[21]; |
|     typedef char  modulename_type[21];|
|     typedef short sqlind;             |
|     typedef unsigned char sqlbinary;  |
|     typedef int  sqlvarbinary;        |
|     typedef struct {                  |
|       int  f1;                        |
|       int  f2;                        |
|       } sqltid;                       |
|     typedef struct {                  |
|       int    SQLREC1_FIELD1_LEN;      |
|       char   SQLREC1_FIELD1[133];     |
|       } SQLREC1;                      |
|     typedef struct {                  |
|       int    SQLREC2_FIELD1_LEN;      |
|       char   SQLREC2_FIELD1[20];      |
|       } SQLREC2;                      |
|     typedef struct {                  |
|       int    SQLREC3_FIELD1_LEN;      |
|       char   SQLREC3_FIELD1[20];      |
|       int    SQLREC3_FIELD2_LEN;      |
|       char   SQLREC3_FIELD2[32];      |
|       double SQLREC3_FIELD3;          |
|       sqlind SQLREC3_FIELD3_IND;      |
|       } SQLREC3;                      |
|     typedef struct {                  |
|       SQLREC3  dummy1, dummy2;        |
|       } SQLREC4;                      |
|     #define sqlwarn0 sqlwarn[0]       |
|     #define sqlwarn1 sqlwarn[1]       |
|     #define sqlwarn2 sqlwarn[2]       |
|     #define sqlwarn3 sqlwarn[3]       |
|     #define sqlwarn4 sqlwarn[4]       |
|     #define sqlwarn5 sqlwarn[5]       |
|     #define sqlwarn6 sqlwarn[6]       |
|     #define sqlwarn7 sqlwarn[7]       |
|     typedef struct {                  |
|       char  sqlaid[8];                |
|       int   sqlabc;                   |
|       int   sqlcode;                  |
_________________________________________

          Figure 2-10.  Sample Type Include File 
_____________________________________
|                                   |
|       int   sqlerrl;              |
|       char  sqlerrm[256];         |
|       char  sqlerrp[8];           |
|       int   sqlerrd[6];           |
|       char  sqlwarn[8];           |
|       char  sqlext[8];            |
|       } sqlca_type;               |
|     typedef struct {              |
|       short sqlnty;               |
|       short sqltype;              |
|       short sqlprec;              |
|       short sqlscale;             |
|       int   sqltotallen;          |
|       int   sqlvallen;            |
|       int   sqlindlen;            |
|       int   sqlvof;               |
|       int   sqlnof;               |
|       char  sqlname[20];          |
|       } sqlformat_type;           |
|     typedef struct {              |
|       char  sqldaid[8];           |
|       int   sqldabc;              |
|       int   sqln;                 |
|       int   sqld;                 |
|       sqlformat_type *sqlfmtarr;  |
|       int   sqlnrow;              |
|       int   sqlrrow;              |
|       int   sqlrowlen;            |
|       int   sqlbuflen;            |
|       int   sqlrowbuf;            |
|       } sqlda_type;               |
|     typedef union {               |
|       int     dummy;              |
|       SQLREC1 rec1;               |
|       SQLREC2 rec2;               |
|       SQLREC3 rec3;               |
|       SQLREC4 rec4;               |
|       } sqltempv_type;            |
|                                   |
|                                   |
_____________________________________

          Sample Type Include File (page 2 of 2) 
__________________________________________________________________
|                                                                |
|     static ownername_type  sqlowner   = "JOANN@ACCT1         ";|
|     static modulename_type sqlmodname = "CEX2                ";|
|     int sqlindex;                                              |
|     char  *sqlvar1;                                            |
|     char  *sqlvar2;                                            |
|     char  *sqlvar3;                                            |
|     char  *sqlvar4;                                            |
|     sqltempv_type   sqltempv;                                  |
__________________________________________________________________

          Figure 2-11.  Sample Variable Include File 
_____________________________________
|                                   |
|     extern sqlxbfec();            |
|     extern sqlxbinc();            |
|     extern sqlxcnhc();            |
|     extern sqlxconc();            |
|     extern sqlxdduc();            |
|     extern sqlxdexc();            |
|     extern sqlxdfec();            |
|     extern sqlxdopc();            |
|     extern sqlxdsbc();            |
|     extern sqlxexic();            |
|     extern sqlxexuc();            |
|     extern sqlxfetc();            |
|     extern sqlxiduc();            |
|     extern sqlxopkc();            |
|     extern sqlxopuc();            |
|     extern sqlxplnc();            |
|     extern sqlxprec();            |
|     extern sqlxsecc();            |
|     extern sqlxstpc();            |
|     extern sqlxsvpc();            |
_____________________________________

          Figure 2-12.  Sample Externals Include File 



MPE/iX 5.0 Documentation