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

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

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