32{
33
34
35
36
37
38
39
40#line 14 "oldexec.pgc"
41 int amount [ 8 ] ;
42
43#line 15 "oldexec.pgc"
44 int increment = 100 ;
45
46#line 16 "oldexec.pgc"
47 char name [ 8 ] [ 8 ] ;
48
49#line 17 "oldexec.pgc"
50 char letter [ 8 ] [ 1 ] ;
51
52#line 18 "oldexec.pgc"
53 char command [ 128 ] ;
54
55#line 19 "oldexec.pgc"
56
58
60
61 {
ECPGconnect(__LINE__, 0,
"ecpg1_regression" , NULL, NULL ,
"main", 0);
62#line 24 "oldexec.pgc"
63
65#line 24 "oldexec.pgc"
66
67
68 {
ECPGdo(__LINE__, 0, 1, NULL, 1,
ECPGst_normal,
"create table test ( name char ( 8 ) , amount int , letter char ( 1 ) )",
ECPGt_EOIT,
ECPGt_EORT);
69#line 26 "oldexec.pgc"
70
72#line 26 "oldexec.pgc"
73
75#line 27 "oldexec.pgc"
76
78#line 27 "oldexec.pgc"
79
80
81 sprintf(command,
"insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f')");
83#line 30 "oldexec.pgc"
84
86#line 30 "oldexec.pgc"
87
88
89 sprintf(command,
"insert into test (name, amount, letter) values ('db: ''r1''', 2, 't')");
91#line 33 "oldexec.pgc"
92
94#line 33 "oldexec.pgc"
95
96
97 sprintf(command,
"insert into test (name, amount, letter) select name, amount+10, letter from test");
99#line 36 "oldexec.pgc"
100
102#line 36 "oldexec.pgc"
103
104
105 printf(
"Inserted %ld tuples via execute immediate\n",
sqlca.sqlerrd[2]);
106
107 sprintf(command,
"insert into test (name, amount, letter) select name, amount+$1, letter from test");
109#line 41 "oldexec.pgc"
110
112#line 41 "oldexec.pgc"
113
115 ECPGt_int,&(increment),(
long)1,(
long)1,
sizeof(
int),
117#line 42 "oldexec.pgc"
118
120#line 42 "oldexec.pgc"
121
122
123 printf(
"Inserted %ld tuples via prepared execute\n",
sqlca.sqlerrd[2]);
124
126#line 46 "oldexec.pgc"
127
129#line 46 "oldexec.pgc"
130
131
132 sprintf (command,
"select * from test");
133
135#line 50 "oldexec.pgc"
136
138#line 50 "oldexec.pgc"
139
140
141#line 51 "oldexec.pgc"
142
143
147#line 53 "oldexec.pgc"
148
150#line 53 "oldexec.pgc"
151
155 ECPGt_int,(amount),(
long)1,(
long)8,
sizeof(
int),
157 ECPGt_char,(letter),(
long)1,(
long)8,(1)*
sizeof(
char),
159#line 54 "oldexec.pgc"
160
162#line 54 "oldexec.pgc"
163
164
166 {
167 char n[8], l = letter[
i][0];
169
170 strncpy(n,
name[
i], 8);
171 printf(
"name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n",
i, n,
i,
a,
i, l);
172 }
173
175#line 65 "oldexec.pgc"
176
178#line 65 "oldexec.pgc"
179
180
181 sprintf (command,
"select * from test where ? = amount");
182
184#line 69 "oldexec.pgc"
185
187#line 69 "oldexec.pgc"
188
189
190#line 70 "oldexec.pgc"
191
192
198#line 72 "oldexec.pgc"
199
201#line 72 "oldexec.pgc"
202
206 ECPGt_int,(amount),(
long)1,(
long)8,
sizeof(
int),
208 ECPGt_char,(letter),(
long)1,(
long)8,(1)*
sizeof(
char),
210#line 73 "oldexec.pgc"
211
213#line 73 "oldexec.pgc"
214
215
217 {
218 char n[8], l = letter[
i][0];
220
221 strncpy(n,
name[
i], 8);
222 printf(
"name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n",
i, n,
i,
a,
i, l);
223 }
224
226#line 84 "oldexec.pgc"
227
229#line 84 "oldexec.pgc"
230
232#line 85 "oldexec.pgc"
233
235#line 85 "oldexec.pgc"
236
238#line 86 "oldexec.pgc"
239
241#line 86 "oldexec.pgc"
242
244#line 87 "oldexec.pgc"
245
247#line 87 "oldexec.pgc"
248
249
250 return 0;
251}
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 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)