LCOV - differential code coverage report
Current view: top level - src/interfaces/ecpg/test/preproc - variable.pgc (source / functions) Coverage Total Hit UBC CBC
Current: Differential Code Coverage 16@8cea358b128 vs 17@8cea358b128 Lines: 100.0 % 59 59 59
Current Date: 2024-04-14 14:21:10 Functions: 100.0 % 1 1 1
Baseline: 16@8cea358b128 Branches: 61.9 % 42 26 16 26
Baseline Date: 2024-04-14 14:21:09 Line coverage date bins:
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed (240..) days: 100.0 % 59 59 59
Function coverage date bins:
(240..) days: 100.0 % 1 1 1
Branch coverage date bins:
(240..) days: 61.9 % 42 26 16 26

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : #include <stdlib.h>
                                  2                 :                : #include <string.h>
                                  3                 :                : 
                                  4                 :                : exec sql include ../regression;
                                  5                 :                : 
                                  6                 :                : exec sql whenever sqlerror stop;
                                  7                 :                : 
                                  8                 :                : exec sql type c is char reference;
                                  9                 :                : typedef char* c;
                                 10                 :                : 
                                 11                 :                : exec sql type ind is union { int integer; short smallint; };
                                 12                 :                : typedef union { int integer; short smallint; } ind;
                                 13                 :                : 
                                 14                 :                : #define BUFFERSIZ 8
                                 15                 :                : exec sql type str is varchar[BUFFERSIZ];
                                 16                 :                : 
                                 17                 :                : exec sql declare cur cursor for
                                 18                 :                :        select name, born, age, married, children from family;
                                 19                 :                : 
                                 20                 :                : int
 6428 meskes@postgresql.or       21                 :CBC           1 : main (void)
                                 22                 :                : {
                                 23                 :                :     exec sql struct birthinfo { long born; short age; };
                                 24                 :                : exec sql begin declare section;
                                 25                 :                :     struct personal_struct  {   str name;
                                 26                 :                :                     struct birthinfo birth;
                                 27                 :                :                 } personal, *p;
                                 28                 :                :     struct personal_indicator { int ind_name;
                                 29                 :                :                     struct birthinfo ind_birth;
                                 30                 :                :                   } ind_personal, *i;
                                 31                 :                :     ind ind_children;
                                 32                 :                :     struct t1 { str name; }; struct t2 { str name; };
                                 33                 :                :     static varchar vc1[50], vc2[50], vc3[255];
                                 34                 :                :     static int i1, i2, i3;
                                 35                 :                : exec sql end declare section;
                                 36                 :                : 
                                 37                 :              1 :     exec sql char *married = NULL;
                                 38                 :                :     exec sql long ind_married;
                                 39                 :                :     exec sql ind children;
                                 40                 :                :     int loopcount;
                                 41                 :                :     char msg[128];
                                 42                 :                : 
                                 43                 :              1 :         ECPGdebug(1, stderr);
                                 44                 :                : 
                                 45                 :              1 :     strcpy(msg, "connect");
                                 46                 :              1 :     exec sql connect to REGRESSDB1;
                                 47         [ -  + ]:              1 : 
 6410                            48                 :              1 :     strcpy(msg, "set");
                                 49                 :              1 :     exec sql set datestyle to iso;
                                 50         [ -  + ]:              1 : 
 6428                            51                 :              1 :     strcpy(msg, "create");
                                 52                 :              1 :     exec sql create table family(name char(8), born integer, age smallint, married date, children integer);
                                 53         [ -  + ]:              1 : 
                                 54                 :              1 :     strcpy(msg, "insert");
                                 55                 :              1 :     exec sql insert into family(name, married, children) values ('Mum', '19870714', 3);
                                 56         [ -  + ]:              1 :     exec sql insert into family(name, born, married, children) values ('Dad', '19610721', '19870714', 3);
                                 57         [ -  + ]:              1 :     exec sql insert into family(name, age) values ('Child 1', 16);
                                 58         [ -  + ]:              1 :     exec sql insert into family(name, age) values ('Child 2', 14);
                                 59         [ -  + ]:              1 :     exec sql insert into family(name, age) values ('Child 3', 9);
                                 60         [ -  + ]:              1 : 
                                 61                 :              1 :     strcpy(msg, "commit");
                                 62                 :              1 :     exec sql commit;
                                 63         [ -  + ]:              1 : 
                                 64                 :              1 :     strcpy(msg, "open");
                                 65                 :              1 :     exec sql open cur;
                                 66         [ -  + ]:              1 : 
                                 67                 :                :     exec sql whenever not found do break;
                                 68                 :                : 
                                 69                 :              1 :     p=&personal;
                                 70                 :              1 :     i=&ind_personal;
                                 71                 :              1 :     memset(i, 0, sizeof(ind_personal));
 1907 tgl@sss.pgh.pa.us          72         [ +  - ]:              6 :     for (loopcount = 0; loopcount < 100; loopcount++) {
 6428 meskes@postgresql.or       73                 :              6 :         strcpy(msg, "fetch");
                                 74                 :              6 :         exec sql fetch cur into :p:i, :married:ind_married, :children.integer:ind_children.smallint;
                                 75   [ +  +  -  + ]:              6 :         printf("%8.8s", personal.name.arr);
                                 76         [ +  + ]:              5 :         if (i->ind_birth.born >= 0)
                                 77                 :              1 :             printf(", born %ld", personal.birth.born);
                                 78         [ +  + ]:              5 :         if (i->ind_birth.age >= 0)
                                 79                 :              3 :             printf(", age = %d", personal.birth.age);
                                 80         [ +  + ]:              5 :         if (ind_married >= 0)
                                 81                 :              2 :             printf(", married %s", married);
                                 82         [ +  + ]:              5 :         if (ind_children.smallint >= 0)
                                 83                 :              2 :             printf(", children = %d", children.integer);
                                 84                 :              5 :         putchar('\n');
                                 85                 :                : 
                                 86                 :              5 :         free(married);
                                 87                 :              5 :         married = NULL;
                                 88                 :                :     }
                                 89                 :                : 
                                 90                 :              1 :     strcpy(msg, "close");
                                 91                 :              1 :     exec sql close cur;
                                 92         [ -  + ]:              1 : 
                                 93                 :              1 :     strcpy(msg, "drop");
                                 94                 :              1 :     exec sql drop table family;
                                 95         [ -  + ]:              1 : 
                                 96                 :              1 :     strcpy(msg, "commit");
                                 97                 :              1 :     exec sql commit;
                                 98         [ -  + ]:              1 : 
 4891 peter_e@gmx.net            99                 :              1 :     strcpy(msg, "disconnect");
 6428 meskes@postgresql.or      100                 :              1 :     exec sql disconnect;
                                101         [ -  + ]:              1 : 
                                102                 :                :     /* this just to silence unused-variable warnings: */
  583 tgl@sss.pgh.pa.us         103                 :              1 :     vc1.len = vc2.len = vc3.len = 0;
                                104                 :              1 :     i1 = i2 = i3 = 0;
                                105                 :              1 :     printf("%d %d %d %d %d %d\n",
                                106                 :                :            vc1.len, vc2.len, vc3.len,
                                107                 :                :            i1, i2, i3);
                                108                 :                : 
 2432 peter_e@gmx.net           109                 :              1 :     return 0;
                                110                 :                : }
        

Generated by: LCOV version 2.1-beta2-3-g6141622