LCOV - differential code coverage report
Current view: top level - src/interfaces/ecpg/test/sql - binary.pgc (source / functions) Coverage Total Hit CBC
Current: Differential Code Coverage HEAD vs 15 Lines: 100.0 % 38 38 38
Current Date: 2023-04-08 17:13:01 Functions: 100.0 % 1 1 1
Baseline: 15 Line coverage date bins:
Baseline Date: 2023-04-08 15:09:40 (240..) days: 100.0 % 38 38 38
Legend: Lines: hit not hit Function coverage date bins:
(240..) days: 100.0 % 1 1 1

 Age         Owner                  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
 6094 meskes                     19 CBC           1 : main (void)
                                 20                 : {
                                 21                 :   EXEC SQL BEGIN DECLARE SECTION;
                                 22                 :   struct TBempl empl;
 5179                            23               1 :   char *pointer = NULL;
 6094                            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;
 4996 tgl                        32               1 :   EXEC SQL set bytea_output = escape;
 6094 meskes                     33               1 :   EXEC SQL create table empl
                                 34                 :     (idnum integer, name char (20), accs smallint, byte bytea);
 6060                            35               1 :   EXEC SQL insert into empl values (1, 'first user', 320, :data);
 6094                            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                 : 
 3421                            41               1 :   EXEC SQL CLOSE C;
                                 42               1 : 
 5179                            43               1 :   memset(empl.name, 0, 21L);
 6094                            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;
 6060                            46               1 :   EXEC SQL FETCH B INTO :empl.name,:empl.accs,:empl.byte;
 6094                            47               1 :   EXEC SQL CLOSE B;
                                 48               1 : 
                                 49                 :   /* do not print a.accs because big/little endian will have different outputs here */
 6092                            50               1 :   printf ("name=%s, byte=", empl.name);
 5179                            51               5 :   for (i=0; i<4; i++)
 6094                            52               4 :     printf("(%o)", (unsigned char)empl.byte[i]);
                                 53               1 :   printf("\n");
                                 54                 : 
 5179                            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 : 
 1530                            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                 : 
 6094                            68               1 :   EXEC SQL disconnect;
                                 69               1 :   exit (0);
                                 70                 : }
        

Generated by: LCOV version v1.16-55-g56c0a2a