@@ -402,13 +402,12 @@ void ppoutputconnect(struct cb_exec_list *list) {
402
402
return ;
403
403
}
404
404
405
- void _ppoutputparam ( char * varface , int type , int digits , int scale ,
406
- int iteration ) {
405
+ static void _ppoutputparamheader ( const char * mod , int type , int digits ,
406
+ int scale ) {
407
407
char buff [256 ];
408
408
409
409
memset (buff , 0 , sizeof (buff ));
410
- com_sprintf (buff , sizeof (buff ),
411
- "OCESQL%5sCALL \"OCESQLSetSQLParams\" USING\n" , " " );
410
+ com_sprintf (buff , sizeof (buff ), "OCESQL%5sCALL \"%s\" USING\n" , " " , mod );
412
411
fputs (buff , outfile );
413
412
414
413
memset (buff , 0 , sizeof (buff ));
@@ -422,6 +421,59 @@ void _ppoutputparam(char *varface, int type, int digits, int scale,
422
421
memset (buff , 0 , sizeof (buff ));
423
422
com_sprintf (buff , sizeof (buff ), "OCESQL%10sBY VALUE %d\n" , " " , scale );
424
423
fputs (buff , outfile );
424
+ }
425
+
426
+ static void _ppoutputparamfooter () {
427
+ char buff [256 ];
428
+ memset (buff , 0 , sizeof (buff ));
429
+
430
+ com_sprintf (buff , sizeof (buff ), "OCESQL%5sEND-CALL\n" , " " );
431
+ fputs (buff , outfile );
432
+ }
433
+
434
+ void __ppoutputparambyfield (const char * mod , struct cb_field * field , int type ,
435
+ int digits , int scale , int iteration ) {
436
+
437
+ char buff [256 ];
438
+
439
+ _ppoutputparamheader (mod , type , digits , scale );
440
+
441
+ memset (buff , 0 , sizeof (buff ));
442
+ com_sprintf (buff , sizeof (buff ), "OCESQL%10sBY REFERENCE %s" , " " ,
443
+ field -> sname );
444
+ fputs (buff , outfile );
445
+ struct cb_field * f = field -> parent ;
446
+
447
+ while (f ) {
448
+ memset (buff , 0 , sizeof (buff ));
449
+ com_sprintf (buff , sizeof (buff ), "\nOCESQL%10s OF %s" , " " ,
450
+ f -> sname );
451
+ fputs (buff , outfile );
452
+ if (f -> parent ) {
453
+ memset (buff , 0 , sizeof (buff ));
454
+ com_sprintf (buff , sizeof (buff ), "\n" );
455
+ fputs (buff , outfile );
456
+ }
457
+ f = f -> parent ;
458
+ }
459
+
460
+ memset (buff , 0 , sizeof (buff ));
461
+ if (iteration > 0 ) {
462
+ com_sprintf (buff , sizeof (buff ), "(1)\n" , " " );
463
+ } else {
464
+ com_sprintf (buff , sizeof (buff ), "\n" );
465
+ }
466
+ fputs (buff , outfile );
467
+
468
+ _ppoutputparamfooter (type , digits , scale );
469
+ }
470
+
471
+ void __ppoutputparam (const char * mod , char * varface , int type , int digits ,
472
+ int scale , int iteration ) {
473
+ char buff [256 ];
474
+
475
+ _ppoutputparamheader (mod , type , digits , scale );
476
+
425
477
memset (buff , 0 , sizeof (buff ));
426
478
if (iteration > 0 ) {
427
479
com_sprintf (buff , sizeof (buff ), "OCESQL%10sBY REFERENCE %s(1)\n" , " " ,
@@ -432,11 +484,18 @@ void _ppoutputparam(char *varface, int type, int digits, int scale,
432
484
}
433
485
fputs (buff , outfile );
434
486
435
- memset (buff , 0 , sizeof (buff ));
487
+ _ppoutputparamfooter ();
488
+ }
436
489
437
- com_sprintf (buff , sizeof (buff ), "OCESQL%5sEND-CALL\n" , " " );
438
- fputs (buff , outfile );
439
- return ;
490
+ void _ppoutputparambyfield (struct cb_field * field , int type , int digits ,
491
+ int scale , int iteration ) {
492
+ __ppoutputparambyfield ("OCESQLSetSQLParams" , field , type , digits , scale ,
493
+ iteration );
494
+ }
495
+ void _ppoutputparam (char * varface , int type , int digits , int scale ,
496
+ int iteration ) {
497
+ __ppoutputparam ("OCESQLSetSQLParams" , varface , type , digits , scale ,
498
+ iteration );
440
499
}
441
500
442
501
int ppoutputparam (struct cb_hostreference_list * host_list , int iteration ) {
@@ -477,7 +536,7 @@ int ppoutputparam(struct cb_hostreference_list *host_list, int iteration) {
477
536
printerrormsg (f -> sname , host_list -> lineno , buff );
478
537
return count ;
479
538
}
480
- _ppoutputparam ( f -> sname , type , digits , scale , iteration );
539
+ _ppoutputparambyfield ( f , type , digits , scale , iteration );
481
540
count ++ ;
482
541
f = f -> sister ;
483
542
}
@@ -489,41 +548,16 @@ int ppoutputparam(struct cb_hostreference_list *host_list, int iteration) {
489
548
return count ;
490
549
}
491
550
551
+ void ppoutputresparambyfield (struct cb_field * field , int type , int digits ,
552
+ int scale , int iteration ) {
553
+ __ppoutputparambyfield ("OCESQLSetResultParams" , field , type , digits , scale ,
554
+ iteration );
555
+ }
556
+
492
557
void ppoutputresparam (char * varface , int type , int digits , int scale ,
493
558
int iteration ) {
494
- char buff [256 ];
495
-
496
- memset (buff , 0 , sizeof (buff ));
497
- com_sprintf (buff , sizeof (buff ),
498
- "OCESQL%5sCALL \"OCESQLSetResultParams\" USING\n" , " " );
499
- fputs (buff , outfile );
500
-
501
- memset (buff , 0 , sizeof (buff ));
502
- com_sprintf (buff , sizeof (buff ), "OCESQL%10sBY VALUE %d\n" , " " , type );
503
- fputs (buff , outfile );
504
-
505
- memset (buff , 0 , sizeof (buff ));
506
- com_sprintf (buff , sizeof (buff ), "OCESQL%10sBY VALUE %d\n" , " " , digits );
507
- fputs (buff , outfile );
508
-
509
- memset (buff , 0 , sizeof (buff ));
510
- com_sprintf (buff , sizeof (buff ), "OCESQL%10sBY VALUE %d\n" , " " , scale );
511
- fputs (buff , outfile );
512
- memset (buff , 0 , sizeof (buff ));
513
- if (iteration > 0 ) {
514
- com_sprintf (buff , sizeof (buff ), "OCESQL%10sBY REFERENCE %s(1)\n" , " " ,
515
- varface );
516
- } else {
517
- com_sprintf (buff , sizeof (buff ), "OCESQL%10sBY REFERENCE %s\n" , " " ,
518
- varface );
519
- }
520
- fputs (buff , outfile );
521
-
522
- memset (buff , 0 , sizeof (buff ));
523
-
524
- com_sprintf (buff , sizeof (buff ), "OCESQL%5sEND-CALL\n" , " " );
525
- fputs (buff , outfile );
526
- return ;
559
+ __ppoutputparam ("OCESQLSetResultParams" , varface , type , digits , scale ,
560
+ iteration );
527
561
}
528
562
529
563
void ppoutputresgroup (struct cb_field * cf , int lineno , int iteration ) {
0 commit comments