Skip to content

Commit 803d9c3

Browse files
author
Michael Meskes
committed
Changing a test case also changes the output that is expected.
Float/Long aliasing doesn't work on all architecures.
1 parent 1d1868d commit 803d9c3

File tree

5 files changed

+151
-157
lines changed

5 files changed

+151
-157
lines changed

src/interfaces/ecpg/test/complex/test2.pgc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ exec sql begin declare section;
3232
exec sql end declare section;
3333

3434
exec sql char *married = NULL;
35-
exec sql float ind_married;
35+
exec sql long ind_married;
3636
exec sql ind children;
3737

38-
exec sql var ind_married is long;
39-
4038
char msg[128];
4139

4240
ECPGdebug(1, stderr);
@@ -73,7 +71,7 @@ exec sql end declare section;
7371
printf(", born %ld", personal.birth.born);
7472
if (i->ind_birth.age >= 0)
7573
printf(", age = %d", personal.birth.age);
76-
if ((long)ind_married >= 0)
74+
if (ind_married >= 0)
7775
printf(", married %s", married);
7876
if (ind_children.smallint >= 0)
7977
printf(", children = %d", children.integer);
@@ -103,7 +101,7 @@ exec sql end declare section;
103101
printf(", born %ld", personal.birth.born);
104102
if (ind_personal.ind_birth.age >= 0)
105103
printf(", age = %d", personal.birth.age);
106-
if ((long)ind_married >= 0)
104+
if (ind_married >= 0)
107105
printf(", married %s", married);
108106
if (ind_children.smallint >= 0)
109107
printf(", children = %d", children.integer);

src/interfaces/ecpg/test/expected/complex-test2.c

Lines changed: 67 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ main (void)
148148

149149

150150
#line 35 "test2.pgc"
151-
float ind_married ;
151+
long ind_married ;
152152

153153
#line 35 "test2.pgc"
154154

@@ -159,107 +159,103 @@ main (void)
159159
#line 36 "test2.pgc"
160160

161161

162-
/* exec sql var ind_married is long */
163-
#line 38 "test2.pgc"
164-
165-
166162
char msg[128];
167163

168164
ECPGdebug(1, stderr);
169165

170166
strcpy(msg, "connect");
171167
{ ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
172-
#line 45 "test2.pgc"
168+
#line 43 "test2.pgc"
173169

174170
if (sqlca.sqlwarn[0] == 'W') warn ( );
175-
#line 45 "test2.pgc"
171+
#line 43 "test2.pgc"
176172

177173
if (sqlca.sqlcode < 0) Finish ( msg );}
178-
#line 45 "test2.pgc"
174+
#line 43 "test2.pgc"
179175

180176

181177
strcpy(msg, "create");
182178
{ ECPGdo(__LINE__, 0, 1, NULL, "create table meskes ( name char ( 8 ) , born integer , age smallint , married date , children integer ) ", ECPGt_EOIT, ECPGt_EORT);
183-
#line 48 "test2.pgc"
179+
#line 46 "test2.pgc"
184180

185181
if (sqlca.sqlwarn[0] == 'W') warn ( );
186-
#line 48 "test2.pgc"
182+
#line 46 "test2.pgc"
187183

188184
if (sqlca.sqlcode < 0) Finish ( msg );}
189-
#line 48 "test2.pgc"
185+
#line 46 "test2.pgc"
190186

191187

192188
strcpy(msg, "insert");
193-
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , married , children ) values( 'Petra' , '19900404' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
194-
#line 51 "test2.pgc"
189+
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , married , children ) values ( 'Petra' , '19900404' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
190+
#line 49 "test2.pgc"
195191

196192
if (sqlca.sqlwarn[0] == 'W') warn ( );
197-
#line 51 "test2.pgc"
193+
#line 49 "test2.pgc"
198194

199195
if (sqlca.sqlcode < 0) Finish ( msg );}
200-
#line 51 "test2.pgc"
196+
#line 49 "test2.pgc"
201197

