7 #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
14 #line 1 "regression.h"
21 #line 4 "variable.pgc"
25 #line 6 "variable.pgc"
29 #line 8 "variable.pgc"
40 #line 11 "variable.pgc"
42 typedef union {
int integer;
short smallint; }
ind;
46 #line 15 "variable.pgc"
50 #line 18 "variable.pgc"
57 #line 23 "variable.pgc"
60 #line 23 "variable.pgc"
63 #line 23 "variable.pgc"
77 #line 27 "variable.pgc"
78 struct personal_struct {
79 #line 25 "variable.pgc"
82 #line 26 "variable.pgc"
83 struct birthinfo birth ;
86 #line 30 "variable.pgc"
87 struct personal_indicator {
88 #line 28 "variable.pgc"
91 #line 29 "variable.pgc"
92 struct birthinfo ind_birth ;
93 } ind_personal , *
i ;
95 #line 31 "variable.pgc"
98 #line 32 "variable.pgc"
101 #line 32 "variable.pgc"
104 #line 33 "variable.pgc"
105 static struct varchar_4 {
int len;
char arr[ 50 ]; } vc1 ;
static struct varchar_5 {
int len;
char arr[ 50 ]; } vc2 ;
static struct varchar_6 {
int len;
char arr[ 255 ]; } vc3 ;
107 #line 34 "variable.pgc"
108 static int i1 , i2 , i3 ;
110 #line 35 "variable.pgc"
114 #line 37 "variable.pgc"
115 char * married = NULL ;
117 #line 37 "variable.pgc"
120 #line 38 "variable.pgc"
123 #line 38 "variable.pgc"
126 #line 39 "variable.pgc"
129 #line 39 "variable.pgc"
136 strcpy(msg,
"connect");
137 {
ECPGconnect(__LINE__, 0,
"ecpg1_regression" , NULL, NULL , NULL, 0);
138 #line 46 "variable.pgc"
141 #line 46 "variable.pgc"
146 #line 49 "variable.pgc"
149 #line 49 "variable.pgc"
152 strcpy(msg,
"create");
153 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer )",
ECPGt_EOIT,
ECPGt_EORT);
154 #line 52 "variable.pgc"
157 #line 52 "variable.pgc"
160 strcpy(msg,
"insert");
161 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 )",
ECPGt_EOIT,
ECPGt_EORT);
162 #line 55 "variable.pgc"
165 #line 55 "variable.pgc"
167 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 )",
ECPGt_EOIT,
ECPGt_EORT);
168 #line 56 "variable.pgc"
171 #line 56 "variable.pgc"
173 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"insert into family ( name , age ) values ( 'Child 1' , 16 )",
ECPGt_EOIT,
ECPGt_EORT);
174 #line 57 "variable.pgc"
177 #line 57 "variable.pgc"
179 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"insert into family ( name , age ) values ( 'Child 2' , 14 )",
ECPGt_EOIT,
ECPGt_EORT);
180 #line 58 "variable.pgc"
183 #line 58 "variable.pgc"
185 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"insert into family ( name , age ) values ( 'Child 3' , 9 )",
ECPGt_EOIT,
ECPGt_EORT);
186 #line 59 "variable.pgc"
189 #line 59 "variable.pgc"
192 strcpy(msg,
"commit");
194 #line 62 "variable.pgc"
197 #line 62 "variable.pgc"
201 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"declare cur cursor for select name , born , age , married , children from family",
ECPGt_EOIT,
ECPGt_EORT);
202 #line 65 "variable.pgc"
205 #line 65 "variable.pgc"
209 #line 67 "variable.pgc"
214 memset(
i, 0,
sizeof(ind_personal));
215 for (loopcount = 0; loopcount < 100; loopcount++) {
216 strcpy(msg,
"fetch");
219 ECPGt_int,&(
i->ind_name),(
long)1,(
long)-1,
sizeof(
struct birthinfo ),
220 ECPGt_long,&(p->birth.born),(
long)1,(
long)1,
sizeof(
struct birthinfo ),
221 ECPGt_long,&(
i->ind_birth.born),(
long)1,(
long)1,
sizeof(
struct birthinfo ),
222 ECPGt_short,&(p->birth.age),(
long)1,(
long)1,
sizeof(
struct birthinfo ),
223 ECPGt_short,&(
i->ind_birth.age),(
long)1,(
long)1,
sizeof(
struct birthinfo ),
224 ECPGt_char,&(married),(
long)0,(
long)1,(1)*
sizeof(
char),
225 ECPGt_long,&(ind_married),(
long)1,(
long)1,
sizeof(
long),
228 #line 74 "variable.pgc"
231 #line 74 "variable.pgc"
234 #line 74 "variable.pgc"
236 printf(
"%8.8s", personal.name.arr);
237 if (
i->ind_birth.born >= 0)
238 printf(
", born %ld", personal.birth.born);
239 if (
i->ind_birth.age >= 0)
240 printf(
", age = %d", personal.birth.age);
241 if (ind_married >= 0)
242 printf(
", married %s", married);
251 strcpy(msg,
"close");
253 #line 91 "variable.pgc"
256 #line 91 "variable.pgc"
261 #line 94 "variable.pgc"
264 #line 94 "variable.pgc"
267 strcpy(msg,
"commit");
269 #line 97 "variable.pgc"
272 #line 97 "variable.pgc"
275 strcpy(msg,
"disconnect");
277 #line 100 "variable.pgc"
280 #line 100 "variable.pgc"
284 vc1.len = vc2.len = vc3.len = 0;
286 printf(
"%d %d %d %d %d %d\n",
287 vc1.len, vc2.len, vc3.len,
bool ECPGdisconnect(int lineno, const char *connection_name)
bool ECPGconnect(int lineno, int c, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)
bool ECPGdo(const int lineno, const int compat, const int force_indicator, const char *connection_name, const bool questionmarks, const int st, const char *query,...)
bool ECPGtrans(int lineno, const char *connection_name, const char *transaction)