LCOV - differential code coverage report
Current view: top level - src/interfaces/ecpg/test/preproc - whenever_do_continue.pgc (source / functions) Coverage Total Hit CBC
Current: Differential Code Coverage HEAD vs 15 Lines: 100.0 % 24 24 24
Current Date: 2023-04-08 15:15:32 Functions: 100.0 % 1 1 1
Baseline: 15
Baseline Date: 2023-04-08 15:09:40
Legend: Lines: hit not hit

           TLA  Line data    Source code
       1                 : #include <stdlib.h>
       2                 : 
       3                 : exec sql include ../regression;
       4                 : 
       5                 : exec sql whenever sqlerror stop;
       6                 : 
       7 CBC           1 : int main(void)
       8                 : {
       9                 :     exec sql begin declare section;
      10                 :     struct
      11                 :     {
      12                 :         char ename[12];
      13                 :         float sal;
      14                 :         float comm;
      15                 :     } emp;
      16                 :     int loopcount;
      17                 :     char msg[128];
      18                 :     exec sql end declare section;
      19                 : 
      20               1 :     ECPGdebug(1, stderr);
      21                 : 
      22               1 :     strcpy(msg, "connect");
      23               1 :     exec sql connect to REGRESSDB1;
      24               1 : 
      25               1 :     strcpy(msg, "create");
      26               1 :     exec sql  create table emp(ename varchar,sal double precision, comm double precision);
      27               1 : 
      28               1 :     strcpy(msg, "insert");
      29               1 :     exec sql insert into emp values ('Ram',111100,21);
      30               1 :     exec sql insert into emp values ('aryan',11110,null);
      31               1 :     exec sql insert into emp values ('josh',10000,10);
      32               1 :     exec sql insert into emp values ('tom',20000,null);
      33               1 : 
      34                 :     exec sql declare c cursor for select ename, sal, comm from emp order by ename collate "C" asc;
      35                 : 
      36               1 :     exec sql open c;
      37               1 : 
      38                 :     /* The 'BREAK' condition to exit the loop. */
      39                 :     exec sql whenever not found do break;
      40                 : 
      41                 :     /* The DO CONTINUE makes the loop start at the next iteration when an error occurs.*/
      42                 :     exec sql whenever sqlerror do continue;
      43                 : 
      44               5 :     for (loopcount = 0; loopcount < 100; loopcount++)
      45                 :     {
      46               5 :         exec sql fetch c into :emp;
      47               5 :         /* The employees with non-NULL commissions will be displayed. */
      48               2 :         printf("%s %7.2f %9.2f\n", emp.ename, emp.sal, emp.comm);
      49                 :     }
      50                 : 
      51                 :     /*
      52                 :      * This 'CONTINUE' shuts off the 'DO CONTINUE' and allow the program to
      53                 :      * proceed if any further errors do occur.
      54                 :      */
      55                 :     exec sql whenever sqlerror continue;
      56                 : 
      57               1 :     exec sql close c;
      58                 : 
      59               1 :     strcpy(msg, "drop");
      60               1 :     exec sql drop table emp;
      61                 : 
      62               1 :     exit(0);
      63                 : }
        

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