LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/test/compat_informix - test_informix.pgc (source / functions) Coverage Total Hit
Test: Code coverage Lines: 0.0 % 66 0
Test Date: 2026-01-26 10:56:24 Functions: 0.0 % 3 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : #include "sqltypes.h"
       2              : #include <stdlib.h>
       3              : 
       4              : $include ../regression;
       5              : $define NUMBER 12;
       6              : 
       7              : static void openit(void);
       8            0 : static void dosqlprint(void) {
       9            0 :         printf("doSQLprint: Error: %s\n", sqlca.sqlerrm.sqlerrmc);
      10            0 : }
      11              : 
      12            0 : int main(void)
      13              : {
      14            0 :         $int i = 14, loopcount;
      15            0 :         $decimal j, m, n;
      16            0 :         $string c[10];
      17              : 
      18            0 :         ECPGdebug(1, stderr);
      19              :         $whenever sqlerror do dosqlprint();
      20              : 
      21            0 :         $connect to REGRESSDB1;
      22            0 :         if (sqlca.sqlcode != 0) exit(1);
      23              : 
      24            0 :         $create table test(i int primary key, j int, c text);
      25            0 : 
      26              :         /* this INSERT works */
      27            0 :         rsetnull(CDECIMALTYPE, (char *)&j);
      28            0 :         $insert into test (i, j, c) values (7, :j, 'test   ');
      29            0 :         $commit;
      30            0 : 
      31              :         /* this INSERT should fail because i is a unique column */
      32            0 :         $insert into test (i, j, c) values (7, NUMBER, 'a');
      33            0 :         printf("INSERT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
      34            0 :         if (sqlca.sqlcode != 0) $rollback;
      35            0 : 
      36            0 :         $insert into test (i, j, c) values (:i, 1, 'a      ');
      37            0 :         $commit;
      38            0 : 
      39              :         /* this will fail (more than one row in subquery) */
      40            0 :         $select i from test where j=(select j from test);
      41            0 :         $rollback;
      42            0 : 
      43              :         /* this however should be ok */
      44            0 :         $select i from test where j=(select j from test order by i limit 1);
      45            0 :         printf("SELECT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
      46            0 :         if (sqlca.sqlcode != 0) $rollback;
      47            0 : 
      48            0 :         sqlca.sqlcode = 100;
      49            0 :         $declare c cursor for select * from test where i <= :i;
      50            0 :         printf ("%ld\n", sqlca.sqlcode);
      51            0 :         openit();
      52              : 
      53            0 :         deccvint(0, &j);
      54              : 
      55            0 :         for (loopcount = 0; loopcount < 100; loopcount++)
      56              :         {
      57            0 :                 $fetch forward c into :i, :j, :c;
      58            0 :                 if (sqlca.sqlcode == 100) break;
      59              : 
      60            0 :                 if (risnull(CDECIMALTYPE, (char *)&j))
      61            0 :                         printf("%d NULL\n", i);
      62            0 :                 else
      63              :                 {
      64            0 :                         int a;
      65              : 
      66            0 :                         dectoint(&j, &a);
      67            0 :                         printf("%d %d \"%s\"\n", i, a, c);
      68            0 :                 }
      69            0 :         }
      70              : 
      71            0 :         deccvint(7, &j);
      72            0 :         deccvint(14, &m);
      73            0 :         decadd(&j, &m, &n);
      74            0 :         $delete from test where i= :n::decimal;
      75            0 :         printf("DELETE: %ld\n", sqlca.sqlcode);
      76              : 
      77            0 :         $select 1 from test where i=14;
      78            0 :         printf("Exists: %ld\n", sqlca.sqlcode);
      79              : 
      80            0 :         $select 1 from test where i=147;
      81            0 :         printf("Does not exist: %ld\n", sqlca.sqlcode);
      82              : 
      83            0 :         $commit;
      84            0 :         $drop table test;
      85            0 :         $commit;
      86            0 : 
      87            0 :         $close database;
      88            0 : 
      89            0 :         return 0;
      90            0 : }
      91              : 
      92            0 : static void openit(void)
      93              : {
      94            0 :         $open c;
      95            0 : }
        

Generated by: LCOV version 2.3.2-1