summaryrefslogtreecommitdiffstats
path: root/src/interfaces/ecpg/test/sql/copystdout.pgc
blob: 9ecce7d42c254a07a7cec42fab336737460ce508 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>

EXEC SQL INCLUDE sqlca;
exec sql include ../regression;

EXEC SQL WHENEVER SQLERROR sqlprint;

int
main ()
{
  ECPGdebug (1, stderr);

  EXEC SQL CONNECT TO REGRESSDB1;
  EXEC SQL CREATE TABLE foo (a int, b varchar);
  EXEC SQL INSERT INTO foo VALUES (5, 'abc');
  EXEC SQL INSERT INTO foo VALUES (6, 'def');
  EXEC SQL INSERT INTO foo VALUES (7, 'ghi');

  EXEC SQL COPY foo TO STDOUT WITH DELIMITER ',';
  printf ("copy to STDOUT : sqlca.sqlcode = %ld\n", sqlca.sqlcode);

  EXEC SQL DISCONNECT;

  return 0;
}