Age Owner Branch data TLA 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
1882 meskes@postgresql.or 11 :CBC 1 : main(void)
12 : : {
13 : : EXEC SQL BEGIN DECLARE SECTION;
14 : : int id;
15 : : EXEC SQL END DECLARE SECTION;
16 : :
17 : 1 : ECPGdebug(1, stderr);
18 : 1 : EXEC SQL connect to REGRESSDB1;
19 [ - + ]: 1 :
20 : 1 : EXEC SQL SET AUTOCOMMIT TO ON;
21 [ - + ]: 1 : EXEC SQL WHENEVER SQLWARNING SQLPRINT;
22 : : EXEC SQL WHENEVER SQLERROR SQLPRINT;
23 : :
24 : 1 : EXEC SQL CREATE TABLE cta_test (id int);
25 [ - + - + ]: 1 : EXEC SQL INSERT INTO cta_test values (100);
26 [ - + - + ]: 1 :
27 : 1 : EXEC SQL CREATE TABLE IF NOT EXISTS cta_test1 AS SELECT * FROM cta_test;
28 [ - + - + ]: 1 : EXEC SQL SELECT id INTO :id FROM cta_test1;
29 [ - + - + ]: 1 : printf("ID = %d\n", id);
30 : :
31 : 1 : EXEC SQL CREATE TABLE cta_test2 AS SELECT * FROM cta_test WITH NO DATA;
32 [ - + - + ]: 1 : EXEC SQL SELECT count(id) INTO :id FROM cta_test2;
33 [ - + - + ]: 1 : printf("ID = %d\n", id);
34 : :
35 : 1 : EXEC SQL DROP TABLE cta_test;
36 [ - + - + ]: 1 : EXEC SQL DROP TABLE cta_test1;
37 [ - + - + ]: 1 : EXEC SQL DROP TABLE cta_test2;
38 [ - + - + ]: 1 : EXEC SQL DISCONNECT all;
39 [ - + - + ]: 1 :
40 : 1 : return 0;
41 : : }
|