PostgreSQL Source Code: src/interfaces/ecpg/test/expected/compat_informix-describe.c Source File (original) (raw)
1
2
6
8
9#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
10
11#line 1 "describe.pgc"
12#include <stdlib.h>
14
15
16#line 1 "regression.h"
17
18
19
20
21
22
23#line 4 "describe.pgc"
24
25
26#line 1 "sqlda.h"
27#ifndef ECPG_SQLDA_H
28#define ECPG_SQLDA_H
29
30#ifdef _ECPG_INFORMIX_H
31
35
36#else
37
41
42#endif
43
44#endif
45
46#line 5 "describe.pgc"
47
48
49
50#line 7 "describe.pgc"
51
52
54
55int
57{
58
59
60
61
62
63
64
65#line 15 "describe.pgc"
66 char * stmt1 = "SELECT id, t FROM descr_t1" ;
67
68#line 16 "describe.pgc"
69 char * stmt2 = "SELECT id, t FROM descr_t1 WHERE id = -1" ;
70
71#line 17 "describe.pgc"
72 int i , count1 , count2 ;
73
74#line 18 "describe.pgc"
75 char field_name1 [ 30 ] = "not set" ;
76
77#line 19 "describe.pgc"
78 char field_name2 [ 30 ] = "not set" ;
79
80#line 20 "describe.pgc"
81
82
83 char msg[128];
84
86
87 strcpy(msg, "connect");
88 { ECPGconnect(__LINE__, 1, "ecpg1_regression" , NULL, NULL , NULL, 0);
89#line 27 "describe.pgc"
90
91if (sqlca.sqlcode < 0) exit (1);}
92#line 27 "describe.pgc"
93
94
95 strcpy(msg, "set");
97#line 30 "describe.pgc"
98
99if (sqlca.sqlcode < 0) exit (1);}
100#line 30 "describe.pgc"
101
102
103 strcpy(msg, "create");
105#line 33 "describe.pgc"
106
107if (sqlca.sqlcode < 0) exit (1);}
108#line 33 "describe.pgc"
109
110
111 strcpy(msg, "insert");
112 { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into descr_t1 ( id , t ) values ( default , 'a' )", ECPGt_EOIT, ECPGt_EORT);
113#line 36 "describe.pgc"
114
115if (sqlca.sqlcode < 0) exit (1);}
116#line 36 "describe.pgc"
117
118 { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into descr_t1 ( id , t ) values ( default , 'b' )", ECPGt_EOIT, ECPGt_EORT);
119#line 37 "describe.pgc"
120
121if (sqlca.sqlcode < 0) exit (1);}
122#line 37 "describe.pgc"
123
124 { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into descr_t1 ( id , t ) values ( default , 'c' )", ECPGt_EOIT, ECPGt_EORT);
125#line 38 "describe.pgc"
126
127if (sqlca.sqlcode < 0) exit (1);}
128#line 38 "describe.pgc"
129
130 { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into descr_t1 ( id , t ) values ( default , 'd' )", ECPGt_EOIT, ECPGt_EORT);
131#line 39 "describe.pgc"
132
133if (sqlca.sqlcode < 0) exit (1);}
134#line 39 "describe.pgc"
135
136
137 strcpy(msg, "commit");
138 { ECPGtrans(__LINE__, NULL, "commit");
139#line 42 "describe.pgc"
140
141if (sqlca.sqlcode < 0) exit (1);}
142#line 42 "describe.pgc"
143
144
145
146
147
148
149
150
151 strcpy(msg, "allocate");
153#line 51 "describe.pgc"
154
155if (sqlca.sqlcode < 0) exit (1);
156#line 51 "describe.pgc"
157
159#line 52 "describe.pgc"
160
161if (sqlca.sqlcode < 0) exit (1);
162#line 52 "describe.pgc"
163
164
165 strcpy(msg, "prepare");
166 { ECPGprepare(__LINE__, NULL, 0, "st_id1", stmt1);
167#line 55 "describe.pgc"
168
169if (sqlca.sqlcode < 0) exit (1);}
170#line 55 "describe.pgc"
171
172
174
175 strcpy(msg, "describe");
176 { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id1",
179#line 60 "describe.pgc"
180
181 { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id1",
184#line 61 "describe.pgc"
185
186
187 { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id1",
190#line 63 "describe.pgc"
191
192 { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id1",
195#line 64 "describe.pgc"
196
197 { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id1",
200#line 65 "describe.pgc"
201
202
204 {
205 printf("sqlda1 NULL\n");
206 exit(1);
207 }
208
210 {
211 printf("sqlda2 NULL\n");
212 exit(1);
213 }
214
216 {
217 printf("sqlda3 NULL\n");
218 exit(1);
219 }
220
221 strcpy(msg, "get descriptor");
223
224#line 86 "describe.pgc"
225
226if (sqlca.sqlcode < 0) exit (1);}
227#line 86 "describe.pgc"
228
230
231#line 87 "describe.pgc"
232
233if (sqlca.sqlcode < 0) exit (1);}
234#line 87 "describe.pgc"
235
236
237 if (count1 != count2)
238 {
239 printf("count1 (%d) != count2 (%d)\n", count1, count2);
240 exit(1);
241 }
242
244 {
245 printf("count1 (%d) != sqlda1->sqld (%d)\n", count1, sqlda1->sqld);
246 exit(1);
247 }
248
250 {
251 printf("count1 (%d) != sqlda2->sqld (%d)\n", count1, sqlda2->sqld);
252 exit(1);
253 }
254
256 {
257 printf("count1 (%d) != sqlda3->sqld (%d)\n", count1, sqlda3->sqld);
258 exit(1);
259 }
260
261 for (i = 1; i <= count1; i++)
262 {
265
266#line 115 "describe.pgc"
267
268if (sqlca.sqlcode < 0) exit (1);}
269#line 115 "describe.pgc"
270
273
274#line 116 "describe.pgc"
275
276if (sqlca.sqlcode < 0) exit (1);}
277#line 116 "describe.pgc"
278
279 printf("%d\n\tfield_name1 '%s'\n\tfield_name2 '%s'\n\t"
280 "sqlda1 '%s'\n\tsqlda2 '%s'\n\tsqlda3 '%s'\n",
281 i, field_name1, field_name2,
285 }
286
287 strcpy(msg, "deallocate");
289#line 126 "describe.pgc"
290
291if (sqlca.sqlcode < 0) exit (1);
292#line 126 "describe.pgc"
293
295#line 127 "describe.pgc"
296
297if (sqlca.sqlcode < 0) exit (1);
298#line 127 "describe.pgc"
299
303
305#line 132 "describe.pgc"
306
307if (sqlca.sqlcode < 0) exit (1);}
308#line 132 "describe.pgc"
309
310
311
312
313 strcpy(msg, "allocate");
315#line 137 "describe.pgc"
316
317if (sqlca.sqlcode < 0) exit (1);
318#line 137 "describe.pgc"
319
321#line 138 "describe.pgc"
322
323if (sqlca.sqlcode < 0) exit (1);
324#line 138 "describe.pgc"
325
326
327 strcpy(msg, "prepare");
328 { ECPGprepare(__LINE__, NULL, 0, "st_id2", stmt2);
329#line 141 "describe.pgc"
330
331if (sqlca.sqlcode < 0) exit (1);}
332#line 141 "describe.pgc"
333
334
336
337 strcpy(msg, "describe");
338 { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id2",
341#line 146 "describe.pgc"
342
343 { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id2",
346#line 147 "describe.pgc"
347
348
349 { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id2",
352#line 149 "describe.pgc"
353
354 { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id2",
357#line 150 "describe.pgc"
358
359 { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id2",
362#line 151 "describe.pgc"
363
364
366 exit(1);
367
368 strcpy(msg, "get descriptor");
370
371#line 157 "describe.pgc"
372
373if (sqlca.sqlcode < 0) exit (1);}
374#line 157 "describe.pgc"
375
377
378#line 158 "describe.pgc"
379
380if (sqlca.sqlcode < 0) exit (1);}
381#line 158 "describe.pgc"
382
383
384 if (!( count1 == count2 &&
388 exit(1);
389
390 for (i = 1; i <= count1; i++)
391 {
394
395#line 168 "describe.pgc"
396
397if (sqlca.sqlcode < 0) exit (1);}
398#line 168 "describe.pgc"
399
402
403#line 169 "describe.pgc"
404
405if (sqlca.sqlcode < 0) exit (1);}
406#line 169 "describe.pgc"
407
408 printf("%d\n\tfield_name1 '%s'\n\tfield_name2 '%s'\n\t"
409 "sqlda1 '%s'\n\tsqlda2 '%s'\n\tsqlda3 '%s'\n",
410 i, field_name1, field_name2,
414 }
415
416 strcpy(msg, "deallocate");
418#line 179 "describe.pgc"
419
420if (sqlca.sqlcode < 0) exit (1);
421#line 179 "describe.pgc"
422
424#line 180 "describe.pgc"
425
426if (sqlca.sqlcode < 0) exit (1);
427#line 180 "describe.pgc"
428
432
434#line 185 "describe.pgc"
435
436if (sqlca.sqlcode < 0) exit (1);}
437#line 185 "describe.pgc"
438
439
440
441
442 strcpy(msg, "drop");
444#line 190 "describe.pgc"
445
446if (sqlca.sqlcode < 0) exit (1);}
447#line 190 "describe.pgc"
448
449
450 strcpy(msg, "commit");
451 { ECPGtrans(__LINE__, NULL, "commit");
452#line 193 "describe.pgc"
453
454if (sqlca.sqlcode < 0) exit (1);}
455#line 193 "describe.pgc"
456
457
458 strcpy(msg, "disconnect");
460#line 196 "describe.pgc"
461
462if (sqlca.sqlcode < 0) exit (1);}
463#line 196 "describe.pgc"
464
465
466 return 0;
467}
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 ECPGdeallocate_desc(int line, const char *name)
bool ECPGget_desc(int lineno, const char *desc_name, int index,...)
bool ECPGallocate_desc(int line, const char *name)
bool ECPGdescribe(int line, int compat, bool input, const char *connection_name, const char *stmt_name,...)
bool ECPGget_desc_header(int lineno, const char *desc_name, int *count)
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)
bool ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, const char *name, const char *variable)
bool ECPGdeallocate(int lineno, int c, const char *connection_name, const char *name)
struct sqlvar_struct sqlvar[1]