202-
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age , married , children ) values( 'Michael' , 19660117 , 35 , '19900404' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
203-
#line 52 "test2.pgc"
198+
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age , married , children ) values ( 'Michael' , 19660117 , 35 , '19900404' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
199+
#line 50 "test2.pgc"
204200

205201
if (sqlca.sqlwarn[0] == 'W') warn ( );
206-
#line 52 "test2.pgc"
202+
#line 50 "test2.pgc"
207203

208204
if (sqlca.sqlcode < 0) Finish ( msg );}
209-
#line 52 "test2.pgc"
205+
#line 50 "test2.pgc"
210206

211-
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values( 'Carsten' , 19910103 , 10 ) ", ECPGt_EOIT, ECPGt_EORT);
212-
#line 53 "test2.pgc"
207+
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values ( 'Carsten' , 19910103 , 10 ) ", ECPGt_EOIT, ECPGt_EORT);
208+
#line 51 "test2.pgc"
213209

214210
if (sqlca.sqlwarn[0] == 'W') warn ( );
215-
#line 53 "test2.pgc"
211+
#line 51 "test2.pgc"
216212

217213
if (sqlca.sqlcode < 0) Finish ( msg );}
218-
#line 53 "test2.pgc"
214+
#line 51 "test2.pgc"
219215

220-
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values( 'Marc' , 19930907 , 8 ) ", ECPGt_EOIT, ECPGt_EORT);
221-
#line 54 "test2.pgc"
216+
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values ( 'Marc' , 19930907 , 8 ) ", ECPGt_EOIT, ECPGt_EORT);
217+
#line 52 "test2.pgc"
222218

223219
if (sqlca.sqlwarn[0] == 'W') warn ( );
224-
#line 54 "test2.pgc"
220+
#line 52 "test2.pgc"
225221

226222
if (sqlca.sqlcode < 0) Finish ( msg );}
227-
#line 54 "test2.pgc"
223+
#line 52 "test2.pgc"
228224

229-
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values( 'Chris' , 19970923 , 4 ) ", ECPGt_EOIT, ECPGt_EORT);
230-
#line 55 "test2.pgc"
225+
{ ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values ( 'Chris' , 19970923 , 4 ) ", ECPGt_EOIT, ECPGt_EORT);
226+
#line 53 "test2.pgc"
231227

232228
if (sqlca.sqlwarn[0] == 'W') warn ( );
233-
#line 55 "test2.pgc"
229+
#line 53 "test2.pgc"
234230

235231
if (sqlca.sqlcode < 0) Finish ( msg );}
236-
#line 55 "test2.pgc"
232+
#line 53 "test2.pgc"
237233

238234

239235
strcpy(msg, "commit");
240236
{ ECPGtrans(__LINE__, NULL, "commit");
241-
#line 58 "test2.pgc"
237+
#line 56 "test2.pgc"
242238

243239
if (sqlca.sqlwarn[0] == 'W') warn ( );
244-
#line 58 "test2.pgc"
240+
#line 56 "test2.pgc"
245241

246242
if (sqlca.sqlcode < 0) Finish ( msg );}
247-
#line 58 "test2.pgc"
243+
#line 56 "test2.pgc"
248244

249245

250246
strcpy(msg, "open");
251247
{ ECPGdo(__LINE__, 0, 1, NULL, "declare cur cursor for select name , born , age , married , children from meskes ", ECPGt_EOIT, ECPGt_EORT);
252-
#line 61 "test2.pgc"
248+
#line 59 "test2.pgc"
253249

254250
if (sqlca.sqlwarn[0] == 'W') warn ( );
255-
#line 61 "test2.pgc"
251+
#line 59 "test2.pgc"
256252

257253
if (sqlca.sqlcode < 0) Finish ( msg );}
258-
#line 61 "test2.pgc"
254+
#line 59 "test2.pgc"
259255

