1 /* Processed by ecpg (regression mode) */
2 /* These include files are added by the preprocessor */
3 #include <ecpglib.h>
4 #include <ecpgerrno.h>
5 #include <sqlca.h>
6 /* End of automatic include section */
7 #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
8 
9 #line 1 "copystdout.pgc"
10 #include <stdio.h>
11 
12 
13 #line 1 "sqlca.h"
14 #ifndef POSTGRES_SQLCA_H
15 #define POSTGRES_SQLCA_H
16 
17 #ifndef PGDLLIMPORT
18 #if  defined(WIN32) || defined(__CYGWIN__)
19 #define PGDLLIMPORT __declspec (dllimport)
20 #else
21 #define PGDLLIMPORT
22 #endif							/* __CYGWIN__ */
23 #endif							/* PGDLLIMPORT */
24 
25 #define SQLERRMC_LEN	150
26 
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31 
32 struct sqlca_t
33 {
34 	char		sqlcaid[8];
35 	long		sqlabc;
36 	long		sqlcode;
37 	struct
38 	{
39 		int			sqlerrml;
40 		char		sqlerrmc[SQLERRMC_LEN];
41 	}			sqlerrm;
42 	char		sqlerrp[8];
43 	long		sqlerrd[6];
44 	/* Element 0: empty						*/
45 	/* 1: OID of processed tuple if applicable			*/
46 	/* 2: number of rows processed				*/
47 	/* after an INSERT, UPDATE or				*/
48 	/* DELETE statement					*/
49 	/* 3: empty						*/
50 	/* 4: empty						*/
51 	/* 5: empty						*/
52 	char		sqlwarn[8];
53 	/* Element 0: set to 'W' if at least one other is 'W'	*/
54 	/* 1: if 'W' at least one character string		*/
55 	/* value was truncated when it was			*/
56 	/* stored into a host variable.             */
57 
58 	/*
59 	 * 2: if 'W' a (hopefully) non-fatal notice occurred
60 	 */	/* 3: empty */
61 	/* 4: empty						*/
62 	/* 5: empty						*/
63 	/* 6: empty						*/
64 	/* 7: empty						*/
65 
66 	char		sqlstate[5];
67 };
68 
69 struct sqlca_t *ECPGget_sqlca(void);
70 
71 #ifndef POSTGRES_ECPG_INTERNAL
72 #define sqlca (*ECPGget_sqlca())
73 #endif
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #endif
80 
81 #line 3 "copystdout.pgc"
82 
83 
84 #line 1 "regression.h"
85 
86 
87 
88 
89 
90 
91 #line 4 "copystdout.pgc"
92 
93 
94 /* exec sql whenever sqlerror  sqlprint ; */
95 #line 6 "copystdout.pgc"
96 
97 
98 int
main()99 main ()
100 {
101   ECPGdebug (1, stderr);
102 
103   { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
104 #line 13 "copystdout.pgc"
105 
106 if (sqlca.sqlcode < 0) sqlprint();}
107 #line 13 "copystdout.pgc"
108 
109   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table foo ( a int , b varchar )", ECPGt_EOIT, ECPGt_EORT);
110 #line 14 "copystdout.pgc"
111 
112 if (sqlca.sqlcode < 0) sqlprint();}
113 #line 14 "copystdout.pgc"
114 
115   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into foo values ( 5 , 'abc' )", ECPGt_EOIT, ECPGt_EORT);
116 #line 15 "copystdout.pgc"
117 
118 if (sqlca.sqlcode < 0) sqlprint();}
119 #line 15 "copystdout.pgc"
120 
121   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into foo values ( 6 , 'def' )", ECPGt_EOIT, ECPGt_EORT);
122 #line 16 "copystdout.pgc"
123 
124 if (sqlca.sqlcode < 0) sqlprint();}
125 #line 16 "copystdout.pgc"
126 
127   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into foo values ( 7 , 'ghi' )", ECPGt_EOIT, ECPGt_EORT);
128 #line 17 "copystdout.pgc"
129 
130 if (sqlca.sqlcode < 0) sqlprint();}
131 #line 17 "copystdout.pgc"
132 
133 
134   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "copy foo to stdout with delimiter ','", ECPGt_EOIT, ECPGt_EORT);
135 #line 19 "copystdout.pgc"
136 
137 if (sqlca.sqlcode < 0) sqlprint();}
138 #line 19 "copystdout.pgc"
139 
140   printf ("copy to STDOUT : sqlca.sqlcode = %ld\n", sqlca.sqlcode);
141 
142   { ECPGdisconnect(__LINE__, "CURRENT");
143 #line 22 "copystdout.pgc"
144 
145 if (sqlca.sqlcode < 0) sqlprint();}
146 #line 22 "copystdout.pgc"
147 
148 
149   return 0;
150 }
151