1
/* Processed by ecpg (regression mode) */
2
/* These include files are added by the preprocessor */
6
/* End of automatic include section */
7
#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
9
#line 1 "dynalloc2.pgc"
13
#ifndef POSTGRES_SQLCA_H
14
#define POSTGRES_SQLCA_H
17
#if defined(WIN32) || defined(__CYGWIN__)
18
#define PGDLLIMPORT __declspec (dllimport)
21
#endif /* __CYGWIN__ */
22
#endif /* PGDLLIMPORT */
24
#define SQLERRMC_LEN 150
39
char sqlerrmc[SQLERRMC_LEN];
43
/* Element 0: empty */
44
/* 1: OID of processed tuple if applicable */
45
/* 2: number of rows processed */
46
/* after an INSERT, UPDATE or */
47
/* DELETE statement */
52
/* Element 0: set to 'W' if at least one other is 'W' */
53
/* 1: if 'W' at least one character string */
54
/* value was truncated when it was */
55
/* stored into a host variable. */
58
* 2: if 'W' a (hopefully) non-fatal notice occurred
68
struct sqlca_t *ECPGget_sqlca(void);
70
#ifndef POSTGRES_ECPG_INTERNAL
71
#define sqlca (*ECPGget_sqlca())
80
#line 2 "dynalloc2.pgc"
84
#line 1 "regression.h"
91
#line 4 "dynalloc2.pgc"
96
/* exec sql begin declare section */
103
#line 9 "dynalloc2.pgc"
106
#line 10 "dynalloc2.pgc"
109
#line 11 "dynalloc2.pgc"
110
int * ipointer1 = 0 ;
112
#line 12 "dynalloc2.pgc"
113
int * ipointer2 = 0 ;
115
#line 13 "dynalloc2.pgc"
117
/* exec sql end declare section */
118
#line 14 "dynalloc2.pgc"
122
ECPGdebug(1, stderr);
124
/* exec sql whenever sqlerror do sqlprint ( ) ; */
125
#line 19 "dynalloc2.pgc"
127
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0);
128
#line 20 "dynalloc2.pgc"
130
if (sqlca.sqlcode < 0) sqlprint ( );}
131
#line 20 "dynalloc2.pgc"
134
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to postgres", ECPGt_EOIT, ECPGt_EORT);
135
#line 22 "dynalloc2.pgc"
137
if (sqlca.sqlcode < 0) sqlprint ( );}
138
#line 22 "dynalloc2.pgc"
141
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( a int , b text )", ECPGt_EOIT, ECPGt_EORT);
142
#line 24 "dynalloc2.pgc"
144
if (sqlca.sqlcode < 0) sqlprint ( );}
145
#line 24 "dynalloc2.pgc"
147
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( 1 , 'one' )", ECPGt_EOIT, ECPGt_EORT);
148
#line 25 "dynalloc2.pgc"
150
if (sqlca.sqlcode < 0) sqlprint ( );}
151
#line 25 "dynalloc2.pgc"
153
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( 2 , 'two' )", ECPGt_EOIT, ECPGt_EORT);
154
#line 26 "dynalloc2.pgc"
156
if (sqlca.sqlcode < 0) sqlprint ( );}
157
#line 26 "dynalloc2.pgc"
159
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( null , 'three' )", ECPGt_EOIT, ECPGt_EORT);
160
#line 27 "dynalloc2.pgc"
162
if (sqlca.sqlcode < 0) sqlprint ( );}
163
#line 27 "dynalloc2.pgc"
165
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( 4 , 'four' )", ECPGt_EOIT, ECPGt_EORT);
166
#line 28 "dynalloc2.pgc"
168
if (sqlca.sqlcode < 0) sqlprint ( );}
169
#line 28 "dynalloc2.pgc"
171
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( 5 , null )", ECPGt_EOIT, ECPGt_EORT);
172
#line 29 "dynalloc2.pgc"
174
if (sqlca.sqlcode < 0) sqlprint ( );}
175
#line 29 "dynalloc2.pgc"
177
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( null , null )", ECPGt_EOIT, ECPGt_EORT);
178
#line 30 "dynalloc2.pgc"
180
if (sqlca.sqlcode < 0) sqlprint ( );}
181
#line 30 "dynalloc2.pgc"
184
ECPGallocate_desc(__LINE__, "mydesc");
185
#line 32 "dynalloc2.pgc"
187
if (sqlca.sqlcode < 0) sqlprint ( );
188
#line 32 "dynalloc2.pgc"
190
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from test", ECPGt_EOIT,
191
ECPGt_descriptor, "mydesc", 0L, 0L, 0L,
192
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
193
#line 33 "dynalloc2.pgc"
195
if (sqlca.sqlcode < 0) sqlprint ( );}
196
#line 33 "dynalloc2.pgc"
198
{ ECPGget_desc_header(__LINE__, "mydesc", &(colnum));
200
#line 34 "dynalloc2.pgc"
202
if (sqlca.sqlcode < 0) sqlprint ( );}
203
#line 34 "dynalloc2.pgc"
205
{ ECPGget_desc(__LINE__, "mydesc", 1,ECPGd_indicator,
206
ECPGt_int,&(ipointer1),(long)1,(long)0,sizeof(int), ECPGd_data,
207
ECPGt_int,&(ip1),(long)1,(long)0,sizeof(int), ECPGd_EODT);
209
#line 35 "dynalloc2.pgc"
211
if (sqlca.sqlcode < 0) sqlprint ( );}
212
#line 35 "dynalloc2.pgc"
214
{ ECPGget_desc(__LINE__, "mydesc", 2,ECPGd_indicator,
215
ECPGt_int,&(ipointer2),(long)1,(long)0,sizeof(int), ECPGd_data,
216
ECPGt_char,&(cp2),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
218
#line 36 "dynalloc2.pgc"
220
if (sqlca.sqlcode < 0) sqlprint ( );}
221
#line 36 "dynalloc2.pgc"
224
printf("Result (%d columns):\n", colnum);
225
for (i=0;i < sqlca.sqlerrd[2];++i)
227
if (ipointer1[i]) printf("NULL, ");
228
else printf("%d, ",ip1[i]);
230
if (ipointer2[i]) printf("NULL, ");
231
else printf("'%s', ",cp2[i]);
237
ECPGdeallocate_desc(__LINE__, "mydesc");
238
#line 51 "dynalloc2.pgc"
240
if (sqlca.sqlcode < 0) sqlprint ( );
241
#line 51 "dynalloc2.pgc"
243
{ ECPGtrans(__LINE__, NULL, "rollback");
244
#line 52 "dynalloc2.pgc"
246
if (sqlca.sqlcode < 0) sqlprint ( );}
247
#line 52 "dynalloc2.pgc"
249
{ ECPGdisconnect(__LINE__, "CURRENT");
250
#line 53 "dynalloc2.pgc"
252
if (sqlca.sqlcode < 0) sqlprint ( );}
253
#line 53 "dynalloc2.pgc"