Header And Logo

PostgreSQL
| The world's most advanced open source database.

preproc-init.c

Go to the documentation of this file.
00001 /* Processed by ecpg (regression mode) */
00002 /* These include files are added by the preprocessor */
00003 #include <ecpglib.h>
00004 #include <ecpgerrno.h>
00005 #include <sqlca.h>
00006 /* End of automatic include section */
00007 #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
00008 
00009 #line 1 "init.pgc"
00010 
00011 #line 1 "sqlca.h"
00012 #ifndef POSTGRES_SQLCA_H
00013 #define POSTGRES_SQLCA_H
00014 
00015 #ifndef PGDLLIMPORT
00016 #if  defined(WIN32) || defined(__CYGWIN__)
00017 #define PGDLLIMPORT __declspec (dllimport)
00018 #else
00019 #define PGDLLIMPORT
00020 #endif   /* __CYGWIN__ */
00021 #endif   /* PGDLLIMPORT */
00022 
00023 #define SQLERRMC_LEN    150
00024 
00025 #ifdef __cplusplus
00026 extern      "C"
00027 {
00028 #endif
00029 
00030 struct sqlca_t
00031 {
00032     char        sqlcaid[8];
00033     long        sqlabc;
00034     long        sqlcode;
00035     struct
00036     {
00037         int         sqlerrml;
00038         char        sqlerrmc[SQLERRMC_LEN];
00039     }           sqlerrm;
00040     char        sqlerrp[8];
00041     long        sqlerrd[6];
00042     /* Element 0: empty                     */
00043     /* 1: OID of processed tuple if applicable          */
00044     /* 2: number of rows processed              */
00045     /* after an INSERT, UPDATE or               */
00046     /* DELETE statement                 */
00047     /* 3: empty                     */
00048     /* 4: empty                     */
00049     /* 5: empty                     */
00050     char        sqlwarn[8];
00051     /* Element 0: set to 'W' if at least one other is 'W'   */
00052     /* 1: if 'W' at least one character string      */
00053     /* value was truncated when it was          */
00054     /* stored into a host variable.             */
00055 
00056     /*
00057      * 2: if 'W' a (hopefully) non-fatal notice occurred
00058      */ /* 3: empty */
00059     /* 4: empty                     */
00060     /* 5: empty                     */
00061     /* 6: empty                     */
00062     /* 7: empty                     */
00063 
00064     char        sqlstate[5];
00065 };
00066 
00067 struct sqlca_t *ECPGget_sqlca(void);
00068 
00069 #ifndef POSTGRES_ECPG_INTERNAL
00070 #define sqlca (*ECPGget_sqlca())
00071 #endif
00072 
00073 #ifdef __cplusplus
00074 }
00075 #endif
00076 
00077 #endif
00078 
00079 #line 1 "init.pgc"
00080 
00081 
00082 enum e { ENUM0, ENUM1 };
00083 struct sa { int member; };
00084 
00085 static int fa(void)
00086 {
00087     printf("in fa\n");
00088     return 2;
00089 }
00090 
00091 static int
00092 fb(int x)
00093 {
00094     printf("in fb (%d)\n", x);
00095     return x;
00096 }
00097 
00098 static int
00099 fc(const char *x)
00100 {
00101     printf("in fc (%s)\n", x);
00102     return *x;
00103 }
00104 
00105 static int fd(const char *x,int i)
00106 {
00107     printf("in fd (%s, %d)\n", x, i);
00108     return (*x)*i;
00109 }
00110 
00111 static int fe(enum e x)
00112 {
00113     printf("in fe (%d)\n", (int) x);
00114     return (int)x;
00115 }
00116 
00117 static void sqlnotice(char *notice, short trans)
00118 {
00119     if (!notice)
00120         notice = "-empty-";
00121     printf("in sqlnotice (%s, %d)\n", notice, trans);
00122 }
00123 
00124 
00125 
00126 #define YES 1
00127 
00128 #ifdef _cplusplus
00129 namespace N
00130 {
00131     static const int i=2;
00132 };
00133 #endif
00134 
00135 int main(void)
00136 {
00137     struct sa x = { 14 },*y = &x;
00138     /* exec sql begin declare section */
00139          
00140          
00141          
00142          
00143          
00144          
00145          
00146 
00147          
00148          
00149          
00150           /* = 1L */ 
00151     
00152 #line 60 "init.pgc"
00153  int a = ( int ) 2 ;
00154  
00155 #line 61 "init.pgc"
00156  int b = 2 + 2 ;
00157  
00158 #line 62 "init.pgc"
00159  int b2 = ( 14 * 7 ) ;
00160  
00161 #line 63 "init.pgc"
00162  int d = x . member ;
00163  
00164 #line 64 "init.pgc"
00165  int g = fb ( 2 ) ;
00166  
00167 #line 65 "init.pgc"
00168  int i = 3 ^ 1 ;
00169  
00170 #line 66 "init.pgc"
00171  int j = 1 ? 1 : 2 ;
00172  
00173 #line 68 "init.pgc"
00174  int e = y -> member ;
00175  
00176 #line 69 "init.pgc"
00177  int c = 10 >> 2 ;
00178  
00179 #line 70 "init.pgc"
00180  bool h = 2 || 1 ;
00181  
00182 #line 71 "init.pgc"
00183  long iay ;
00184 /* exec sql end declare section */
00185 #line 72 "init.pgc"
00186 
00187 
00188     int f=fa();
00189 
00190 #ifdef _cplusplus
00191     /* exec sql begin declare section */
00192       /* compile error */
00193     
00194 #line 78 "init.pgc"
00195  int k = N : : i ;
00196 /* exec sql end declare section */
00197 #line 79 "init.pgc"
00198 
00199 #endif
00200 
00201     ECPGdebug(1, stderr);
00202 
00203     printf("%d %d %d %d %d %d %d %d %d %d %d\n", a, b, b2, c, d, e, f, g, h, i, j);
00204     iay = 0;
00205     printf("%ld\n", iay);
00206     /* exec sql whenever sqlerror  do fa ( ) ; */
00207 #line 87 "init.pgc"
00208 
00209     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
00210 #line 88 "init.pgc"
00211 
00212 if (sqlca.sqlcode < 0) fa ( );}
00213 #line 88 "init.pgc"
00214 
00215     /* exec sql whenever sqlerror  do fb ( 20 ) ; */
00216 #line 89 "init.pgc"
00217 
00218     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
00219 #line 90 "init.pgc"
00220 
00221 if (sqlca.sqlcode < 0) fb ( 20 );}
00222 #line 90 "init.pgc"
00223 
00224     /* exec sql whenever sqlerror  do fc ( \"50\" ) ; */
00225 #line 91 "init.pgc"
00226 
00227     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
00228 #line 92 "init.pgc"
00229 
00230 if (sqlca.sqlcode < 0) fc ( "50" );}
00231 #line 92 "init.pgc"
00232 
00233     /* exec sql whenever sqlerror  do fd ( \"50\" , 1 ) ; */
00234 #line 93 "init.pgc"
00235 
00236     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
00237 #line 94 "init.pgc"
00238 
00239 if (sqlca.sqlcode < 0) fd ( "50" , 1 );}
00240 #line 94 "init.pgc"
00241 
00242     /* exec sql whenever sqlerror  do fe ( ENUM0 ) ; */
00243 #line 95 "init.pgc"
00244 
00245     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
00246 #line 96 "init.pgc"
00247 
00248 if (sqlca.sqlcode < 0) fe ( ENUM0 );}
00249 #line 96 "init.pgc"
00250 
00251     /* exec sql whenever sqlerror  do sqlnotice ( NULL , 0 ) ; */
00252 #line 97 "init.pgc"
00253 
00254     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
00255 #line 98 "init.pgc"
00256 
00257 if (sqlca.sqlcode < 0) sqlnotice ( NULL , 0 );}
00258 #line 98 "init.pgc"
00259 
00260     return 0;
00261 }