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

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : EXEC SQL INCLUDE ../regression;
                                  2                 :                : EXEC SQL WHENEVER SQLERROR SQLPRINT;
                                  3                 :                : 
                                  4                 :                : int
 6465 meskes@postgresql.or        5                 :CBC           1 : main(void)
                                  6                 :                : {
                                  7                 :                :     EXEC SQL BEGIN DECLARE SECTION;
 6088                             8                 :              1 :     char *stmt1 = "INSERT INTO test1 VALUES ($1, $2)";
                                  9                 :              1 :     char *stmt2 = "SELECT * from test1 where a = $1 and b = $2";
                                 10                 :              1 :     char *stmt3 = "SELECT * from test1 where :var = a";
                                 11                 :                : 
 6465                            12                 :              1 :     int val1 = 1;
 6444                            13                 :              1 :     char val2[4] = "one", val2output[] = "AAA";
 6465                            14                 :              1 :     int val1output = 2, val2i = 0;
                                 15                 :              1 :     int val2null = -1;
                                 16                 :                :     int ind1, ind2;
 3748                            17                 :              1 :     char desc1[8] = "outdesc";
                                 18                 :                :     EXEC SQL END DECLARE SECTION;
                                 19                 :                : 
 6465                            20                 :              1 :     ECPGdebug(1, stderr);
                                 21                 :                : 
                                 22                 :              1 :     EXEC SQL ALLOCATE DESCRIPTOR indesc;
 3748                            23         [ -  + ]:              1 :     EXEC SQL ALLOCATE DESCRIPTOR :desc1;
 6465                            24         [ -  + ]:              1 : 
                                 25                 :              1 :     EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = :val1;
                                 26         [ -  + ]:              1 :     EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2i, DATA = :val2;
                                 27         [ -  + ]:              1 : 
                                 28                 :              1 :     EXEC SQL CONNECT TO REGRESSDB1;
                                 29         [ -  + ]:              1 : 
                                 30                 :              1 :     EXEC SQL CREATE TABLE test1 (a int, b text);
                                 31         [ -  + ]:              1 :     EXEC SQL PREPARE foo1 FROM :stmt1;
 6088                            32         [ -  + ]:              1 :     EXEC SQL PREPARE "Foo-1" FROM :stmt1;
 6465                            33         [ -  + ]:              1 :     EXEC SQL PREPARE foo2 FROM :stmt2;
                                 34         [ -  + ]:              1 :     EXEC SQL PREPARE foo3 FROM :stmt3;
                                 35         [ -  + ]:              1 : 
 5213                            36                 :              1 :     EXEC SQL EXECUTE foo1 USING SQL DESCRIPTOR indesc;
 6465                            37         [ -  + ]:              1 : 
                                 38                 :              1 :     EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 2;
                                 39         [ -  + ]:              1 :     EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2null, DATA = :val2;
                                 40         [ -  + ]:              1 : 
 5213                            41                 :              1 :     EXEC SQL EXECUTE foo1 USING SQL DESCRIPTOR indesc;
 6465                            42         [ -  + ]:              1 : 
 6444                            43                 :              1 :     EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 3;
                                 44         [ -  + ]:              1 :     EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val1, DATA = 'this is a long test';
                                 45         [ -  + ]:              1 : 
 5213                            46                 :              1 :     EXEC SQL EXECUTE "Foo-1" USING SQL DESCRIPTOR indesc;
 6088                            47         [ -  + ]:              1 : 
                                 48                 :              1 :     EXEC SQL DEALLOCATE "Foo-1";
 6444                            49         [ -  + ]:              1 : 
 6465                            50                 :              1 :     EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = :val1;
                                 51         [ -  + ]:              1 :     EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2i, DATA = :val2;
                                 52         [ -  + ]:              1 : 
 3744                            53                 :              1 :     EXEC SQL EXECUTE foo2 USING SQL DESCRIPTOR indesc INTO SQL DESCRIPTOR :desc1;
 6465                            54         [ -  + ]:              1 : 
 3744                            55                 :              1 :     EXEC SQL GET DESCRIPTOR :desc1 VALUE 1 :val2output = DATA;
 6465                            56         [ -  + ]:              1 :     printf("output = %s\n", val2output);
                                 57                 :                : 
                                 58                 :                :     EXEC SQL DECLARE c1 CURSOR FOR foo2;
 5213                            59                 :              1 :     EXEC SQL OPEN c1 USING SQL DESCRIPTOR indesc;
 6465                            60         [ -  + ]:              1 : 
 6464                            61                 :              1 :     EXEC SQL FETCH next FROM c1 INTO :val1output:ind1, :val2output:ind2;
                                 62         [ -  + ]:              1 :     printf("val1=%d (ind1: %d) val2=%s (ind2: %d)\n",
                                 63                 :                :         val1output, ind1, val2output, ind2);
                                 64                 :                : 
 6465                            65                 :              1 :     EXEC SQL CLOSE c1;
                                 66         [ -  + ]:              1 : 
                                 67                 :              1 :     EXEC SQL SET DESCRIPTOR indesc COUNT = 1;
                                 68         [ -  + ]:              1 :     EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 2;
                                 69         [ -  + ]:              1 : 
                                 70                 :                :     EXEC SQL DECLARE c2 CURSOR FOR foo3;
 5213                            71                 :              1 :     EXEC SQL OPEN c2 USING SQL DESCRIPTOR indesc;
 6465                            72         [ -  + ]:              1 : 
                                 73                 :              1 :     EXEC SQL FETCH next FROM c2 INTO :val1output, :val2output :val2i;
                                 74   [ -  +  -  + ]:              1 :     printf("val1=%d val2=%s\n", val1output, val2i ? "null" : val2output);
                                 75                 :                : 
                                 76                 :              1 :     EXEC SQL CLOSE c2;
                                 77         [ -  + ]:              1 : 
 6444                            78                 :              1 :     EXEC SQL SELECT * INTO :val1output, :val2output:val2i FROM test1 where a = 3;
                                 79         [ -  + ]:              1 :     printf("val1=%d val2=%c%c%c%c warn=%c truncate=%d\n", val1output, val2output[0], val2output[1], val2output[2], val2output[3], sqlca.sqlwarn[0], val2i);
                                 80                 :                : 
 6465                            81                 :              1 :     EXEC SQL DROP TABLE test1;
 6088                            82         [ -  + ]:              1 :     EXEC SQL DEALLOCATE ALL;
 6465                            83         [ -  + ]:              1 :     EXEC SQL DISCONNECT;
                                 84         [ -  + ]:              1 : 
                                 85                 :              1 :     EXEC SQL DEALLOCATE DESCRIPTOR indesc;
 3744                            86         [ -  + ]:              1 :     EXEC SQL DEALLOCATE DESCRIPTOR :desc1;
 6465                            87         [ -  + ]:              1 : 
                                 88                 :              1 :     return 0;
                                 89                 :                : }
        

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