LCOV - differential code coverage report
Current view: top level - src/interfaces/ecpg/test/sql - binary.pgc (source / functions) Coverage Total Hit UBC CBC
Current: Differential Code Coverage 16@8cea358b128 vs 17@8cea358b128 Lines: 100.0 % 38 38 38
Current Date: 2024-04-14 14:21:10 Functions: 100.0 % 1 1 1
Baseline: 16@8cea358b128 Branches: 55.0 % 40 22 18 22
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 % 38 38 38
Function coverage date bins:
(240..) days: 100.0 % 1 1 1
Branch coverage date bins:
(240..) days: 55.0 % 40 22 18 22

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : #include <stdio.h>
                                  2                 :                : #include <stdlib.h>
                                  3                 :                : 
                                  4                 :                : EXEC SQL include ../regression;
                                  5                 :                : 
                                  6                 :                : EXEC SQL BEGIN DECLARE SECTION;
                                  7                 :                : struct TBempl
                                  8                 :                : {
                                  9                 :                :   long idnum;
                                 10                 :                :   char name[21];
                                 11                 :                :   short accs;
                                 12                 :                :   char byte[20];
                                 13                 :                : };
                                 14                 :                : EXEC SQL END DECLARE SECTION;
                                 15                 :                : 
                                 16                 :                : EXEC SQL WHENEVER SQLERROR STOP;
                                 17                 :                : 
                                 18                 :                : int
 6465 meskes@postgresql.or       19                 :CBC           1 : main (void)
                                 20                 :                : {
                                 21                 :                :   EXEC SQL BEGIN DECLARE SECTION;
                                 22                 :                :   struct TBempl empl;
 5550                            23                 :              1 :   char *pointer = NULL;
 6465                            24                 :              1 :   char *data = "\\001\\155\\000\\212";
                                 25                 :                :   EXEC SQL END DECLARE SECTION;
                                 26                 :                :   int i;
                                 27                 :                : 
                                 28                 :              1 :   ECPGdebug (1, stderr);
                                 29                 :                : 
                                 30                 :              1 :   empl.idnum = 1;
                                 31                 :              1 :   EXEC SQL connect to REGRESSDB1;
 5367 tgl@sss.pgh.pa.us          32         [ -  + ]:              1 :   EXEC SQL set bytea_output = escape;
 6465 meskes@postgresql.or       33         [ -  + ]:              1 :   EXEC SQL create table empl
                                 34                 :                :     (idnum integer, name char (20), accs smallint, byte bytea);
 6431                            35         [ -  + ]:              1 :   EXEC SQL insert into empl values (1, 'first user', 320, :data);
 6465                            36         [ -  + ]:              1 :   EXEC SQL DECLARE C CURSOR FOR select name, accs, byte from empl where idnum =:empl.idnum;
                                 37         [ -  + ]:              1 :   EXEC SQL OPEN C;
                                 38         [ -  + ]:              1 :   EXEC SQL FETCH C INTO:empl.name,:empl.accs,:empl.byte;
                                 39         [ -  + ]:              1 :   printf ("name=%s, accs=%d byte=%s\n", empl.name, empl.accs, empl.byte);
                                 40                 :                : 
 3792                            41                 :              1 :   EXEC SQL CLOSE C;
                                 42         [ -  + ]:              1 : 
 5550                            43                 :              1 :   memset(empl.name, 0, 21L);
 6465                            44                 :              1 :   EXEC SQL DECLARE B BINARY CURSOR FOR select name, accs, byte from empl where idnum =:empl.idnum;
                                 45         [ -  + ]:              1 :   EXEC SQL OPEN B;
 6431                            46         [ -  + ]:              1 :   EXEC SQL FETCH B INTO :empl.name,:empl.accs,:empl.byte;
 6465                            47         [ -  + ]:              1 :   EXEC SQL CLOSE B;
                                 48         [ -  + ]:              1 : 
                                 49                 :                :   /* do not print a.accs because big/little endian will have different outputs here */
 6463                            50                 :              1 :   printf ("name=%s, byte=", empl.name);
 5550                            51         [ +  + ]:              5 :   for (i=0; i<4; i++)
 6465                            52                 :              4 :     printf("(%o)", (unsigned char)empl.byte[i]);
                                 53                 :              1 :   printf("\n");
                                 54                 :                : 
 5550                            55                 :              1 :   EXEC SQL DECLARE A BINARY CURSOR FOR select byte from empl where idnum =:empl.idnum;
                                 56         [ -  + ]:              1 :   EXEC SQL OPEN A;
                                 57         [ -  + ]:              1 :   EXEC SQL FETCH A INTO :pointer;
                                 58         [ -  + ]:              1 :   EXEC SQL CLOSE A;
                                 59         [ -  + ]:              1 : 
 1901                            60         [ +  - ]:              1 :   if (pointer) {
                                 61                 :              1 :     printf ("pointer=");
                                 62         [ +  + ]:              5 :     for (i=0; i<4; i++)
                                 63                 :              4 :         printf("(%o)", (unsigned char)pointer[i]);
                                 64                 :              1 :     printf("\n");
                                 65                 :              1 :     free(pointer);
                                 66                 :                :   }
                                 67                 :                : 
 6465                            68                 :              1 :   EXEC SQL disconnect;
                                 69         [ -  + ]:              1 :   exit (0);
                                 70                 :                : }
        

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