260256

261257
/* exec sql whenever not found break ; */
262-
#line 63 "test2.pgc"
258+
#line 61 "test2.pgc"
263259

264260

265261
p=&personal;
@@ -278,23 +274,23 @@ if (sqlca.sqlcode < 0) Finish ( msg );}
278274
ECPGt_long,&(ind_married),(long)1,(long)1,sizeof(long),
279275
ECPGt_int,&(children.integer),(long)1,(long)1,sizeof(int),
280276
ECPGt_short,&(ind_children.smallint),(long)1,(long)1,sizeof(short), ECPGt_EORT);
281-
#line 70 "test2.pgc"
277+
#line 68 "test2.pgc"
282278

283279
if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
284-
#line 70 "test2.pgc"
280+
#line 68 "test2.pgc"
285281

286282
if (sqlca.sqlwarn[0] == 'W') warn ( );
287-
#line 70 "test2.pgc"
283+
#line 68 "test2.pgc"
288284

289285
if (sqlca.sqlcode < 0) Finish ( msg );}
290-
#line 70 "test2.pgc"
286+
#line 68 "test2.pgc"
291287

292288
printf("%8.8s", personal.name.arr);
293289
if (i->ind_birth.born >= 0)
294290
printf(", born %ld", personal.birth.born);
295291
if (i->ind_birth.age >= 0)
296292
printf(", age = %d", personal.birth.age);
297-
if ((long)ind_married >= 0)
293+
if (ind_married >= 0)
298294
printf(", married %s", married);
299295
if (ind_children.smallint >= 0)
300296
printf(", children = %d", children.integer);
@@ -306,27 +302,27 @@ if (sqlca.sqlcode < 0) Finish ( msg );}
306302

307303
strcpy(msg, "close");
308304
{ ECPGdo(__LINE__, 0, 1, NULL, "close cur", ECPGt_EOIT, ECPGt_EORT);
309-
#line 87 "test2.pgc"
305+
#line 85 "test2.pgc"
310306

311307
if (sqlca.sqlwarn[0] == 'W') warn ( );
312-
#line 87 "test2.pgc"
308+
#line 85 "test2.pgc"
313309

314310
if (sqlca.sqlcode < 0) Finish ( msg );}
315-
#line 87 "test2.pgc"
311+
#line 85 "test2.pgc"
316312

317313

318314
/* and now a same query with prepare */
319315
{ ECPGprepare(__LINE__, "MM" , query);
320-
#line 90 "test2.pgc"
316+
#line 88 "test2.pgc"
321317

322318
if (sqlca.sqlwarn[0] == 'W') warn ( );
323-
#line 90 "test2.pgc"
319+
#line 88 "test2.pgc"
324320

325321
if (sqlca.sqlcode < 0) Finish ( msg );}
326-
#line 90 "test2.pgc"
322+
#line 88 "test2.pgc"
327323

328324
/* declare prep cursor for ? */
329-
#line 91 "test2.pgc"
325+
#line 89 "test2.pgc"
330326

331327

332328
strcpy(msg, "open");
@@ -335,17 +331,17 @@ if (sqlca.sqlcode < 0) Finish ( msg );}
335331
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
336332
ECPGt_const,"'Petra'",(long)7,(long)1,strlen("'Petra'"),
337333
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
338-
#line 94 "test2.pgc"
334+
#line 92 "test2.pgc"
339335

340336
if (sqlca.sqlwarn[0] == 'W') warn ( );
341-
#line 94 "test2.pgc"
337+
#line 92 "test2.pgc"
342338

343339
if (sqlca.sqlcode < 0) Finish ( msg );}
344-
#line 94 "test2.pgc"
340+
#line 92 "test2.pgc"
345341

346342

347343
/* exec sql whenever not found break ; */
348-
#line 96 "test2.pgc"
344+
#line 94 "test2.pgc"
349345

350346

