LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/test/sql - insupd.pgc (source / functions) Hit Total Coverage
Test: PostgreSQL 13devel Lines: 20 20 100.0 %
Date: 2019-11-13 22:07:24 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #include <stdio.h>
       2             : #include <stdlib.h>
       3             : #include <string.h>
       4             : 
       5             : EXEC SQL INCLUDE ../regression;
       6             : 
       7           4 : int main() {
       8             :   EXEC SQL BEGIN DECLARE SECTION;
       9             :     int i1[3], i2[3], i3[3], i4;
      10             :   EXEC SQL END DECLARE SECTION;
      11             : 
      12           4 :   ECPGdebug(1, stderr);
      13           4 :   EXEC SQL CONNECT TO REGRESSDB1;
      14             : 
      15             :   EXEC SQL WHENEVER SQLWARNING SQLPRINT;
      16             :   EXEC SQL WHENEVER SQLERROR SQLPRINT;
      17             : 
      18           4 :   EXEC SQL CREATE TABLE insupd_test(a int, b int);
      19           4 : 
      20           4 :   EXEC SQL INSERT INTO insupd_test (a,b) values (1, 1);
      21           4 :   EXEC SQL INSERT INTO insupd_test (a,b) values (2, 2);
      22           4 :   EXEC SQL INSERT INTO insupd_test (a,b) values (3, 3) returning a into :i4;
      23           4 : 
      24           4 :   EXEC SQL UPDATE insupd_test set a=a+1 returning a into :i3;
      25           4 :   EXEC SQL UPDATE insupd_test set (a,b)=(5,5) where a = 4;
      26           4 :   EXEC SQL UPDATE insupd_test set a=4 where a=3;;
      27           4 : 
      28           4 :   EXEC SQL SELECT a,b into :i1,:i2 from insupd_test order by a;
      29           4 : 
      30           4 :   printf("changes\n%d %d %d %d\n", i3[0], i3[1], i3[2], i4);
      31           4 :   printf("test\na b\n%d %d\n%d %d\n%d %d\n", i1[0], i2[0], i1[1], i2[1], i1[2], i2[2]);
      32             : 
      33           4 :   EXEC SQL DISCONNECT ALL;
      34           4 : 
      35           4 :   return 0;
      36             : }

Generated by: LCOV version 1.13