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))
15 #line 1 "regression.h"
26 /* exec sql begin declare section */
35 /* exec sql end declare section */
40 { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
44 { ECPGsetcommit(__LINE__, "on", NULL);}
47 /* exec sql whenever sql_warning sqlprint ; */
50 /* exec sql whenever sqlerror sqlprint ; */
54 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table \"My_Table\" ( Item1 int , Item2 text )", ECPGt_EOIT, ECPGt_EORT);
57 if (sqlca.sqlwarn[0] == 'W') sqlprint();
60 if (sqlca.sqlcode < 0) sqlprint();}
64 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show standard_conforming_strings", ECPGt_EOIT,
65 ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
66 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
69 if (sqlca.sqlwarn[0] == 'W') sqlprint();
72 if (sqlca.sqlcode < 0) sqlprint();}
75 printf("Standard conforming strings: %s\n", var);
77 /* this is a\\b actually */
78 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into \"My_Table\" values ( 1 , 'a\\\\\\\\b' )", ECPGt_EOIT, ECPGt_EORT);
81 if (sqlca.sqlwarn[0] == 'W') sqlprint();
84 if (sqlca.sqlcode < 0) sqlprint();}
88 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into \"My_Table\" values ( 1 , E'a\\\\\\\\b' )", ECPGt_EOIT, ECPGt_EORT);
91 if (sqlca.sqlwarn[0] == 'W') sqlprint();
94 if (sqlca.sqlcode < 0) sqlprint();}
98 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set standard_conforming_strings to on", ECPGt_EOIT, ECPGt_EORT);
101 if (sqlca.sqlwarn[0] == 'W') sqlprint();
104 if (sqlca.sqlcode < 0) sqlprint();}
108 /* this is a\\\\b actually */
109 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into \"My_Table\" values ( 2 , 'a\\\\\\\\b' )", ECPGt_EOIT, ECPGt_EORT);
112 if (sqlca.sqlwarn[0] == 'W') sqlprint();
115 if (sqlca.sqlcode < 0) sqlprint();}
119 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into \"My_Table\" values ( 2 , E'a\\\\\\\\b' )", ECPGt_EOIT, ECPGt_EORT);
122 if (sqlca.sqlwarn[0] == 'W') sqlprint();
125 if (sqlca.sqlcode < 0) sqlprint();}
129 { ECPGtrans(__LINE__, NULL, "begin");
132 if (sqlca.sqlwarn[0] == 'W') sqlprint();
135 if (sqlca.sqlcode < 0) sqlprint();}
138 /* declare C cursor for select * from \"My_Table\" */
142 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare C cursor for select * from \"My_Table\"", ECPGt_EOIT, ECPGt_EORT);
145 if (sqlca.sqlwarn[0] == 'W') sqlprint();
148 if (sqlca.sqlcode < 0) sqlprint();}
152 /* exec sql whenever not found break ; */
158 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch C", ECPGt_EOIT,
159 ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
160 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
161 ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
162 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
165 if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
168 if (sqlca.sqlwarn[0] == 'W') sqlprint();
171 if (sqlca.sqlcode < 0) sqlprint();}
174 printf("value: %d %s\n", i, var);
177 { ECPGtrans(__LINE__, NULL, "rollback");
180 if (sqlca.sqlwarn[0] == 'W') sqlprint();
183 if (sqlca.sqlcode < 0) sqlprint();}
186 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table \"My_Table\"", ECPGt_EOIT, ECPGt_EORT);
189 if (sqlca.sqlwarn[0] == 'W') sqlprint();
192 if (sqlca.sqlcode < 0) sqlprint();}
196 { ECPGdisconnect(__LINE__, "ALL");
199 if (sqlca.sqlwarn[0] == 'W') sqlprint();
202 if (sqlca.sqlcode < 0) sqlprint();}