LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/test/sql - parser.pgc (source / functions) Hit Total Coverage
Test: PostgreSQL 18devel Lines: 20 20 100.0 %
Date: 2024-11-21 08:14:44 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             : /* test parser addition that merges two tokens into one */
       6             : EXEC SQL INCLUDE ../regression;
       7             : 
       8           4 : int main() {
       9             :   EXEC SQL BEGIN DECLARE SECTION;
      10             :     int item[3], ind[3], i;
      11             :   EXEC SQL END DECLARE SECTION;
      12             : 
      13           4 :   ECPGdebug(1, stderr);
      14           4 :   EXEC SQL CONNECT TO REGRESSDB1;
      15             : 
      16           4 :   EXEC SQL SET AUTOCOMMIT TO ON;
      17             :   EXEC SQL WHENEVER SQLWARNING SQLPRINT;
      18             :   EXEC SQL WHENEVER SQLERROR SQLPRINT;
      19             : 
      20           4 :   EXEC SQL CREATE TABLE T ( Item1 int, Item2 int );
      21           4 : 
      22           4 :   EXEC SQL INSERT INTO t
      23             :            SELECT 1,nullif(y-1,0)
      24             :              FROM generate_series(1,3) WITH ORDINALITY AS series(x,y);
      25           4 : 
      26           4 :   EXEC SQL SELECT Item2 INTO :item:ind FROM T ORDER BY Item2 NULLS LAST;
      27           4 : 
      28          16 :   for (i=0; i<3; i++)
      29          12 :     printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]);
      30             : 
      31           4 :   EXEC SQL ALTER TABLE T ALTER Item1 TYPE bigint;
      32           4 :   EXEC SQL ALTER TABLE T ALTER COLUMN Item2 SET DATA TYPE smallint;
      33           4 : 
      34           4 :   EXEC SQL DROP TABLE T;
      35           4 : 
      36           4 :   EXEC SQL DISCONNECT ALL;
      37           4 : 
      38           4 :   return 0;
      39             : }

Generated by: LCOV version 1.14