PostgreSQL Source Code  git master
sql-prepareas.c File Reference
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
Include dependency graph for sql-prepareas.c:

Go to the source code of this file.

Macros

#define ECPGdebug(X, Y)   ECPGdebug((X)+100,(Y))
 

Functions

static void check_result_of_insert (void)
 
int main (void)
 

Macro Definition Documentation

◆ ECPGdebug

#define ECPGdebug (   X,
 
)    ECPGdebug((X)+100,(Y))

Definition at line 7 of file sql-prepareas.c.

Function Documentation

◆ check_result_of_insert()

static void check_result_of_insert ( void  )
static

Definition at line 29 of file sql-prepareas.c.

References ECPGdo(), ECPGst_normal, ECPGt_EOIT, ECPGt_EORT, ECPGt_int, ECPGt_NO_INDICATOR, printf, sqlca, and sqlprint().

Referenced by main().

30 {
31  /* exec sql begin declare section */
32 
33 
34 #line 12 "prepareas.pgc"
35  int ivar1 = 0 , ivar2 = 0 ;
36 /* exec sql end declare section */
37 #line 13 "prepareas.pgc"
38 
39 
40  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select c1 , c2 from test", ECPGt_EOIT,
41  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
42  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
43  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
44  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
45 #line 15 "prepareas.pgc"
46 
47 if (sqlca.sqlcode < 0) sqlprint();}
48 #line 15 "prepareas.pgc"
49 
50  printf("%d %d\n", ivar1, ivar2);
51 }
#define sqlca
Definition: sqlca.h:59
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,...)
Definition: execute.c:2276
#define printf(...)
Definition: port.h:198
void sqlprint(void)
Definition: error.c:336

◆ main()

int main ( void  )

Definition at line 53 of file sql-prepareas.c.

References check_result_of_insert(), ECPGconnect(), ECPGdeallocate(), ECPGdo(), ECPGprepare(), ECPGst_exec_immediate, ECPGst_exec_with_exprlist, ECPGst_execute, ECPGst_normal, ECPGst_prepare, ECPGt_char, ECPGt_const, ECPGt_EOIT, ECPGt_EORT, ECPGt_int, ECPGt_NO_INDICATOR, ECPGtrans(), printf, sqlca, and sqlprint().

