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))
14/* exec sql whenever sqlerror sqlprint ; */
20#ifndef POSTGRES_SQLCA_H
21 #define POSTGRES_SQLCA_H
24#if defined(WIN32) || defined(__CYGWIN__)
25#define PGDLLIMPORT __declspec (dllimport)
28#endif /* __CYGWIN__ */
29#endif /* PGDLLIMPORT */
31 #define SQLERRMC_LEN 150
50 /* Element 0: empty */
51 /* 1: OID of processed tuple if applicable */
52 /* 2: number of rows processed */
53 /* after an INSERT, UPDATE or */
54 /* DELETE statement */
59 /* Element 0: set to 'W' if at least one other is 'W' */
60 /* 1: if 'W' at least one character string */
61 /* value was truncated when it was */
62 /* stored into a host variable. */
65 * 2: if 'W' a (hopefully) non-fatal notice occurred
77#ifndef POSTGRES_ECPG_INTERNAL
78 #define sqlca (*ECPGget_sqlca())
107/* exec sql begin declare section */
112#line 18 "declare.pgc"
115#line 19 "declare.pgc"
118#line 20 "declare.pgc"
120/* exec sql end declare section */
121#line 21 "declare.pgc"
130 {
ECPGconnect(__LINE__, 0,
"ecpg1_regression" , NULL, NULL ,
"con1", 0);
131#line 29 "declare.pgc"
134#line 29 "declare.pgc"
136 {
ECPGconnect(__LINE__, 0,
"ecpg2_regression" , NULL, NULL ,
"con2", 0);
137#line 30 "declare.pgc"
140#line 30 "declare.pgc"
143 {
ECPGdo(__LINE__, 0, 1,
"con1", 0,
ECPGst_normal,
"create table source ( f1 integer , f2 integer , f3 varchar ( 20 ) )",
ECPGt_EOIT,
ECPGt_EORT);
144#line 32 "declare.pgc"
147#line 32 "declare.pgc"
149 {
ECPGdo(__LINE__, 0, 1,
"con2", 0,
ECPGst_normal,
"create table source ( f1 integer , f2 integer , f3 varchar ( 20 ) )",
ECPGt_EOIT,
ECPGt_EORT);
150#line 33 "declare.pgc"
153#line 33 "declare.pgc"
156 {
ECPGdo(__LINE__, 0, 1,
"con1", 0,
ECPGst_normal,
"insert into source values ( 1 , 10 , 'db on con1' )",
ECPGt_EOIT,
ECPGt_EORT);
157#line 35 "declare.pgc"
160#line 35 "declare.pgc"
162 {
ECPGdo(__LINE__, 0, 1,
"con1", 0,
ECPGst_normal,
"insert into source values ( 2 , 20 , 'db on con1' )",
ECPGt_EOIT,
ECPGt_EORT);
163#line 36 "declare.pgc"
166#line 36 "declare.pgc"
169 {
ECPGdo(__LINE__, 0, 1,
"con2", 0,
ECPGst_normal,
"insert into source values ( 1 , 10 , 'db on con2' )",
ECPGt_EOIT,
ECPGt_EORT);
170#line 38 "declare.pgc"
173#line 38 "declare.pgc"
175 {
ECPGdo(__LINE__, 0, 1,
"con2", 0,
ECPGst_normal,
"insert into source values ( 2 , 20 , 'db on con2' )",
ECPGt_EOIT,
ECPGt_EORT);
176#line 39 "declare.pgc"
179#line 39 "declare.pgc"
187#line 45 "declare.pgc"
190#line 45 "declare.pgc"
193#line 46 "declare.pgc"
196#line 46 "declare.pgc"
202#line 50 "declare.pgc"
205#line 50 "declare.pgc"
212 * default connection: con2
213 * Non-default connection: con1
218 /* exec sql begin declare section */
222#line 63 "declare.pgc"
223 int i , count , length ;
225#line 64 "declare.pgc"
226 char * selectString =
"SELECT f1,f2,f3 FROM source" ;
227/* exec sql end declare section */
228#line 65 "declare.pgc"
232 * testcase1. using DECLARE STATEMENT without using AT clause,
233 * using PREPARE and CURSOR statement without using AT clause
237 /* declare \"stmt_1\" as an SQL identifier */
238#line 73 "declare.pgc"
240 {
ECPGprepare(__LINE__, NULL, 0,
"stmt_1", selectString);
241#line 74 "declare.pgc"
244#line 74 "declare.pgc"
246 /* declare cur_1 cursor for 1ドル */
247#line 75 "declare.pgc"
252#line 76 "declare.pgc"
255#line 76 "declare.pgc"
258 /* exec sql whenever not found break ; */
259#line 78 "declare.pgc"
271#line 82 "declare.pgc"
274#line 82 "declare.pgc"
277#line 82 "declare.pgc"
282#line 85 "declare.pgc"
285#line 85 "declare.pgc"
288#line 86 "declare.pgc"
291#line 86 "declare.pgc"
293 /* exec sql whenever not found continue ; */
294#line 87 "declare.pgc"
301 * testcase2. using DECLARE STATEMENT at con1,
302 * using PREPARE and CURSOR statement without using AT clause
306 /* declare \"stmt_2\" as an SQL identifier */
307#line 98 "declare.pgc"
309 {
ECPGprepare(__LINE__,
"con1", 0,
"stmt_2", selectString);
310#line 99 "declare.pgc"
313#line 99 "declare.pgc"
315 /* declare cur_2 cursor for 1ドル */
316#line 100 "declare.pgc"
321#line 101 "declare.pgc"
324#line 101 "declare.pgc"
327 /* exec sql whenever not found break ; */
328#line 103 "declare.pgc"
340#line 107 "declare.pgc"
343#line 107 "declare.pgc"
346#line 107 "declare.pgc"
351#line 110 "declare.pgc"
354#line 110 "declare.pgc"
357#line 111 "declare.pgc"
360#line 111 "declare.pgc"
362 /* exec sql whenever not found continue ; */
363#line 112 "declare.pgc"
369 * testcase3. using DECLARE STATEMENT without using AT clause,
370 * using PREPARE and EXECUTE statement without using AT clause
374 /* declare \"stmt_3\" as an SQL identifier */
375#line 122 "declare.pgc"
377 {
ECPGprepare(__LINE__, NULL, 0,
"stmt_3", selectString);
378#line 123 "declare.pgc"
381#line 123 "declare.pgc"
390#line 124 "declare.pgc"
393#line 124 "declare.pgc"
397#line 126 "declare.pgc"
400#line 126 "declare.pgc"
406 * testcase4. using DECLARE STATEMENT without using AT clause,
407 * using PREPARE and CURSOR statement at con2
411 /* declare \"stmt_4\" as an SQL identifier */
412#line 136 "declare.pgc"
414 {
ECPGprepare(__LINE__,
"con2", 0,
"stmt_4", selectString);
415#line 137 "declare.pgc"
418#line 137 "declare.pgc"
420 /* declare cur_4 cursor for 1ドル */
421#line 138 "declare.pgc"
426#line 139 "declare.pgc"
429#line 139 "declare.pgc"
432 /* exec sql whenever not found break ; */
433#line 141 "declare.pgc"
445#line 145 "declare.pgc"
448#line 145 "declare.pgc"
451#line 145 "declare.pgc"
456#line 148 "declare.pgc"
459#line 148 "declare.pgc"
462#line 149 "declare.pgc"
465#line 149 "declare.pgc"
467 /* exec sql whenever not found continue ; */
468#line 150 "declare.pgc"
474 * DESCRIBE statement is also supported.
476 /* declare \"stmt_desc\" as an SQL identifier */
477#line 157 "declare.pgc"
479 {
ECPGprepare(__LINE__,
"con1", 0,
"stmt_desc", selectString);
480#line 158 "declare.pgc"
483#line 158 "declare.pgc"
485 /* declare cur_desc cursor for 1ドル */
486#line 159 "declare.pgc"
491#line 160 "declare.pgc"
494#line 160 "declare.pgc"
497 /* descriptor can be used for describe statement */
499#line 163 "declare.pgc"
502#line 163 "declare.pgc"
507#line 164 "declare.pgc"
512#line 166 "declare.pgc"
515#line 166 "declare.pgc"
520#line 167 "declare.pgc"
523#line 167 "declare.pgc"
527#line 169 "declare.pgc"
530#line 169 "declare.pgc"
533 /* for fetch statement */
535#line 172 "declare.pgc"
538#line 172 "declare.pgc"
543#line 173 "declare.pgc"
546#line 173 "declare.pgc"
552#line 175 "declare.pgc"
555#line 175 "declare.pgc"
559#line 177 "declare.pgc"
562#line 177 "declare.pgc"
565#line 178 "declare.pgc"
568#line 178 "declare.pgc"
571#line 179 "declare.pgc"
574#line 179 "declare.pgc"
577 printf(
"****descriptor results****\n");
578 printf(
"count: %d, length: %d, data: %s\n", count, length,
f3[0]);
584#line 187 "declare.pgc"
587#line 187 "declare.pgc"
590#line 188 "declare.pgc"
593#line 188 "declare.pgc"
598 * reset all the output variables
602 memset(
f1, 0,
sizeof(
f1));
603 memset(
f2, 0,
sizeof(
f2));
604 memset(
f3, 0,
sizeof(
f3));
612 printf(
"****%s test results:****\n", tc_name);
614 for (
i = 0;
i < loop;
i++)
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)
char * ECPGprepared_statement(const char *connection_name, const char *name, int lineno)
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 sqlca_t * ECPGget_sqlca(void)
void printResult(char *tc_name, int loop)
char sqlerrmc[SQLERRMC_LEN]
struct sqlca_t::@172 sqlerrm