| 1 |
/* Processed by ecpg (regression mode) */ |
| 2 |
/* These include files are added by the preprocessor */ |
| 3 |
#include <ecpglib.h> |
| 4 |
#include <ecpgerrno.h> |
| 5 |
#include <sqlca.h> |
| 6 |
/* End of automatic include section */ |
| 7 |
#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y)) |
| 8 |
|
| 9 |
#line 1 "init.pgc" |
| 10 |
|
| 11 |
#line 1 "sqlca.h" |
| 12 |
#ifndef POSTGRES_SQLCA_H |
| 13 |
#define POSTGRES_SQLCA_H |
| 14 |
|
| 15 |
#ifndef PGDLLIMPORT |
| 16 |
#if defined(WIN32) || defined(__CYGWIN__) |
| 17 |
#define PGDLLIMPORT __declspec (dllimport) |
| 18 |
#else |
| 19 |
#define PGDLLIMPORT |
| 20 |
#endif /* __CYGWIN__ */ |
| 21 |
#endif /* PGDLLIMPORT */ |
| 22 |
|
| 23 |
#define SQLERRMC_LEN 150 |
| 24 |
|
| 25 |
#ifdef __cplusplus |
| 26 |
extern "C" |
| 27 |
{ |
| 28 |
#endif |
| 29 |
|
| 30 |
struct sqlca_t |
| 31 |
{ |
| 32 |
char sqlcaid[8]; |
| 33 |
long sqlabc; |
| 34 |
long sqlcode; |
| 35 |
struct |
| 36 |
{ |
| 37 |
int sqlerrml; |
| 38 |
char sqlerrmc[SQLERRMC_LEN]; |
| 39 |
} sqlerrm; |
| 40 |
char sqlerrp[8]; |
| 41 |
long sqlerrd[6]; |
| 42 |
/* Element 0: empty */ |
| 43 |
/* 1: OID of processed tuple if applicable */ |
| 44 |
/* 2: number of rows processed */ |
| 45 |
/* after an INSERT, UPDATE or */ |
| 46 |
/* DELETE statement */ |
| 47 |
/* 3: empty */ |
| 48 |
/* 4: empty */ |
| 49 |
/* 5: empty */ |
| 50 |
char sqlwarn[8]; |
| 51 |
/* Element 0: set to 'W' if at least one other is 'W' */ |
| 52 |
/* 1: if 'W' at least one character string */ |
| 53 |
/* value was truncated when it was */ |
| 54 |
/* stored into a host variable. */ |
| 55 |
|
| 56 |
/* |
| 57 |
* 2: if 'W' a (hopefully) non-fatal notice occurred |
| 58 |
*/ /* 3: empty */ |
| 59 |
/* 4: empty */ |
| 60 |
/* 5: empty */ |
| 61 |
/* 6: empty */ |
| 62 |
/* 7: empty */ |
| 63 |
|
| 64 |
char sqlstate[5]; |
| 65 |
}; |
| 66 |
|
| 67 |
struct sqlca_t *ECPGget_sqlca(void); |
| 68 |
|
| 69 |
#ifndef POSTGRES_ECPG_INTERNAL |
| 70 |
#define sqlca (*ECPGget_sqlca()) |
| 71 |
#endif |
| 72 |
|
| 73 |
#ifdef __cplusplus |
| 74 |
} |
| 75 |
#endif |
| 76 |
|
| 77 |
#endif |
| 78 |
|
| 79 |
#line 1 "init.pgc" |
| 80 |
|
| 81 |
|
| 82 |
enum e { ENUM0, ENUM1 }; |
| 83 |
struct sa { int member; }; |
| 84 |
|
| 85 |
static int fa(void) |
| 86 |
{ |
| 87 |
printf("in fa\n"); |
| 88 |
return 2; |
| 89 |
} |
| 90 |
|
| 91 |
static int |
| 92 |
fb(int x) |
| 93 |
{ |
| 94 |
printf("in fb (%d)\n", x); |
| 95 |
return x; |
| 96 |
} |
| 97 |
|
| 98 |
static int |
| 99 |
fc(const char *x) |
| 100 |
{ |
| 101 |
printf("in fc (%s)\n", x); |
| 102 |
return *x; |
| 103 |
} |
| 104 |
|
| 105 |
static int fd(const char *x,int i) |
| 106 |
{ |
| 107 |
printf("in fd (%s, %d)\n", x, i); |
| 108 |
return (*x)*i; |
| 109 |
} |
| 110 |
|
| 111 |
static int fe(enum e x) |
| 112 |
{ |
| 113 |
printf("in fe (%d)\n", (int) x); |
| 114 |
return (int)x; |
| 115 |
} |
| 116 |
|
| 117 |
static void sqlnotice(const char *notice, short trans) |
| 118 |
{ |
| 119 |
if (!notice) |
| 120 |
notice = "-empty-"; |
| 121 |
printf("in sqlnotice (%s, %d)\n", notice, trans); |
| 122 |
} |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
#define YES 1 |
| 127 |
|
| 128 |
#ifdef _cplusplus |
| 129 |
namespace N |
| 130 |
{ |
| 131 |
static const int i=2; |
| 132 |
}; |
| 133 |
#endif |
| 134 |
|
| 135 |
int main(void) |
| 136 |
{ |
| 137 |
struct sa x = { 14 },*y = &x; |
| 138 |
/* exec sql begin declare section */ |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
/* = 1L */ |
| 151 |
|
| 152 |
#line 60 "init.pgc" |
| 153 |
int a = ( int ) 2 ; |
| 154 |
|
| 155 |
#line 61 "init.pgc" |
| 156 |
int b = 2 + 2 ; |
| 157 |
|
| 158 |
#line 62 "init.pgc" |
| 159 |
int b2 = ( 14 * 7 ) ; |
| 160 |
|
| 161 |
#line 63 "init.pgc" |
| 162 |
int d = x . member ; |
| 163 |
|
| 164 |
#line 64 "init.pgc" |
| 165 |
int g = fb ( 2 ) ; |
| 166 |
|
| 167 |
#line 65 "init.pgc" |
| 168 |
int i = 3 ^ 1 ; |
| 169 |
|
| 170 |
#line 66 "init.pgc" |
| 171 |
int j = 1 ? 1 : 2 ; |
| 172 |
|
| 173 |
#line 68 "init.pgc" |
| 174 |
int e = y -> member ; |
| 175 |
|
| 176 |
#line 69 "init.pgc" |
| 177 |
int c = 10 >> 2 ; |
| 178 |
|
| 179 |
#line 70 "init.pgc" |
| 180 |
bool h = 2 || 1 ; |
| 181 |
|
| 182 |
#line 71 "init.pgc" |
| 183 |
long iay ; |
| 184 |
/* exec sql end declare section */ |
| 185 |
#line 72 "init.pgc" |
| 186 |
|
| 187 |
|
| 188 |
int f=fa(); |
| 189 |
|
| 190 |
#ifdef _cplusplus |
| 191 |
/* exec sql begin declare section */ |
| 192 |
/* compile error */ |
| 193 |
|
| 194 |
#line 78 "init.pgc" |
| 195 |
int k = N : : i ; |
| 196 |
/* exec sql end declare section */ |
| 197 |
#line 79 "init.pgc" |
| 198 |
|
| 199 |
#endif |
| 200 |
|
| 201 |
ECPGdebug(1, stderr); |
| 202 |
|
| 203 |
printf("%d %d %d %d %d %d %d %d %d %d %d\n", a, b, b2, c, d, e, f, g, h, i, j); |
| 204 |
iay = 0; |
| 205 |
printf("%ld\n", iay); |
| 206 |
/* exec sql whenever sqlerror do fa ( ) ; */ |
| 207 |
#line 87 "init.pgc" |
| 208 |
|
| 209 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT); |
| 210 |
#line 88 "init.pgc" |
| 211 |
|
| 212 |
if (sqlca.sqlcode < 0) fa ( );} |
| 213 |
#line 88 "init.pgc" |
| 214 |
|
| 215 |
/* exec sql whenever sqlerror do fb ( 20 ) ; */ |
| 216 |
#line 89 "init.pgc" |
| 217 |
|
| 218 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT); |
| 219 |
#line 90 "init.pgc" |
| 220 |
|
| 221 |
if (sqlca.sqlcode < 0) fb ( 20 );} |
| 222 |
#line 90 "init.pgc" |
| 223 |
|
| 224 |
/* exec sql whenever sqlerror do fc ( \"50\" ) ; */ |
| 225 |
#line 91 "init.pgc" |
| 226 |
|
| 227 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT); |
| 228 |
#line 92 "init.pgc" |
| 229 |
|
| 230 |
if (sqlca.sqlcode < 0) fc ( "50" );} |
| 231 |
#line 92 "init.pgc" |
| 232 |
|
| 233 |
/* exec sql whenever sqlerror do fd ( \"50\" , 1 ) ; */ |
| 234 |
#line 93 "init.pgc" |
| 235 |
|
| 236 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT); |
| 237 |
#line 94 "init.pgc" |
| 238 |
|
| 239 |
if (sqlca.sqlcode < 0) fd ( "50" , 1 );} |
| 240 |
#line 94 "init.pgc" |
| 241 |
|
| 242 |
/* exec sql whenever sqlerror do fe ( ENUM0 ) ; */ |
| 243 |
#line 95 "init.pgc" |
| 244 |
|
| 245 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT); |
| 246 |
#line 96 "init.pgc" |
| 247 |
|
| 248 |
if (sqlca.sqlcode < 0) fe ( ENUM0 );} |
| 249 |
#line 96 "init.pgc" |
| 250 |
|
| 251 |
/* exec sql whenever sqlerror do sqlnotice ( NULL , 0 ) ; */ |
| 252 |
#line 97 "init.pgc" |
| 253 |
|
| 254 |
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT); |
| 255 |
#line 98 "init.pgc" |
| 256 |
|
| 257 |
if (sqlca.sqlcode < 0) sqlnotice ( NULL , 0 );} |
| 258 |
#line 98 "init.pgc" |
| 259 |
|
| 260 |
return 0; |
| 261 |
} |