351347
while (1) {
@@ -361,23 +357,23 @@ if (sqlca.sqlcode < 0) Finish ( msg );}
361357
ECPGt_long,&(ind_married),(long)1,(long)1,sizeof(long),
362358
ECPGt_int,&(children.integer),(long)1,(long)1,sizeof(int),
363359
ECPGt_short,&(ind_children.smallint),(long)1,(long)1,sizeof(short), ECPGt_EORT);
364-
#line 100 "test2.pgc"
360+
#line 98 "test2.pgc"
365361

366362
if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
367-
#line 100 "test2.pgc"
363+
#line 98 "test2.pgc"
368364

369365
if (sqlca.sqlwarn[0] == 'W') warn ( );
370-
#line 100 "test2.pgc"
366+
#line 98 "test2.pgc"
371367

372368
if (sqlca.sqlcode < 0) Finish ( msg );}
373-
#line 100 "test2.pgc"
369+
#line 98 "test2.pgc"
374370

375371
printf("%8.8s", personal.name.arr);
376372
if (ind_personal.ind_birth.born >= 0)
377373
printf(", born %ld", personal.birth.born);
378374
if (ind_personal.ind_birth.age >= 0)
379375
printf(", age = %d", personal.birth.age);
380-
if ((long)ind_married >= 0)
376+
if (ind_married >= 0)
381377
printf(", married %s", married);
382378
if (ind_children.smallint >= 0)
383379
printf(", children = %d", children.integer);
@@ -388,46 +384,46 @@ if (sqlca.sqlcode < 0) Finish ( msg );}
388384

389385
strcpy(msg, "close");
390386
{ ECPGdo(__LINE__, 0, 1, NULL, "close prep", ECPGt_EOIT, ECPGt_EORT);
391-
#line 116 "test2.pgc"
387+
#line 114 "test2.pgc"
392388

393389
if (sqlca.sqlwarn[0] == 'W') warn ( );
394-
#line 116 "test2.pgc"
390+
#line 114 "test2.pgc"
395391

396392
if (sqlca.sqlcode < 0) Finish ( msg );}
397-
#line 116 "test2.pgc"
393+
#line 114 "test2.pgc"
398394

399395

400396
strcpy(msg, "drop");
401397
{ ECPGdo(__LINE__, 0, 1, NULL, "drop table meskes ", ECPGt_EOIT, ECPGt_EORT);
402-
#line 119 "test2.pgc"
398+
#line 117 "test2.pgc"
403399

404400
if (sqlca.sqlwarn[0] == 'W') warn ( );
405-
#line 119 "test2.pgc"
401+
#line 117 "test2.pgc"
406402

407403
if (sqlca.sqlcode < 0) Finish ( msg );}
408-
#line 119 "test2.pgc"
404+
#line 117 "test2.pgc"
409405

410406

411407
strcpy(msg, "commit");
412408
{ ECPGtrans(__LINE__, NULL, "commit");
413-
#line 122 "test2.pgc"
409+
#line 120 "test2.pgc"
414410

415411
if (sqlca.sqlwarn[0] == 'W') warn ( );
416-
#line 122 "test2.pgc"
412+
#line 120 "test2.pgc"
417413

418414
if (sqlca.sqlcode < 0) Finish ( msg );}
419-
#line 122 "test2.pgc"
415+
#line 120 "test2.pgc"
420416

421417

422418
strcpy(msg, "disconnect");
423419
{ ECPGdisconnect(__LINE__, "CURRENT");
424-
#line 125 "test2.pgc"
420+
#line 123 "test2.pgc"
425421

426422
if (sqlca.sqlwarn[0] == 'W') warn ( );
427-
#line 125 "test2.pgc"
423+
#line 123 "test2.pgc"
428424

429425
if (sqlca.sqlcode < 0) Finish ( msg );}
430-
#line 125 "test2.pgc"
426+
#line 123 "test2.pgc"
431427

432428

433429
return (0);

0 commit comments

Comments
 (0)