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

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : #include <stdlib.h>
                                  2                 :                : 
                                  3                 :                : exec sql include ../regression;
                                  4                 :                : 
                                  5                 :                : exec sql whenever sqlerror sqlprint;
                                  6                 :                : 
 2357 peter_e@gmx.net             7                 :CBC           1 : static void print(const char *msg)
                                  8                 :                : {
 6428 meskes@postgresql.or        9                 :              1 :         fprintf(stderr, "Error in statement '%s':\n", msg);
                                 10                 :              1 :         sqlprint();
                                 11                 :              1 : }
                                 12                 :                : 
                                 13                 :              1 : static void print2(void)
                                 14                 :                : {
                                 15                 :              1 :         fprintf(stderr, "Found another error\n");
                                 16                 :              1 :         sqlprint();
                                 17                 :              1 : }
                                 18                 :                : 
                                 19                 :              1 : static void warn(void)
                                 20                 :                : {
                                 21                 :              1 :         fprintf(stderr, "Warning: At least one column was truncated\n");
                                 22                 :              1 : }
                                 23                 :                : 
                                 24                 :              1 : int main(void)
                                 25                 :                : {
                                 26                 :                :     exec sql int i;
                                 27                 :                :     exec sql char c[6];
                                 28                 :                : 
                                 29                 :              1 :     ECPGdebug(1, stderr);
                                 30                 :                : 
                                 31                 :              1 :     exec sql connect to REGRESSDB1;
                                 32         [ -  + ]:              1 :     exec sql create table test(i int, c char(10));
                                 33         [ -  + ]:              1 :     exec sql insert into test values(1, 'abcdefghij');
                                 34         [ -  + ]:              1 : 
                                 35                 :                :     exec sql whenever sqlwarning do warn();
                                 36                 :              1 :     exec sql select * into :i, :c from test;
                                 37   [ +  -  -  + ]:              1 :     exec sql rollback;
                                 38   [ -  +  -  + ]:              1 : 
 1772 noah@leadboat.com          39                 :              1 :     exec sql select * into :i from nonexistent;
 6428 meskes@postgresql.or       40   [ -  +  +  - ]:              1 :     exec sql rollback;
                                 41   [ -  +  -  + ]:              1 : 
                                 42                 :                :     exec sql whenever sqlerror do print("select");
 1772 noah@leadboat.com          43                 :              1 :     exec sql select * into :i from nonexistent;
 6428 meskes@postgresql.or       44   [ -  +  +  - ]:              1 :     exec sql rollback;
                                 45   [ -  +  -  + ]:              1 : 
                                 46                 :                :     exec sql whenever sqlerror call print2();
 1772 noah@leadboat.com          47                 :              1 :     exec sql select * into :i from nonexistent;
 6428 meskes@postgresql.or       48   [ -  +  +  - ]:              1 :     exec sql rollback;
                                 49   [ -  +  -  + ]:              1 : 
                                 50                 :                :     exec sql whenever sqlerror continue;
 1772 noah@leadboat.com          51                 :              1 :     exec sql select * into :i from nonexistent;
 6428 meskes@postgresql.or       52         [ -  + ]:              1 :     exec sql rollback;
                                 53         [ -  + ]:              1 : 
                                 54                 :                :     exec sql whenever sqlerror goto error;
 1772 noah@leadboat.com          55                 :              1 :     exec sql select * into :i from nonexistent;
 6428 meskes@postgresql.or       56   [ -  +  +  - ]:              1 :     printf("Should not be reachable\n");
                                 57                 :                : 
                                 58                 :              1 :     error:
                                 59                 :              1 :     exec sql rollback;
                                 60   [ -  +  -  + ]:              1 : 
                                 61                 :                :     exec sql whenever sqlerror stop;
                                 62                 :                :     /* This cannot fail, thus we don't get an exit value not equal 0. */
                                 63                 :                :     /* However, it still test the precompiler output. */
 5808                            64                 :              1 :     exec sql select 1 into :i;
 6428                            65   [ -  +  -  + ]:              1 :     exec sql rollback;
                                 66   [ -  +  -  + ]:              1 :     exit (0);
                                 67                 :                : }
        

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