LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/test/sql - createtableas.pgc (source / functions) Hit Total Coverage
Test: PostgreSQL 18devel Lines: 21 21 100.0 %
Date: 2024-12-02 20:15:07 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #include <stdlib.h>
       2             : #include <string.h>
       3             : #include <stdlib.h>
       4             : #include <stdio.h>
       5             : 
       6             : exec sql include ../regression;
       7             : 
       8             : exec sql whenever sqlerror sqlprint;
       9             : 
      10             : int
      11           4 : main(void)
      12             : {
      13             :     EXEC SQL BEGIN DECLARE SECTION;
      14             :         int id;
      15             :     EXEC SQL END DECLARE SECTION;
      16             : 
      17           4 :     ECPGdebug(1, stderr);
      18           4 :     EXEC SQL connect to REGRESSDB1;
      19           4 : 
      20           4 :     EXEC SQL SET AUTOCOMMIT TO ON;
      21           4 :     EXEC SQL WHENEVER SQLWARNING SQLPRINT;
      22             :     EXEC SQL WHENEVER SQLERROR SQLPRINT;
      23             : 
      24           4 :     EXEC SQL CREATE TABLE cta_test (id int);
      25           4 :     EXEC SQL INSERT INTO cta_test values (100);
      26           4 : 
      27           4 :     EXEC SQL CREATE TABLE IF NOT EXISTS cta_test1 AS SELECT * FROM cta_test;
      28           4 :     EXEC SQL SELECT id INTO :id FROM cta_test1;
      29           4 :     printf("ID = %d\n", id);
      30             : 
      31           4 :     EXEC SQL CREATE TABLE cta_test2 AS SELECT * FROM cta_test WITH NO DATA;
      32           4 :     EXEC SQL SELECT count(id) INTO :id FROM cta_test2;
      33           4 :     printf("ID = %d\n", id);
      34             : 
      35           4 :     EXEC SQL DROP TABLE cta_test;
      36           4 :     EXEC SQL DROP TABLE cta_test1;
      37           4 :     EXEC SQL DROP TABLE cta_test2;
      38           4 :     EXEC SQL DISCONNECT all;
      39           4 : 
      40           4 :     return 0;
      41             : }

Generated by: LCOV version 1.14