You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix possible omission of variable storage markers in ECPG.
The ECPG preprocessor converted code such as
static varchar str1[10], str2[20], str3[30];
into
static struct varchar_1 { int len; char arr[ 10 ]; } str1 ;
struct varchar_2 { int len; char arr[ 20 ]; } str2 ;
struct varchar_3 { int len; char arr[ 30 ]; } str3 ;
thus losing the storage attribute for the later variables.
Repeat the declaration for each such variable.
(Note that this occurred only for variables declared "varchar"
or "bytea", which may help explain how it escaped detection
for so long.)
Andrey Sokolov
Discussion: https://postgr.es/m/[email protected]
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer )", ECPGt_EOIT, ECPGt_EORT);
146
-
#line50 "variable.pgc"
154
+
#line52 "variable.pgc"
147
155
148
156
if (sqlca.sqlcode<0) exit (1);}
149
-
#line50 "variable.pgc"
157
+
#line52 "variable.pgc"
150
158
151
159
152
160
strcpy(msg, "insert");
153
161
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 )", ECPGt_EOIT, ECPGt_EORT);
154
-
#line53 "variable.pgc"
162
+
#line55 "variable.pgc"
155
163
156
164
if (sqlca.sqlcode<0) exit (1);}
157
-
#line53 "variable.pgc"
165
+
#line55 "variable.pgc"
158
166
159
167
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 )", ECPGt_EOIT, ECPGt_EORT);
160
-
#line54 "variable.pgc"
168
+
#line56 "variable.pgc"
161
169
162
170
if (sqlca.sqlcode<0) exit (1);}
163
-
#line54 "variable.pgc"
171
+
#line56 "variable.pgc"
164
172
165
173
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 1' , 16 )", ECPGt_EOIT, ECPGt_EORT);
166
-
#line55 "variable.pgc"
174
+
#line57 "variable.pgc"
167
175
168
176
if (sqlca.sqlcode<0) exit (1);}
169
-
#line55 "variable.pgc"
177
+
#line57 "variable.pgc"
170
178
171
179
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 2' , 14 )", ECPGt_EOIT, ECPGt_EORT);
172
-
#line56 "variable.pgc"
180
+
#line58 "variable.pgc"
173
181
174
182
if (sqlca.sqlcode<0) exit (1);}
175
-
#line56 "variable.pgc"
183
+
#line58 "variable.pgc"
176
184
177
185
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 3' , 9 )", ECPGt_EOIT, ECPGt_EORT);
178
-
#line57 "variable.pgc"
186
+
#line59 "variable.pgc"
179
187
180
188
if (sqlca.sqlcode<0) exit (1);}
181
-
#line57 "variable.pgc"
189
+
#line59 "variable.pgc"
182
190
183
191
184
192
strcpy(msg, "commit");
185
193
{ ECPGtrans(__LINE__, NULL, "commit");
186
-
#line60 "variable.pgc"
194
+
#line62 "variable.pgc"
187
195
188
196
if (sqlca.sqlcode<0) exit (1);}
189
-
#line60 "variable.pgc"
197
+
#line62 "variable.pgc"
190
198
191
199
192
200
strcpy(msg, "open");
193
201
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur cursor for select name , born , age , married , children from family", ECPGt_EOIT, ECPGt_EORT);
194
-
#line63 "variable.pgc"
202
+
#line65 "variable.pgc"
195
203
196
204
if (sqlca.sqlcode<0) exit (1);}
197
-
#line63 "variable.pgc"
205
+
#line65 "variable.pgc"
198
206
199
207
200
208
/* exec sql whenever not found break ; */
201
-
#line65 "variable.pgc"
209
+
#line67 "variable.pgc"
202
210
203
211
204
212
p=&personal;
@@ -217,13 +225,13 @@ if (sqlca.sqlcode < 0) exit (1);}
0 commit comments