LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/test/sql - code100.pgc (source / functions) Hit Total Coverage
Test: PostgreSQL 18devel Lines: 26 26 100.0 %
Date: 2024-11-21 08:14:44 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : exec sql include sqlca;
       2             : #include <stdio.h>
       3             : 
       4             : exec sql include ../regression;
       5             : 
       6             : 
       7           4 : int main()
       8             : {  exec sql begin declare section;
       9             :    int index;
      10             :    exec sql end declare section;
      11             : 
      12             : 
      13           4 :    ECPGdebug(1,stderr);
      14             : 
      15           4 :    exec sql connect to REGRESSDB1;
      16           4 :    if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
      17             : 
      18           4 :    exec sql create table test (
      19             :         "index" numeric(3) primary key,
      20             :         "payload" int4 NOT NULL);
      21           4 :    if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
      22           4 :    exec sql commit work;
      23           4 :    if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
      24             : 
      25          44 :    for (index=0;index<10;++index)
      26          40 :    {  exec sql insert into test
      27             :                 (payload, index)
      28             :                 values (0, :index);
      29          40 :       if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
      30             :    }
      31           4 :    exec sql commit work;
      32           4 :    if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
      33             : 
      34           4 :    exec sql update test
      35             :     set payload=payload+1 where index=-1;
      36           4 :    if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
      37             : 
      38           4 :    exec sql delete from test where index=-1;
      39           4 :    if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
      40             : 
      41           4 :    exec sql insert into test (select * from test where index=-1);
      42           4 :    if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
      43             : 
      44           4 :    exec sql drop table test;
      45           4 :    if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
      46           4 :    exec sql commit work;
      47           4 :    if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
      48             : 
      49           4 :    exec sql disconnect;
      50           4 :    if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
      51           4 :    return 0;
      52             : }

Generated by: LCOV version 1.14