LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/test/compat_informix - rnull.pgc (source / functions) Coverage Total Hit
Test: PostgreSQL 20devel Lines: 100.0 % 65 65
Test Date: 2026-07-25 22:15:46 Functions: 100.0 % 2 2
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 50.0 % 24 12

             Branch data     Line data    Source code
       1                 :             : #include "sqltypes.h"
       2                 :             : #include <stdlib.h>
       3                 :             : 
       4                 :             : $include ../regression;
       5                 :             : $define NUMBER 12;
       6                 :             : 
       7                 :             : static void
       8                 :          40 : test_null(int type, char *ptr)
       9                 :             : {
      10                 :          40 :     printf("null: %d\n", risnull(type, ptr));
      11                 :          40 : }
      12                 :             : 
      13                 :           2 : int main(void)
      14                 :             : {
      15                 :           2 :     $char c[] = "abc";
      16                 :           2 :     $short s = 17;
      17                 :           2 :     $int i = -74874;
      18                 :           2 :     $bool b = 1;
      19                 :           2 :     $float f = (float) 3.71;
      20                 :           2 :     $long l = 487444;
      21                 :           2 :     $double dbl = 404.404;
      22                 :             :     $decimal dec;
      23                 :             :     $date dat;
      24                 :             :     $timestamp tmp;
      25                 :             : 
      26                 :           2 :     ECPGdebug(1, stderr);
      27                 :             :     $whenever sqlerror do sqlprint();
      28                 :             : 
      29                 :           2 :     $connect to REGRESSDB1;
      30         [ -  + ]:           2 : 
      31                 :           2 :     $create table test(id int, c char(10), s smallint, i int, b bool,
      32                 :             :                        f float, l bigint, dbl double precision,
      33                 :             :                        dec decimal, dat date, tmp timestamptz);
      34         [ -  + ]:           2 :     $commit;
      35         [ -  + ]:           2 : 
      36                 :           2 :     $insert into test (id, c, s, i, b, f, l, dbl) values (
      37                 :             :         1, :c, :s, :i, :b, :f, :l, :dbl
      38                 :             :     );
      39         [ -  + ]:           2 :     $commit;
      40         [ -  + ]:           2 : 
      41                 :           2 :     rsetnull(CCHARTYPE, (char *) c);
      42                 :           2 :     rsetnull(CSHORTTYPE, (char *) &s);
      43                 :           2 :     rsetnull(CINTTYPE, (char *) &i);
      44                 :           2 :     rsetnull(CBOOLTYPE, (char *) &b);
      45                 :           2 :     rsetnull(CFLOATTYPE, (char *) &f);
      46                 :           2 :     rsetnull(CLONGTYPE, (char *) &l);
      47                 :           2 :     rsetnull(CDOUBLETYPE, (char *) &dbl);
      48                 :           2 :     rsetnull(CDECIMALTYPE, (char *) &dec);
      49                 :           2 :     rsetnull(CDATETYPE, (char *) &dat);
      50                 :           2 :     rsetnull(CDTIMETYPE, (char *) &tmp);
      51                 :             : 
      52                 :           2 :     $insert into test (id, c, s, i, b, f, l, dbl, dec, dat, tmp) values (
      53                 :             :         2, :c, :s, :i, :b, :f, :l, :dbl, :dec, :dat, :tmp
      54                 :             :     );
      55         [ -  + ]:           2 :     $commit;
      56         [ -  + ]:           2 : 
      57                 :           2 :     printf("first select\n");
      58                 :             : 
      59                 :           2 :     $select c, s, i, b, f, l, dbl, dec, dat, tmp
      60                 :             :         into :c, :s, :i, :b, :f, :l, :dbl, :dec, :dat, :tmp
      61                 :             :         from test where id = 1;
      62         [ -  + ]:           2 : 
      63                 :           2 :     test_null(CCHARTYPE, (char *) c);
      64                 :           2 :     test_null(CSHORTTYPE, (char *) &s);
      65                 :           2 :     test_null(CINTTYPE, (char *) &i);
      66                 :           2 :     test_null(CBOOLTYPE, (char *) &b);
      67                 :           2 :     test_null(CFLOATTYPE, (char *) &f);
      68                 :           2 :     test_null(CLONGTYPE, (char *) &l);
      69                 :           2 :     test_null(CDOUBLETYPE, (char *) &dbl);
      70                 :           2 :     test_null(CDECIMALTYPE, (char *) &dec);
      71                 :           2 :     test_null(CDATETYPE, (char *) &dat);
      72                 :           2 :     test_null(CDTIMETYPE, (char *) &tmp);
      73                 :             : 
      74                 :           2 :     printf("second select\n");
      75                 :             : 
      76                 :           2 :     $select c, s, i, b, f, l, dbl, dec, dat, tmp
      77                 :             :         into :c, :s, :i, :b, :f, :l, :dbl, :dec, :dat, :tmp
      78                 :             :         from test where id = 2;
      79         [ -  + ]:           2 : 
      80                 :           2 :     test_null(CCHARTYPE, (char *) c);
      81                 :           2 :     test_null(CSHORTTYPE, (char *) &s);
      82                 :           2 :     test_null(CINTTYPE, (char *) &i);
      83                 :           2 :     test_null(CBOOLTYPE, (char *) &b);
      84                 :           2 :     test_null(CFLOATTYPE, (char *) &f);
      85                 :           2 :     test_null(CLONGTYPE, (char *) &l);
      86                 :           2 :     test_null(CDOUBLETYPE, (char *) &dbl);
      87                 :           2 :     test_null(CDECIMALTYPE, (char *) &dec);
      88                 :           2 :     test_null(CDATETYPE, (char *) &dat);
      89                 :           2 :     test_null(CDTIMETYPE, (char *) &tmp);
      90                 :             : 
      91                 :           2 :     $drop table test;
      92         [ -  + ]:           2 :     $commit;
      93         [ -  + ]:           2 : 
      94                 :           2 :     $close database;
      95         [ -  + ]:           2 : 
      96                 :           2 :     return 0;
      97                 :             : }
        

Generated by: LCOV version 2.0-1