54 {
55  /* exec sql begin declare section */
56 
57 
58 
59 #line 22 "prepareas.pgc"
60  int ivar1 = 1 , ivar2 = 2 ;
61 
62 #line 23 "prepareas.pgc"
63  char v_include_dq_name [ 16 ] , v_include_ws_name [ 16 ] , v_normal_name [ 16 ] , v_query [ 64 ] ;
64 /* exec sql end declare section */
65 #line 24 "prepareas.pgc"
66 
67 
68  strcpy(v_normal_name, "normal_name");
69  strcpy(v_include_dq_name, "include_\"_name");
70  strcpy(v_include_ws_name, "include_ _name");
71  strcpy(v_query, "insert into test values(?,?)");
72 
73  /*
74  * preparing for test
75  */
76  { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
77 #line 34 "prepareas.pgc"
78 
79 if (sqlca.sqlcode < 0) sqlprint();}
80 #line 34 "prepareas.pgc"
81 
82  { ECPGtrans(__LINE__, NULL, "begin");
83 #line 35 "prepareas.pgc"
84 
85 if (sqlca.sqlcode < 0) sqlprint();}
86 #line 35 "prepareas.pgc"
87 
88  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( c1 int , c2 int )", ECPGt_EOIT, ECPGt_EORT);
89 #line 36 "prepareas.pgc"
90 
91 if (sqlca.sqlcode < 0) sqlprint();}
92 #line 36 "prepareas.pgc"
93 
94  { ECPGtrans(__LINE__, NULL, "commit work");
95 #line 37 "prepareas.pgc"
96 
97 if (sqlca.sqlcode < 0) sqlprint();}
98 #line 37 "prepareas.pgc"
99 
100  { ECPGtrans(__LINE__, NULL, "begin");
101 #line 38 "prepareas.pgc"
102 
103 if (sqlca.sqlcode < 0) sqlprint();}
104 #line 38 "prepareas.pgc"
105 
106 
107  /*
108  * Non dynamic statement
109  */
110  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
111 #line 43 "prepareas.pgc"
112 
113 if (sqlca.sqlcode < 0) sqlprint();}
114 #line 43 "prepareas.pgc"
115 
116  printf("+++++ Test for prepnormal +++++\n");
117  printf("insert into test values(:ivar1,:ivar2)\n");
118  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( $1 , $2 )",
119  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
120  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
121  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
122  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
123 #line 46 "prepareas.pgc"
124 
125 if (sqlca.sqlcode < 0) sqlprint();}
126 #line 46 "prepareas.pgc"
127 
129 
130  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
131 #line 49 "prepareas.pgc"
132 
133 if (sqlca.sqlcode < 0) sqlprint();}
134 #line 49 "prepareas.pgc"
135 
136  printf("+++++ Test for execute immediate +++++\n");
137  printf("execute immediate \"insert into test values(1,2)\"\n");
138  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_immediate, "insert into test values(1,2)", ECPGt_EOIT, ECPGt_EORT);
139 #line 52 "prepareas.pgc"
140 
141 if (sqlca.sqlcode < 0) sqlprint();}
142 #line 52 "prepareas.pgc"
143 
145 
146  /*
147  * PREPARE FROM
148  */
149  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
150 #line 58 "prepareas.pgc"
151 
152 if (sqlca.sqlcode < 0) sqlprint();}
153 #line 58 "prepareas.pgc"
154 
155  printf("+++++ Test for PREPARE ident FROM CString +++++\n");
156  printf("prepare ident_name from \"insert into test values(?,?)\"\n");
157  { ECPGprepare(__LINE__, NULL, 0, "ident_name", "insert into test values(?,?)");
158 #line 61 "prepareas.pgc"
159 
160 if (sqlca.sqlcode < 0) sqlprint();}
161 #line 61 "prepareas.pgc"
162 
163  printf("execute ident_name using :ivar1,:ivar2\n");
164  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "ident_name",
165  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
166  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
167  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
168  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
169 #line 63 "prepareas.pgc"
170 
171 if (sqlca.sqlcode < 0) sqlprint();}
172 #line 63 "prepareas.pgc"
173 
175 
176  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
177 #line 66 "prepareas.pgc"
178 
179 if (sqlca.sqlcode < 0) sqlprint();}
180 #line 66 "prepareas.pgc"
181 
182  printf("+++++ Test for PREPARE char_variable_normal_name FROM char_variable +++++\n");
183  printf("prepare :v_normal_name from :v_query\n");
184  { ECPGprepare(__LINE__, NULL, 0, v_normal_name, v_query);
185 #line 69 "prepareas.pgc"
186 
187 if (sqlca.sqlcode < 0) sqlprint();}
188 #line 69 "prepareas.pgc"
189 
190  printf("execute :v_normal_name using :ivar1,:ivar2\n");
191  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, v_normal_name,
192  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
193  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
194  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
195  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
196 #line 71 "prepareas.pgc"
197 
198 if (sqlca.sqlcode < 0) sqlprint();}
199 #line 71 "prepareas.pgc"
200 
202 
203  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
204 #line 74 "prepareas.pgc"
205 
206 if (sqlca.sqlcode < 0) sqlprint();}
207 #line 74 "prepareas.pgc"
208 
209  printf("+++++ Test for PREPARE char_variable_inc_dq_name FROM char_variable +++++\n");
210  printf("prepare :v_include_dq_name from :v_query\n");
211  { ECPGprepare(__LINE__, NULL, 0, v_include_dq_name, v_query);
212 #line 77 "prepareas.pgc"
213 
214 if (sqlca.sqlcode < 0) sqlprint();}
215 #line 77 "prepareas.pgc"
216 
217  printf("execute :v_include_dq_name using :ivar1,:ivar2\n");
218  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, v_include_dq_name,
219  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
220  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
221  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
222  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
223 #line 79 "prepareas.pgc"
224 
225 if (sqlca.sqlcode < 0) sqlprint();}
226 #line 79 "prepareas.pgc"
227 
229 
230  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
231 #line 82 "prepareas.pgc"
232 
233 if (sqlca.sqlcode < 0) sqlprint();}
234 #line 82 "prepareas.pgc"
235 
236  printf("+++++ Test for PREPARE char_variable_inc_ws_name FROM char_variable +++++\n");
237  printf("prepare :v_include_ws_name from :v_query\n");
238  { ECPGprepare(__LINE__, NULL, 0, v_include_ws_name, v_query);
239 #line 85 "prepareas.pgc"
240 
241 if (sqlca.sqlcode < 0) sqlprint();}
242 #line 85 "prepareas.pgc"
243 
244  printf("execute :v_include_ws_name using :ivar1,:ivar2\n");
245  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, v_include_ws_name,
246  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
247  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
248  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
249  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
250 #line 87 "prepareas.pgc"
251 
252 if (sqlca.sqlcode < 0) sqlprint();}
253 #line 87 "prepareas.pgc"
254 
256 
257  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
258 #line 90 "prepareas.pgc"
259 
260 if (sqlca.sqlcode < 0) sqlprint();}
261 #line 90 "prepareas.pgc"
262 
263  printf("+++++ Test for PREPARE CString_inc_ws_name FROM char_variable +++++\n");
264  printf("prepare \"include_ _name\" from :v_query\n");
265  { ECPGprepare(__LINE__, NULL, 0, "include_ _name", v_query);
266 #line 93 "prepareas.pgc"
267 
268 if (sqlca.sqlcode < 0) sqlprint();}
269 #line 93 "prepareas.pgc"
270 
271  printf("exec sql execute \"include_ _name\" using :ivar1,:ivar2\n");
272  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "include_ _name",
273  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
274  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
275  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
276  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
277 #line 95 "prepareas.pgc"
278 
279 if (sqlca.sqlcode < 0) sqlprint();}
280 #line 95 "prepareas.pgc"
281 
283 
284  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
285 #line 98 "prepareas.pgc"
286 
287 if (sqlca.sqlcode < 0) sqlprint();}
288 #line 98 "prepareas.pgc"
289 
290  printf("+++++ Test for PREPARE CString_normal_name FROM char_variable +++++\n");
291  printf("prepare \"norma_name\" from :v_query\n");
292  { ECPGprepare(__LINE__, NULL, 0, "normal_name", v_query);
293 #line 101 "prepareas.pgc"
294 
295 if (sqlca.sqlcode < 0) sqlprint();}
296 #line 101 "prepareas.pgc"
297 
298  printf("exec sql execute \"normal_name\" using :ivar1,:ivar2\n");
299  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "normal_name",
300  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
301  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
302  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
303  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
304 #line 103 "prepareas.pgc"
305 
306 if (sqlca.sqlcode < 0) sqlprint();}
307 #line 103 "prepareas.pgc"
308 
310 
311  /*
312  * PREPARE AS
313  */
314  { ECPGdeallocate(__LINE__, 0, NULL, "ident_name");
315 #line 109 "prepareas.pgc"
316 
317 if (sqlca.sqlcode < 0) sqlprint();}
318 #line 109 "prepareas.pgc"
319 
320  { ECPGdeallocate(__LINE__, 0, NULL, "normal_name");
321 #line 110 "prepareas.pgc"
322 
323 if (sqlca.sqlcode < 0) sqlprint();}
324 #line 110 "prepareas.pgc"
325 
326  { ECPGdeallocate(__LINE__, 0, NULL, "include_ _name");
327 #line 111 "prepareas.pgc"
328 
329 if (sqlca.sqlcode < 0) sqlprint();}
330 #line 111 "prepareas.pgc"
331 
332 
333  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
334 #line 113 "prepareas.pgc"
335 
336 if (sqlca.sqlcode < 0) sqlprint();}
337 #line 113 "prepareas.pgc"
338 
339  printf("+++++ Test for PREPARE ident(typelist) AS +++++\n");
340  printf("prepare ident_name(int,int) as insert into test values($1,$2)\n");
341  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepare, "prepare $0 ( int , int ) as insert into test values ( $1 , $2 )",
342  ECPGt_const,"ident_name",(long)10,(long)1,strlen("ident_name"),
343  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
344 #line 116 "prepareas.pgc"
345 
346 if (sqlca.sqlcode < 0) sqlprint();}
347 #line 116 "prepareas.pgc"
348 
349  printf("execute ident_name(:ivar1,:ivar2)\n");
350  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
351  ECPGt_const,"ident_name",(long)10,(long)1,strlen("ident_name"),
352  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
353  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
354  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
355  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
356  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
357 #line 118 "prepareas.pgc"
358 
359 if (sqlca.sqlcode < 0) sqlprint();}
360 #line 118 "prepareas.pgc"
361 
363  { ECPGdeallocate(__LINE__, 0, NULL, "ident_name");
364 #line 120 "prepareas.pgc"
365 
366 if (sqlca.sqlcode < 0) sqlprint();}
367 #line 120 "prepareas.pgc"
368 
369 
370  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
371 #line 122 "prepareas.pgc"
372 
373 if (sqlca.sqlcode < 0) sqlprint();}
374 #line 122 "prepareas.pgc"
375 
376  printf("+++++ Test for PREPARE CString_normal_name(typelist) AS +++++\n");
377  printf("prepare \"normal_name\"(int,int) as insert into test values($1,$2)\n");
378  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepare, "prepare $0 ( int , int ) as insert into test values ( $1 , $2 )",
379  ECPGt_const,"normal_name",(long)11,(long)1,strlen("normal_name"),
380  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
381 #line 125 "prepareas.pgc"
382 
383 if (sqlca.sqlcode < 0) sqlprint();}
384 #line 125 "prepareas.pgc"
385 
386  printf("execute \"normal_name\"(:ivar1,:ivar2)\n");
387  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
388  ECPGt_const,"normal_name",(long)11,(long)1,strlen("normal_name"),
389  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
390  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
391  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
392  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
393  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
394 #line 127 "prepareas.pgc"
395 
396 if (sqlca.sqlcode < 0) sqlprint();}
397 #line 127 "prepareas.pgc"
398 
400  { ECPGdeallocate(__LINE__, 0, NULL, "normal_name");
401 #line 129 "prepareas.pgc"
402 
403 if (sqlca.sqlcode < 0) sqlprint();}
404 #line 129 "prepareas.pgc"
405 
406 
407  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
408 #line 131 "prepareas.pgc"
409 
410 if (sqlca.sqlcode < 0) sqlprint();}
411 #line 131 "prepareas.pgc"
412 
413  printf("+++++ Test for PREPARE CString_include_ws_name(typelist) AS +++++\n");
414  printf("prepare \"include_ _name\"(int,int) as insert into test values($1,$2)\n");
415  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepare, "prepare $0 ( int , int ) as insert into test values ( $1 , $2 )",
416  ECPGt_const,"include_ _name",(long)14,(long)1,strlen("include_ _name"),
417  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
418 #line 134 "prepareas.pgc"
419 
420 if (sqlca.sqlcode < 0) sqlprint();}
421 #line 134 "prepareas.pgc"
422 
423  printf("execute \"include_ _name\"(:ivar1,:ivar2)\n");
424  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
425  ECPGt_const,"include_ _name",(long)14,(long)1,strlen("include_ _name"),
426  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
427  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
428  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
429  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
430  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
431 #line 136 "prepareas.pgc"
432 
433 if (sqlca.sqlcode < 0) sqlprint();}
434 #line 136 "prepareas.pgc"
435 
437  { ECPGdeallocate(__LINE__, 0, NULL, "include_ _name");
438 #line 138 "prepareas.pgc"
439 
440 if (sqlca.sqlcode < 0) sqlprint();}
441 #line 138 "prepareas.pgc"
442 
443 
444  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
445 #line 140 "prepareas.pgc"
446 
447 if (sqlca.sqlcode < 0) sqlprint();}
448 #line 140 "prepareas.pgc"
449 
450  printf("+++++ Test for PREPARE char_variable_normal_name(typelist) AS +++++\n");
451  printf("prepare :v_normal_name(int,int) as insert into test values($1,$2)\n");
452  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepare, "prepare $0 ( int , int ) as insert into test values ( $1 , $2 )",
453  ECPGt_char,(v_normal_name),(long)16,(long)1,(16)*sizeof(char),
454  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
455 #line 143 "prepareas.pgc"
456 
457 if (sqlca.sqlcode < 0) sqlprint();}
458 #line 143 "prepareas.pgc"
459 
460  printf("execute :v_normal_name(:ivar1,:ivar2)\n");
461  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
462  ECPGt_char,(v_normal_name),(long)16,(long)1,(16)*sizeof(char),
463  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
464  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
465  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
466  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
467  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
468 #line 145 "prepareas.pgc"
469 
470 if (sqlca.sqlcode < 0) sqlprint();}
471 #line 145 "prepareas.pgc"
472 
474  { ECPGdeallocate(__LINE__, 0, NULL, "normal_name");
475 #line 147 "prepareas.pgc"
476 
477 if (sqlca.sqlcode < 0) sqlprint();}
478 #line 147 "prepareas.pgc"
479 
480 
481  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
482 #line 149 "prepareas.pgc"
483 
484 if (sqlca.sqlcode < 0) sqlprint();}
485 #line 149 "prepareas.pgc"
486 
487  printf("+++++ Test for PREPARE char_variable_include_ws_name(typelist) AS +++++\n");
488  printf("prepare :v_include_ws_name(int,int) as insert into test values($1,$2)\n");
489  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepare, "prepare $0 ( int , int ) as insert into test values ( $1 , $2 )",
490  ECPGt_char,(v_include_ws_name),(long)16,(long)1,(16)*sizeof(char),
491  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
492 #line 152 "prepareas.pgc"
493 
494 if (sqlca.sqlcode < 0) sqlprint();}
495 #line 152 "prepareas.pgc"
496 
497  printf("execute :v_include_ws_name(:ivar1,:ivar2)\n");
498  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
499  ECPGt_char,(v_include_ws_name),(long)16,(long)1,(16)*sizeof(char),
500  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
501  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
502  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
503  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
504  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
505 #line 154 "prepareas.pgc"
506 
507 if (sqlca.sqlcode < 0) sqlprint();}
508 #line 154 "prepareas.pgc"
509 
511  { ECPGdeallocate(__LINE__, 0, NULL, "include_ _name");
512 #line 156 "prepareas.pgc"
513 
514 if (sqlca.sqlcode < 0) sqlprint();}
515 #line 156 "prepareas.pgc"
516 
517 
518  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
519 #line 158 "prepareas.pgc"
520 
521 if (sqlca.sqlcode < 0) sqlprint();}
522 #line 158 "prepareas.pgc"
523 
524  printf("+++++ Test for EXECUTE :v_normal_name(const,const) +++++\n");
525  printf("prepare :v_normal_name from :v_query\n");
526  { ECPGprepare(__LINE__, NULL, 0, v_normal_name, v_query);
527 #line 161 "prepareas.pgc"
528 
529 if (sqlca.sqlcode < 0) sqlprint();}
530 #line 161 "prepareas.pgc"
531 
532  printf("execute :v_normal_name(1,2)\n");
533  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( 1 , 2 )",
534  ECPGt_char,(v_normal_name),(long)16,(long)1,(16)*sizeof(char),
535  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
536 #line 163 "prepareas.pgc"
537 
538 if (sqlca.sqlcode < 0) sqlprint();}
539 #line 163 "prepareas.pgc"
540 
542  { ECPGdeallocate(__LINE__, 0, NULL, "normal_name");
543 #line 165 "prepareas.pgc"
544 
545 if (sqlca.sqlcode < 0) sqlprint();}
546 #line 165 "prepareas.pgc"
547 
548 
549  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
550 #line 167 "prepareas.pgc"
551 
552 if (sqlca.sqlcode < 0) sqlprint();}
553 #line 167 "prepareas.pgc"
554 
555  printf("+++++ Test for EXECUTE :v_normal_name(expr,expr) +++++\n");
556  printf("prepare :v_normal_name from :v_query\n");
557  { ECPGprepare(__LINE__, NULL, 0, v_normal_name, v_query);
558 #line 170 "prepareas.pgc"
559 
560 if (sqlca.sqlcode < 0) sqlprint();}
561 #line 170 "prepareas.pgc"
562 
563  printf("execute :v_normal_name(0+1,1+1)\n");
564  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( 0 + 1 , 1 + 1 )",
565  ECPGt_char,(v_normal_name),(long)16,(long)1,(16)*sizeof(char),
566  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
567 #line 172 "prepareas.pgc"
568 
569 if (sqlca.sqlcode < 0) sqlprint();}
570 #line 172 "prepareas.pgc"
571 
573  { ECPGdeallocate(__LINE__, 0, NULL, "normal_name");
574 #line 174 "prepareas.pgc"
575 
576 if (sqlca.sqlcode < 0) sqlprint();}
577 #line 174 "prepareas.pgc"
578 
579 
580  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
581 #line 176 "prepareas.pgc"
582 
583 if (sqlca.sqlcode < 0) sqlprint();}
584 #line 176 "prepareas.pgc"
585 
586  printf("+++++ Test for combination PREPARE FROM and EXECUTE ident(typelist) +++++\n");
587  printf("prepare ident_name from :v_query\n");
588  { ECPGprepare(__LINE__, NULL, 0, "ident_name", v_query);
589 #line 179 "prepareas.pgc"
590 
591 if (sqlca.sqlcode < 0) sqlprint();}
592 #line 179 "prepareas.pgc"
593 
594  printf("execute ident_name(:ivar1,:ivar2)\n");
595  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
596  ECPGt_const,"ident_name",(long)10,(long)1,strlen("ident_name"),
597  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
598  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
599  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
600  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
601  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
602 #line 181 "prepareas.pgc"
603 
604 if (sqlca.sqlcode < 0) sqlprint();}
605 #line 181 "prepareas.pgc"
606 
608  { ECPGdeallocate(__LINE__, 0, NULL, "ident_name");
609 #line 183 "prepareas.pgc"
610 
611 if (sqlca.sqlcode < 0) sqlprint();}
612 #line 183 "prepareas.pgc"
613 
614 
615  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
616 #line 185 "prepareas.pgc"
617 
618 if (sqlca.sqlcode < 0) sqlprint();}
619 #line 185 "prepareas.pgc"
620 
621  printf("+++++ Test for combination PREPARE FROM and EXECUTE CString_include_ws_name(typelist) +++++\n");
622  printf("prepare \"include_ _name\" from :v_query\n");
623  { ECPGprepare(__LINE__, NULL, 0, "include_ _name", v_query);
624 #line 188 "prepareas.pgc"
625 
626 if (sqlca.sqlcode < 0) sqlprint();}
627 #line 188 "prepareas.pgc"
628 
629  printf("execute \"include_ _name\"(:ivar1,:ivar2)\n");
630  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
631  ECPGt_const,"include_ _name",(long)14,(long)1,strlen("include_ _name"),
632  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
633  ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
634  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
635  ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
636  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
637 #line 190 "prepareas.pgc"
638 
639 if (sqlca.sqlcode < 0) sqlprint();}
640 #line 190 "prepareas.pgc"
641 
643  { ECPGdeallocate(__LINE__, 0, NULL, "include_ _name");
644 #line 192 "prepareas.pgc"
645 
646 if (sqlca.sqlcode < 0) sqlprint();}
647 #line 192 "prepareas.pgc"
648 
649 
650  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
651 #line 194 "prepareas.pgc"
652 
653 if (sqlca.sqlcode < 0) sqlprint();}
654 #line 194 "prepareas.pgc"
655 
656  { ECPGtrans(__LINE__, NULL, "commit work");
657 #line 195 "prepareas.pgc"
658 
659 if (sqlca.sqlcode < 0) sqlprint();}
660 #line 195 "prepareas.pgc"
661 
662 
663  return 0;
664 }
#define sqlca
Definition: sqlca.h:59
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,...)
Definition: execute.c:2276
bool ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, const char *name, const char *variable)
Definition: prepare.c:217
#define printf(...)
Definition: port.h:198
bool ECPGconnect(int lineno, int c, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)
Definition: connect.c:271
static void check_result_of_insert(void)
Definition: sql-prepareas.c:29
bool ECPGdeallocate(int lineno, int c, const char *connection_name, const char *name)
Definition: prepare.c:315
void sqlprint(void)
Definition: error.c:336
bool ECPGtrans(int lineno, const char *connection_name, const char *transaction)
Definition: misc.c:198