aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interfaces/ecpg/preproc/preproc.y4
-rw-r--r--src/interfaces/ecpg/test/Makefile4
-rw-r--r--src/interfaces/ecpg/test/complex/Makefile12
-rw-r--r--src/interfaces/ecpg/test/complex/header_test.h32
-rw-r--r--src/interfaces/ecpg/test/complex/test1.pgc203
-rw-r--r--src/interfaces/ecpg/test/complex/test2.pgc126
-rw-r--r--src/interfaces/ecpg/test/complex/test3.pgc122
-rw-r--r--src/interfaces/ecpg/test/errors/Makefile10
-rw-r--r--src/interfaces/ecpg/test/errors/init.pgc100
-rw-r--r--src/interfaces/ecpg/test/expected/complex-test1.c625
-rw-r--r--src/interfaces/ecpg/test/expected/complex-test1.stderr240
-rw-r--r--src/interfaces/ecpg/test/expected/complex-test1.stdout29
-rw-r--r--src/interfaces/ecpg/test/expected/complex-test2.c430
-rw-r--r--src/interfaces/ecpg/test/expected/complex-test2.stderr164
-rw-r--r--src/interfaces/ecpg/test/expected/complex-test2.stdout6
-rw-r--r--src/interfaces/ecpg/test/expected/complex-test3.c426
-rw-r--r--src/interfaces/ecpg/test/expected/complex-test3.stderr136
-rw-r--r--src/interfaces/ecpg/test/expected/complex-test3.stdout4
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-comment.c46
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-comment.stderr6
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-comment.stdout0
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-type.c2
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-whenever.c244
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-whenever.stderr74
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-whenever.stdout0
-rw-r--r--src/interfaces/ecpg/test/expected/sql-execute.c278
-rw-r--r--src/interfaces/ecpg/test/expected/sql-execute.stderr120
-rw-r--r--src/interfaces/ecpg/test/expected/sql-execute.stdout11
-rw-r--r--src/interfaces/ecpg/test/expected/sql-fetch.c196
-rw-r--r--src/interfaces/ecpg/test/expected/sql-fetch.stderr88
-rw-r--r--src/interfaces/ecpg/test/expected/sql-fetch.stdout5
-rw-r--r--src/interfaces/ecpg/test/expected/sql-quote.c14
-rw-r--r--src/interfaces/ecpg/test/expected/sql-quote.stderr14
-rw-r--r--src/interfaces/ecpg/test/pg_regress.sh3
-rw-r--r--src/interfaces/ecpg/test/preproc/Makefile6
-rw-r--r--src/interfaces/ecpg/test/preproc/comment.pgc25
-rw-r--r--src/interfaces/ecpg/test/preproc/type.pgc2
-rw-r--r--src/interfaces/ecpg/test/preproc/whenever.pgc65
-rw-r--r--src/interfaces/ecpg/test/sql/Makefile2
-rw-r--r--src/interfaces/ecpg/test/sql/execute.pgc93
-rw-r--r--src/interfaces/ecpg/test/sql/fetch.pgc49
-rw-r--r--src/interfaces/ecpg/test/sql/quote.pgc14
42 files changed, 1335 insertions, 2695 deletions
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index c707c96a9d3..47515ead598 100644
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.337 2006/09/05 10:00:52 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.338 2006/09/08 13:32:26 meskes Exp $ */
/* Copyright comment */
%{
@@ -6038,7 +6038,7 @@ action : SQL_CONTINUE
| SQL_CALL name
{
$<action>$.code = W_DO;
- $<action>$.command = cat_str(3, $2, make_str("("), make_str(")"));
+ $<action>$.command = cat2_str($2, make_str("()"));
$<action>$.str = cat2_str(make_str("call"), mm_strdup($<action>$.command));
}
;
diff --git a/src/interfaces/ecpg/test/Makefile b/src/interfaces/ecpg/test/Makefile
index 5ed4622cabf..72b4371eb70 100644
--- a/src/interfaces/ecpg/test/Makefile
+++ b/src/interfaces/ecpg/test/Makefile
@@ -1,4 +1,4 @@
-# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.61 2006/09/05 12:11:01 meskes Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.62 2006/09/08 13:32:26 meskes Exp $
subdir = src/interfaces/ecpg/test
top_builddir = ../../../..
@@ -29,7 +29,6 @@ all install installdirs uninstall dep depend distprep:
$(MAKE) -C pgtypeslib $@
$(MAKE) -C preproc $@
$(MAKE) -C compat_informix $@
- $(MAKE) -C complex $@
$(MAKE) -C thread $@
clean distclean maintainer-clean:
@@ -39,7 +38,6 @@ clean distclean maintainer-clean:
$(MAKE) -C pgtypeslib $@
$(MAKE) -C preproc $@
$(MAKE) -C compat_informix $@
- $(MAKE) -C complex $@
$(MAKE) -C thread $@
rm -rf tmp_check results log
rm -f pg_regress regression.diffs
diff --git a/src/interfaces/ecpg/test/complex/Makefile b/src/interfaces/ecpg/test/complex/Makefile
deleted file mode 100644
index 5cd59f20ca5..00000000000
--- a/src/interfaces/ecpg/test/complex/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-subdir = src/interfaces/ecpg/test/complex
-top_builddir = ../../../../..
-include $(top_builddir)/src/Makefile.global
-include $(top_srcdir)/$(subdir)/../Makefile.regress
-
-
-TESTS = test1 test1.c \
- test2 test2.c \
- test3 test3.c
-
-all: $(TESTS)
-
diff --git a/src/interfaces/ecpg/test/complex/header_test.h b/src/interfaces/ecpg/test/complex/header_test.h
deleted file mode 100644
index aacc8ba7cec..00000000000
--- a/src/interfaces/ecpg/test/complex/header_test.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "stdlib.h"
-
-static void
-Finish(char *msg)
-{
- fprintf(stderr, "Error in statement '%s':\n", msg);
- sqlprint();
-
- /* finish transaction */
- exec sql rollback;
-
- /* and remove test table */
- exec sql drop table meskes;
- exec sql commit;
-
- exec sql disconnect;
-
- exit(-1);
-}
-
-static void
-warn(void)
-{
- fprintf(stderr, "Warning: At least one column was truncated\n");
-}
-
-exec sql whenever sqlerror
-do
- Finish(msg);
-exec sql whenever sqlwarning
-do
- warn();
diff --git a/src/interfaces/ecpg/test/complex/test1.pgc b/src/interfaces/ecpg/test/complex/test1.pgc
deleted file mode 100644
index 18cf12eb37e..00000000000
--- a/src/interfaces/ecpg/test/complex/test1.pgc
+++ /dev/null
@@ -1,203 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-exec sql include ../regression;
-
-/* just a test comment */ exec sql whenever sqlerror do PrintAndStop(msg);
-exec sql whenever sqlwarning do warn();
-
-static void PrintAndStop(char *msg)
-{
- fprintf(stderr, "Error in statement '%s':\n", msg);
- sqlprint();
- exit(-1);
-}
-
-static void warn(void)
-{
- fprintf(stderr, "Warning: At least one column was truncated\n");
-}
-
-/* comment */
-exec sql define AMOUNT 6;
-exec sql define NAMELEN 8;
-
-exec sql type intarray is int[AMOUNT];
-
-typedef int intarray[AMOUNT];
-
-int
-main(void)
-{
-exec sql begin declare section;
-exec sql ifdef NAMELEN;
- typedef char string[NAMELEN];
- intarray amount;
- int increment=100;
- char name[AMOUNT][NAMELEN];
- char letter[AMOUNT][1];
- struct name_letter_struct
- {
- char name[NAMELEN];
- int amount;
- char letter;
- } name_letter[AMOUNT];
-#if 0
- int not_used;
-#endif
-exec sql endif;
- struct ind_struct
- {
- short a;
- short b;
- short c;
- } ind[AMOUNT];
- char command[128];
- char *connection="pm";
- int how_many;
- char *user="regressuser1";
-exec sql end declare section;
- exec sql var name is string[AMOUNT];
- char msg[128];
- int i,j;
-
- ECPGdebug(1, stderr);
-
- strcpy(msg, "connect");
- exec sql connect to REGRESSDB1 as main;
-
- strcpy(msg, "connect");
- exec sql connect to REGRESSDB2 as pm user :user;
-
- strcpy(msg, "create");
- exec sql at main create table "Test" (name char(NAMELEN), amount int, letter char(1));
- exec sql create table "Test" (name char(NAMELEN), amount int, letter char(1));
-
- strcpy(msg, "commit");
- exec sql at main commit;
- exec sql commit;
-
- strcpy(msg, "set connection");
- exec sql set connection to main;
-
- strcpy(msg, "execute insert 1");
- sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''r1''', 1, 'f')");
- exec sql execute immediate :command;
- printf("New tuple got OID = %ld\n", sqlca.sqlerrd[1]);
-
- sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''r1''', 2, 't')");
- exec sql execute immediate :command;
-
- strcpy(msg, "execute insert 2");
- sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''pm''', 1, 'f')");
- exec sql at pm execute immediate :command;
-
- strcpy(msg, "execute insert 3");
- sprintf(command, "insert into \"Test\" (name, amount, letter) select name, amount+10, letter from \"Test\"");
- exec sql execute immediate :command;
-
- printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
-
- strcpy(msg, "execute insert 4");
- sprintf(command, "insert into \"Test\" (name, amount, letter) select name, amount+?, letter from \"Test\"");
- exec sql prepare I from :command;
- exec sql at pm execute I using :increment;
-
- printf("Inserted %ld tuples via prepared execute\n", sqlca.sqlerrd[2]);
-
- strcpy(msg, "commit");
- exec sql commit;
-
- /* Start automatic transactioning for connection pm. */
- exec sql at pm set autocommit to on;
- exec sql at pm begin transaction;
-
- strcpy(msg, "select");
- exec sql select * into :name, :amount, :letter from "Test";
-
- printf("Database: main\n");
- for (i=0, how_many=j=sqlca.sqlerrd[2]; i<j; i++)
- {
- exec sql begin declare section;
- char n[8], l = letter[i][0];
- int a = amount[i];
- exec sql end declare section;
-
- strncpy(n, name[i], NAMELEN);
- printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
- amount[i]+=1000;
-
- strcpy(msg, "insert");
- exec sql at pm insert into "Test" (name, amount, letter) values (:n, :amount[i], :l);
- }
-
- strcpy(msg, "commit");
- exec sql at pm commit;
-
- sprintf (command, "select * from \"Test\"");
-
- exec sql prepare F from :command;
- exec sql declare CUR cursor for F;
-
- strcpy(msg, "open");
- exec sql open CUR;
-
- strcpy(msg, "fetch");
- exec sql fetch :how_many in CUR into :name, :amount, :letter;
-
- printf("Database: main\n");
- for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
- {
- exec sql begin declare section;
- char n[8], l = letter[i][0];
- int a = amount[i];
- exec sql end declare section;
-
- strncpy(n, name[i], 8);
- printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
- }
-
- exec sql close CUR;
-
- strcpy(msg, "select");
- exec sql at :connection select name, amount, letter into :name, :amount, :letter from "Test";
-
- printf("Database: %s\n", connection);
- for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
- printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]);
-
- strcpy(msg, "commit");
- exec sql commit;
-
- strcpy(msg, "select");
- exec sql at pm select name, amount, letter into :name_letter:ind from "Test";
-
- printf("Database: pm\n");
- for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
- printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name_letter[i].name, i, name_letter[i].amount,i, name_letter[i].letter);
-
- name_letter[4].amount=1407;
- strcpy(msg, "insert");
- exec sql insert into "Test" (name, amount, letter) values (:name_letter[4]);
-
- strcpy(msg, "select");
- exec sql select name, amount, letter into :name_letter[2] from "Test" where amount = 1407;
-
- printf("Database: main\n");
- printf("name[2]=%8.8s\tamount[2]=%d\tletter[2]=%c\n", name_letter[2].name, name_letter[2].amount, name_letter[2].letter);
-
- /* Start automatic transactioning for connection main. */
- exec sql set autocommit to on;
-
- strcpy(msg, "drop");
- exec sql drop table "Test";
- exec sql at pm drop table "Test";
-
- strcpy(msg, "disconnect");
- exec sql disconnect main;
- exec sql disconnect pm;
-
- return (0);
-}
diff --git a/src/interfaces/ecpg/test/complex/test2.pgc b/src/interfaces/ecpg/test/complex/test2.pgc
deleted file mode 100644
index 282ef96e178..00000000000
--- a/src/interfaces/ecpg/test/complex/test2.pgc
+++ /dev/null
@@ -1,126 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-
-exec sql include header_test;
-exec sql include ../regression;
-
-exec sql type c is char reference;
-typedef char* c;
-
-exec sql type ind is union { int integer; short smallint; };
-typedef union { int integer; short smallint; } ind;
-
-#define BUFFERSIZ 8
-exec sql type str is varchar[BUFFERSIZ];
-
-exec sql declare cur cursor for
- select name, born, age, married, children from meskes;
-
-int
-main (void)
-{
- exec sql struct birthinfo { long born; short age; };
-exec sql begin declare section;
- struct personal_struct { str name;
- struct birthinfo birth;
- } personal, *p;
- struct personal_indicator { int ind_name;
- struct birthinfo ind_birth;
- } ind_personal, *i;
- ind ind_children;
- char *query="select name, born, age, married, children from meskes where name = :var1";
-exec sql end declare section;
-
- exec sql char *married = NULL;
- exec sql long ind_married;
- exec sql ind children;
-
- char msg[128];
-
- ECPGdebug(1, stderr);
-
- strcpy(msg, "connect");
- exec sql connect to REGRESSDB1;
-
- strcpy(msg, "create");
- exec sql create table meskes(name char(8), born integer, age smallint, married date, children integer);
-
- strcpy(msg, "insert");
- exec sql insert into meskes(name, married, children) values ('Petra', '19900404', 3);
- exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117, 35, '19900404', 3);
- exec sql insert into meskes(name, born, age) values ('Carsten', 19910103,10);
- exec sql insert into meskes(name, born, age) values ('Marc', 19930907, 8);
- exec sql insert into meskes(name, born, age) values ('Chris', 19970923, 4);
-
- strcpy(msg, "commit");
- exec sql commit;
-
- strcpy(msg, "open");
- exec sql open cur;
-
- exec sql whenever not found do break;
-
- p=&personal;
- i=&ind_personal;
- memset(i, 0, sizeof(ind_personal));
- while (1) {
- strcpy(msg, "fetch");
- exec sql fetch cur into :p:i, :married:ind_married, :children.integer:ind_children.smallint;
- printf("%8.8s", personal.name.arr);
- if (i->ind_birth.born >= 0)
- printf(", born %ld", personal.birth.born);
- if (i->ind_birth.age >= 0)
- printf(", age = %d", personal.birth.age);
- if (ind_married >= 0)
- printf(", married %s", married);
- if (ind_children.smallint >= 0)
- printf(", children = %d", children.integer);
- putchar('\n');
-
- free(married);
- married = NULL;
- }
-
- strcpy(msg, "close");
- exec sql close cur;
-
- /* and now a same query with prepare */
- exec sql prepare MM from :query;
- exec sql declare prep cursor for MM;
-
- strcpy(msg, "open");
- exec sql open prep using 'Petra';
-
- exec sql whenever not found do break;
-
- while (1) {
- strcpy(msg, "fetch");
- exec sql fetch in prep into :personal:ind_personal, :married:ind_married, :children.integer:ind_children.smallint;
- printf("%8.8s", personal.name.arr);
- if (ind_personal.ind_birth.born >= 0)
- printf(", born %ld", personal.birth.born);
- if (ind_personal.ind_birth.age >= 0)
- printf(", age = %d", personal.birth.age);
- if (ind_married >= 0)
- printf(", married %s", married);
- if (ind_children.smallint >= 0)
- printf(", children = %d", children.integer);
- putchar('\n');
- }
-
- free(married);
-
- strcpy(msg, "close");
- exec sql close prep;
-
- strcpy(msg, "drop");
- exec sql drop table meskes;
-
- strcpy(msg, "commit");
- exec sql commit;
-
- strcpy(msg, "disconnect");
- exec sql disconnect;
-
- return (0);
-}
diff --git a/src/interfaces/ecpg/test/complex/test3.pgc b/src/interfaces/ecpg/test/complex/test3.pgc
deleted file mode 100644
index 5525fd137cd..00000000000
--- a/src/interfaces/ecpg/test/complex/test3.pgc
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************/
-/* Test comment */
-/*--------------------------------------------------------------------------*/
-exec sql include header_test;
-exec sql include ../regression;
-
-exec sql type str is varchar[10];
-
-#include <stdlib.h>
-#include <string.h>
-
-int
-main (void)
-{
-exec sql begin declare section;
- typedef struct { long born; short age; } birthinfo;
- struct personal_struct { str name;
- birthinfo birth;
- } personal;
- struct personal_indicator { int ind_name;
- birthinfo ind_birth;
- } ind_personal;
- int *ind_married = NULL;
- int children, movevalue = 2;
- int ind_children;
- str *married = NULL;
- char *wifesname="Petra";
- char *query="select * from meskes where name = ?";
-exec sql end declare section;
-
- exec sql declare cur cursor for
- select name, born, age, married, children from meskes;
-
- char msg[128];
-
- ECPGdebug(1, stderr);
-
- strcpy(msg, "connect");
- exec sql connect to REGRESSDB1;
-
- strcpy(msg, "create");
- exec sql create table meskes(name char(8), born integer, age smallint, married date, children integer);
-
- strcpy(msg, "insert");
- exec sql insert into meskes(name, married, children) values (:wifesname, '19900404', 3);
- exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117, 35, '19900404', 3);
- exec sql insert into meskes(name, born, age) values ('Carsten', 19910103, 10);
- exec sql insert into meskes(name, born, age) values ('Marc', 19930907, 8);
- exec sql insert into meskes(name, born, age) values ('Chris', 19970923, 4);
-
- strcpy(msg, "commit");
- exec sql commit;
-
- strcpy(msg, "open");
- exec sql open cur;
-
- strcpy(msg, "move");
- exec sql move :movevalue in cur;
-
- exec sql whenever not found do break;
-
- while (1) {
- strcpy(msg, "fetch");
- exec sql fetch from cur into :personal:ind_personal, :married:ind_married, :children:ind_children;
- printf("%8.8s", personal.name.arr);
- if (ind_personal.ind_birth.born >= 0)
- printf(", born %ld", personal.birth.born);
- if (ind_personal.ind_birth.age >= 0)
- printf(", age = %d", personal.birth.age);
- if (*ind_married >= 0)
- printf(", married %10.10s", married->arr);
- if (ind_children >= 0)
- printf(", children = %d", children);
- putchar('\n');
-
- free(married);
- married = NULL;
- }
-
- strcpy(msg, "close");
- exec sql close cur;
-
- /* and now a query with prepare */
- exec sql prepare MM from :query;
- exec sql declare prep cursor for MM;
-
- strcpy(msg, "open");
- exec sql open prep using :wifesname;
-
- exec sql whenever not found do break;
-
- while (1) {
- strcpy(msg, "fetch");
- exec sql fetch in prep into :personal:ind_personal, :married:ind_married, :children:ind_children;
- printf("%8.8s", personal.name.arr);
- if (ind_personal.ind_birth.born >= 0)
- printf(", born %ld", personal.birth.born);
- if (ind_personal.ind_birth.age >= 0)
- printf(", age = %d", personal.birth.age);
- if (*ind_married >= 0)
- printf(", married %10.10s", married->arr);
- if (ind_children >= 0)
- printf(", children = %d", children);
- putchar('\n');
- }
-
- free(married);
-
- strcpy(msg, "close");
- exec sql close prep;
-
- strcpy(msg, "drop");
- exec sql drop table meskes;
-
- strcpy(msg, "commit");
- exec sql commit;
-
- strcpy(msg, "disconnect");
- exec sql disconnect;
-
- return (0);
-}
diff --git a/src/interfaces/ecpg/test/errors/Makefile b/src/interfaces/ecpg/test/errors/Makefile
deleted file mode 100644
index 081c7b6a81f..00000000000
--- a/src/interfaces/ecpg/test/errors/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-subdir = src/interfaces/ecpg/test/errors
-top_builddir = ../../../../..
-include $(top_builddir)/src/Makefile.global
-include $(top_srcdir)/$(subdir)/../Makefile.regress
-
-
-TESTS = init init.c
-
-all: $(TESTS)
-
diff --git a/src/interfaces/ecpg/test/errors/init.pgc b/src/interfaces/ecpg/test/errors/init.pgc
deleted file mode 100644
index 8521e44ee10..00000000000
--- a/src/interfaces/ecpg/test/errors/init.pgc
+++ /dev/null
@@ -1,100 +0,0 @@
-exec sql include sqlca;
-
-enum e { ENUM0, ENUM1 };
-struct sa { int member; };
-
-static int fa(void)
-{
- printf("in fa\n");
- return 2;
-}
-
-static int
-fb(int x)
-{
- printf("in fb (%d)\n", x);
- return x;
-}
-
-static int
-fc(const char *x)
-{
- printf("in fc (%s)\n", x);
- return *x;
-}
-
-static int fd(const char *x,int i)
-{
- printf("in fd (%s, %d)\n", x, i);
- return (*x)*i;
-}
-
-static int fe(enum e x)
-{
- printf("in fe (%d)\n", (int) x);
- return (int)x;
-}
-
-static void sqlnotice(char *notice, short trans)
-{
- if (!notice)
- notice = "-empty-";
- printf("in sqlnotice (%s, %d)\n", notice, trans);
-}
-
-exec sql define NONO 0;
-
-#define YES 1
-
-#ifdef _cplusplus
-namespace N
-{
- static const int i=2;
-};
-#endif
-
-int main(void)
-{
- struct sa x = { 14 },*y = &x;
- exec sql begin declare section;
- int a=(int)2;
- int b=2+2;
- int b2=(14*7);
- int d=x.member;
- int g=fb(2);
- int i=3^1;
- int j=1?1:2;
-
- int e=y->member;
- int c=10>>2;
- bool h=2||1;
- long iay /* = 1L */ ;
- exec sql end declare section;
-
- int f=fa();
-
-#ifdef _cplusplus
- exec sql begin declare section;
- int k=N::i; /* compile error */
- exec sql end declare section;
-#endif
-
- ECPGdebug(1, stderr);
-
- printf("%d %d %d %d %d %d %d %d %d %d %d\n", a, b, b2, c, d, e, f, g, h, i, j);
- iay = 0;
- printf("%ld\n", iay);
- exec sql whenever sqlerror do fa();
- exec sql select now();
- exec sql whenever sqlerror do fb(20);
- exec sql select now();
- exec sql whenever sqlerror do fc("50");
- exec sql select now();
- exec sql whenever sqlerror do fd("50",1);
- exec sql select now();
- exec sql whenever sqlerror do fe(ENUM0);
- exec sql select now();
- exec sql whenever sqlerror do sqlnotice(NULL, NONO);
- exec sql select now();
- return 0;
-}
diff --git a/src/interfaces/ecpg/test/expected/complex-test1.c b/src/interfaces/ecpg/test/expected/complex-test1.c
deleted file mode 100644
index 82a3df9559f..00000000000
--- a/src/interfaces/ecpg/test/expected/complex-test1.c
+++ /dev/null
@@ -1,625 +0,0 @@
-/* Processed by ecpg (4.2.1) */
-/* These include files are added by the preprocessor */
-#include <ecpgtype.h>
-#include <ecpglib.h>
-#include <ecpgerrno.h>
-#include <sqlca.h>
-/* End of automatic include section */
-
-#line 1 "test1.pgc"
-#include <stdlib.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-
-#line 1 "regression.h"
-
-
-
-
-
-
-#line 6 "test1.pgc"
-
-
-/* just a test comment */ /* exec sql whenever sqlerror do PrintAndStop ( msg ) ; */
-#line 8 "test1.pgc"
-
-/* exec sql whenever sql_warning do warn ( ) ; */
-#line 9 "test1.pgc"
-
-
-static void PrintAndStop(char *msg)
-{
- fprintf(stderr, "Error in statement '%s':\n", msg);
- sqlprint();
- exit(-1);
-}
-
-static void warn(void)
-{
- fprintf(stderr, "Warning: At least one column was truncated\n");
-}
-
-/* comment */
-
-
-
-/* exec sql type intarray is int [ 6 ] */
-#line 27 "test1.pgc"
-
-
-typedef int intarray[ 6];
-
-int
-main(void)
-{
-/* exec sql begin declare section */
-
- typedef char string [ 8 ] ;
-
-#line 36 "test1.pgc"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#line 37 "test1.pgc"
- intarray amount ;
-
-#line 38 "test1.pgc"
- int increment = 100 ;
-
-#line 39 "test1.pgc"
- char name [ 6 ] [ 8 ] ;
-
-#line 40 "test1.pgc"
- char letter [ 6 ] [ 1 ] ;
-
-#line 46 "test1.pgc"
- struct name_letter_struct {
-#line 43 "test1.pgc"
- char name [ 8 ] ;
-
-#line 44 "test1.pgc"
- int amount ;
-
-#line 45 "test1.pgc"
- char letter ;
- } name_letter [ 6 ] ;
-
-#if 0
-
-#line 48 "test1.pgc"
- int not_used ;
-
-#endif
-
-#line 56 "test1.pgc"
- struct ind_struct {
-#line 53 "test1.pgc"
- short a ;
-
-#line 54 "test1.pgc"
- short b ;
-
-#line 55 "test1.pgc"
- short c ;
- } ind [ 6 ] ;
-
-#line 57 "test1.pgc"
- char command [ 128 ] ;
-
-#line 58 "test1.pgc"
- char * connection = "pm" ;
-
-#line 59 "test1.pgc"
- int how_many ;
-
-#line 60 "test1.pgc"
- char * user = "regressuser1" ;
-/* exec sql end declare section */
-#line 61 "test1.pgc"
-
- /* exec sql var name is string [ 6 ] */
-#line 62 "test1.pgc"
-
- char msg[128];
- int i,j;
-
- ECPGdebug(1, stderr);
-
- strcpy(msg, "connect");
- { ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , "main", 0);
-#line 69 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 69 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 69 "test1.pgc"
-
-
- strcpy(msg, "connect");
- { ECPGconnect(__LINE__, 0, "connectdb" , user , NULL , "pm", 0);
-#line 72 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 72 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 72 "test1.pgc"
-
-
- strcpy(msg, "create");
- { ECPGdo(__LINE__, 0, 1, "main", "create table \"Test\" ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 75 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 75 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 75 "test1.pgc"
-
- { ECPGdo(__LINE__, 0, 1, NULL, "create table \"Test\" ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 76 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 76 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 76 "test1.pgc"
-
-
- strcpy(msg, "commit");
- { ECPGtrans(__LINE__, "main", "commit");
-#line 79 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 79 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 79 "test1.pgc"
-
- { ECPGtrans(__LINE__, NULL, "commit");
-#line 80 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 80 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 80 "test1.pgc"
-
-
- strcpy(msg, "set connection");
- { ECPGsetconn(__LINE__, "main");
-#line 83 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 83 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 83 "test1.pgc"
-
-
- strcpy(msg, "execute insert 1");
- sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''r1''', 1, 'f')");
- { ECPGdo(__LINE__, 0, 1, NULL, "?",
- ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 87 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 87 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 87 "test1.pgc"
-
- printf("New tuple got OID = %ld\n", sqlca.sqlerrd[1]);
-
- sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''r1''', 2, 't')");
- { ECPGdo(__LINE__, 0, 1, NULL, "?",
- ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 91 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 91 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 91 "test1.pgc"
-
-
- strcpy(msg, "execute insert 2");
- sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''pm''', 1, 'f')");
- { ECPGdo(__LINE__, 0, 1, "pm", "?",
- ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 95 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 95 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 95 "test1.pgc"
-
-
- strcpy(msg, "execute insert 3");
- sprintf(command, "insert into \"Test\" (name, amount, letter) select name, amount+10, letter from \"Test\"");
- { ECPGdo(__LINE__, 0, 1, NULL, "?",
- ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 99 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 99 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 99 "test1.pgc"
-
-
- printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
-
- strcpy(msg, "execute insert 4");
- sprintf(command, "insert into \"Test\" (name, amount, letter) select name, amount+?, letter from \"Test\"");
- { ECPGprepare(__LINE__, "I" , command);
-#line 105 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 105 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 105 "test1.pgc"
-
- { ECPGdo(__LINE__, 0, 1, "pm", "?",
- ECPGt_char_variable,(ECPGprepared_statement("I")),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_int,&(increment),(long)1,(long)1,sizeof(int),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 106 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 106 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 106 "test1.pgc"
-
-
- printf("Inserted %ld tuples via prepared execute\n", sqlca.sqlerrd[2]);
-
- strcpy(msg, "commit");
- { ECPGtrans(__LINE__, NULL, "commit");
-#line 111 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 111 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 111 "test1.pgc"
-
-
- /* Start automatic transactioning for connection pm. */
- { ECPGsetcommit(__LINE__, "on", "pm");
-#line 114 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 114 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 114 "test1.pgc"
-
- { ECPGtrans(__LINE__, "pm", "begin transaction ");
-#line 115 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 115 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 115 "test1.pgc"
-
-
- strcpy(msg, "select");
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from \"Test\" ", ECPGt_EOIT,
- ECPGt_char,(name),(long)8,(long)6,(8)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_int,(amount),(long)1,(long)6,sizeof(int),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_char,(letter),(long)1,(long)6,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 118 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 118 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 118 "test1.pgc"
-
-
- printf("Database: main\n");
- for (i=0, how_many=j=sqlca.sqlerrd[2]; i<j; i++)
- {
- /* exec sql begin declare section */
-
-
-
-#line 124 "test1.pgc"
- char n [ 8 ] , l = letter [ i ] [ 0 ] ;
-
-#line 125 "test1.pgc"
- int a = amount [ i ] ;
-/* exec sql end declare section */
-#line 126 "test1.pgc"
-
-
- strncpy(n, name[i], 8);
- printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
- amount[i]+=1000;
-
- strcpy(msg, "insert");
- { ECPGdo(__LINE__, 0, 1, "pm", "insert into \"Test\" ( name , amount , letter ) values( ? , ? , ? ) ",
- ECPGt_char,(n),(long)8,(long)1,(8)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_int,&(amount[i]),(long)1,(long)1,sizeof(int),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_char,&(l),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 133 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 133 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 133 "test1.pgc"
-
- }
-
- strcpy(msg, "commit");
- { ECPGtrans(__LINE__, "pm", "commit");
-#line 137 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 137 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 137 "test1.pgc"
-
-
- sprintf (command, "select * from \"Test\"");
-
- { ECPGprepare(__LINE__, "F" , command);
-#line 141 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 141 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 141 "test1.pgc"
-
- /* declare CUR cursor for ? */
-#line 142 "test1.pgc"
-
-
- strcpy(msg, "open");
- { ECPGdo(__LINE__, 0, 1, NULL, "declare CUR cursor for ?",
- ECPGt_char_variable,(ECPGprepared_statement("F")),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 145 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 145 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 145 "test1.pgc"
-
-
- strcpy(msg, "fetch");
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch ? in CUR",
- ECPGt_int,&(how_many),(long)1,(long)1,sizeof(int),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
- ECPGt_char,(name),(long)8,(long)6,(8)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_int,(amount),(long)1,(long)6,sizeof(int),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_char,(letter),(long)1,(long)6,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 148 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 148 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 148 "test1.pgc"
-
-
- printf("Database: main\n");
- for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
- {
- /* exec sql begin declare section */
-
-
-
-#line 154 "test1.pgc"
- char n [ 8 ] , l = letter [ i ] [ 0 ] ;
-
-#line 155 "test1.pgc"
- int a = amount [ i ] ;
-/* exec sql end declare section */
-#line 156 "test1.pgc"
-
-
- strncpy(n, name[i], 8);
- printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
- }
-
- { ECPGdo(__LINE__, 0, 1, NULL, "close CUR", ECPGt_EOIT, ECPGt_EORT);
-#line 162 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 162 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 162 "test1.pgc"
-
-
- strcpy(msg, "select");
- { ECPGdo(__LINE__, 0, 1, connection, "select name , amount , letter from \"Test\" ", ECPGt_EOIT,
- ECPGt_char,(name),(long)8,(long)6,(8)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_int,(amount),(long)1,(long)6,sizeof(int),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_char,(letter),(long)1,(long)6,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 165 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 165 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 165 "test1.pgc"
-
-
- printf("Database: %s\n", connection);
- for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
- printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]);
-
- strcpy(msg, "commit");
- { ECPGtrans(__LINE__, NULL, "commit");
-#line 172 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 172 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 172 "test1.pgc"
-
-
- strcpy(msg, "select");
- { ECPGdo(__LINE__, 0, 1, "pm", "select name , amount , letter from \"Test\" ", ECPGt_EOIT,
- ECPGt_char,&(name_letter->name),(long)8,(long)6,sizeof( struct name_letter_struct ),
- ECPGt_short,&(ind->a),(long)1,(long)6,sizeof( struct ind_struct ),
- ECPGt_int,&(name_letter->amount),(long)1,(long)6,sizeof( struct name_letter_struct ),
- ECPGt_short,&(ind->b),(long)1,(long)6,sizeof( struct ind_struct ),
- ECPGt_char,&(name_letter->letter),(long)1,(long)6,sizeof( struct name_letter_struct ),
- ECPGt_short,&(ind->c),(long)1,(long)6,sizeof( struct ind_struct ), ECPGt_EORT);
-#line 175 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 175 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 175 "test1.pgc"
-
-
- printf("Database: pm\n");
- for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
- printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name_letter[i].name, i, name_letter[i].amount,i, name_letter[i].letter);
-
- name_letter[4].amount=1407;
- strcpy(msg, "insert");
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into \"Test\" ( name , amount , letter ) values( ? , ? , ? ) ",
- ECPGt_char,&(name_letter[4].name),(long)8,(long)1,(8)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_int,&(name_letter[4].amount),(long)1,(long)1,sizeof(int),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_char,&(name_letter[4].letter),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 183 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 183 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 183 "test1.pgc"
-
-
- strcpy(msg, "select");
- { ECPGdo(__LINE__, 0, 1, NULL, "select name , amount , letter from \"Test\" where amount = 1407 ", ECPGt_EOIT,
- ECPGt_char,&(name_letter[2].name),(long)8,(long)1,(8)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_int,&(name_letter[2].amount),(long)1,(long)1,sizeof(int),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_char,&(name_letter[2].letter),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 186 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 186 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 186 "test1.pgc"
-
-
- printf("Database: main\n");
- printf("name[2]=%8.8s\tamount[2]=%d\tletter[2]=%c\n", name_letter[2].name, name_letter[2].amount, name_letter[2].letter);
-
- /* Start automatic transactioning for connection main. */
- { ECPGsetcommit(__LINE__, "on", NULL);
-#line 192 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 192 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 192 "test1.pgc"
-
-
- strcpy(msg, "drop");
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table \"Test\" ", ECPGt_EOIT, ECPGt_EORT);
-#line 195 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 195 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 195 "test1.pgc"
-
- { ECPGdo(__LINE__, 0, 1, "pm", "drop table \"Test\" ", ECPGt_EOIT, ECPGt_EORT);
-#line 196 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 196 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 196 "test1.pgc"
-
-
- strcpy(msg, "disconnect");
- { ECPGdisconnect(__LINE__, "main");
-#line 199 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 199 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 199 "test1.pgc"
-
- { ECPGdisconnect(__LINE__, "pm");
-#line 200 "test1.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 200 "test1.pgc"
-
-if (sqlca.sqlcode < 0) PrintAndStop ( msg );}
-#line 200 "test1.pgc"
-
-
- return (0);
-}
diff --git a/src/interfaces/ecpg/test/expected/complex-test1.stderr b/src/interfaces/ecpg/test/expected/complex-test1.stderr
deleted file mode 100644
index 5cee58d9c22..00000000000
--- a/src/interfaces/ecpg/test/expected/complex-test1.stderr
+++ /dev/null
@@ -1,240 +0,0 @@
-[NO_PID]: ECPGdebug: set to 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT> for user regressuser1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 75: QUERY: create table "Test" ( name char ( 8 ) , amount int , letter char ( 1 ) ) on connection main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 75 Ok: CREATE TABLE
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 76: QUERY: create table "Test" ( name char ( 8 ) , amount int , letter char ( 1 ) ) on connection pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 76 Ok: CREATE TABLE
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 79 action = commit connection = main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 80 action = commit connection = pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 87: QUERY: insert into "Test" (name, amount, letter) values ('db: ''r1''', 1, 'f') on connection main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 87 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 91: QUERY: insert into "Test" (name, amount, letter) values ('db: ''r1''', 2, 't') on connection main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 91 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 95: QUERY: insert into "Test" (name, amount, letter) values ('db: ''pm''', 1, 'f') on connection pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 95 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 99: QUERY: insert into "Test" (name, amount, letter) select name, amount+10, letter from "Test" on connection main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 99 Ok: INSERT 0 2
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGprepare line 105: QUERY: insert into "Test" (name, amount, letter) select name, amount+?, letter from "Test"
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 106: QUERY: insert into "Test" (name, amount, letter) select name, amount+100, letter from "Test" on connection pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 106 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 111 action = commit connection = main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGsetcommit line 114 action = on connection = pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 115 action = begin transaction connection = pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 118: QUERY: select * from "Test" on connection main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 118: Correctly got 4 tuples with 3 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 118: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 118: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 118: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 118: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 118: RESULT: 1 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 118: RESULT: 2 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 118: RESULT: 11 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 118: RESULT: 12 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 118: RESULT: f offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 118: RESULT: t offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 118: RESULT: f offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 118: RESULT: t offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 133: QUERY: insert into "Test" ( name , amount , letter ) values( 'db: ''r1''' , 1001 , 'f' ) on connection pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 133 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 133: QUERY: insert into "Test" ( name , amount , letter ) values( 'db: ''r1''' , 1002 , 't' ) on connection pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 133 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 133: QUERY: insert into "Test" ( name , amount , letter ) values( 'db: ''r1''' , 1011 , 'f' ) on connection pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 133 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 133: QUERY: insert into "Test" ( name , amount , letter ) values( 'db: ''r1''' , 1012 , 't' ) on connection pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 133 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 137 action = commit connection = pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGprepare line 141: QUERY: select * from "Test"
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 145: QUERY: declare CUR cursor for select * from "Test" on connection main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 145 Ok: DECLARE CURSOR
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 148: QUERY: fetch 4 in CUR on connection main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 148: Correctly got 4 tuples with 3 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 148: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 148: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 148: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 148: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 148: RESULT: 1 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 148: RESULT: 2 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 148: RESULT: 11 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 148: RESULT: 12 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 148: RESULT: f offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 148: RESULT: t offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 148: RESULT: f offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 148: RESULT: t offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 162: QUERY: close CUR on connection main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 162 Ok: CLOSE CURSOR
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 165: QUERY: select name , amount , letter from "Test" on connection pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 165: Correctly got 6 tuples with 3 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: db: 'pm' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: db: 'pm' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: 1 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: 101 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: 1001 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: 1002 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: 1011 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: 1012 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: f offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: f offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: f offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: t offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: f offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 165: RESULT: t offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 172 action = commit connection = main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 175: QUERY: select name , amount , letter from "Test" on connection pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 175: Correctly got 6 tuples with 3 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: db: 'pm' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: db: 'pm' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: 1 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: 101 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: 1001 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: 1002 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: 1011 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: 1012 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: f offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: f offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: f offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: t offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: f offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 175: RESULT: t offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 183: QUERY: insert into "Test" ( name , amount , letter ) values( 'db: ''r1''' , 1407 , 'f' ) on connection main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 183 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 186: QUERY: select name , amount , letter from "Test" where amount = 1407 on connection main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 186: Correctly got 1 tuples with 3 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 186: RESULT: db: 'r1' offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 186: RESULT: 1407 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 186: RESULT: f offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGsetcommit line 192 action = on connection = main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 195: QUERY: drop table "Test" on connection main
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 195 Ok: DROP TABLE
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 196: QUERY: drop table "Test" on connection pm
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 196 Ok: DROP TABLE
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_finish: Connection main closed.
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_finish: Connection pm closed.
-[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/complex-test1.stdout b/src/interfaces/ecpg/test/expected/complex-test1.stdout
deleted file mode 100644
index abdfde75673..00000000000
--- a/src/interfaces/ecpg/test/expected/complex-test1.stdout
+++ /dev/null
@@ -1,29 +0,0 @@
-New tuple got OID = 0
-Inserted 2 tuples via execute immediate
-Inserted 1 tuples via prepared execute
-Database: main
-name[0]=db: 'r1' amount[0]=1 letter[0]=f
-name[1]=db: 'r1' amount[1]=2 letter[1]=t
-name[2]=db: 'r1' amount[2]=11 letter[2]=f
-name[3]=db: 'r1' amount[3]=12 letter[3]=t
-Database: main
-name[0]=db: 'r1' amount[0]=1 letter[0]=f
-name[1]=db: 'r1' amount[1]=2 letter[1]=t
-name[2]=db: 'r1' amount[2]=11 letter[2]=f
-name[3]=db: 'r1' amount[3]=12 letter[3]=t
-Database: pm
-name[0]=db: 'pm' amount[0]=1 letter[0]=f
-name[1]=db: 'pm' amount[1]=101 letter[1]=f
-name[2]=db: 'r1' amount[2]=1001 letter[2]=f
-name[3]=db: 'r1' amount[3]=1002 letter[3]=t
-name[4]=db: 'r1' amount[4]=1011 letter[4]=f
-name[5]=db: 'r1' amount[5]=1012 letter[5]=t
-Database: pm
-name[0]=db: 'pm' amount[0]=1 letter[0]=f
-name[1]=db: 'pm' amount[1]=101 letter[1]=f
-name[2]=db: 'r1' amount[2]=1001 letter[2]=f
-name[3]=db: 'r1' amount[3]=1002 letter[3]=t
-name[4]=db: 'r1' amount[4]=1011 letter[4]=f
-name[5]=db: 'r1' amount[5]=1012 letter[5]=t
-Database: main
-name[2]=db: 'r1' amount[2]=1407 letter[2]=f
diff --git a/src/interfaces/ecpg/test/expected/complex-test2.c b/src/interfaces/ecpg/test/expected/complex-test2.c
deleted file mode 100644
index eb72606b77d..00000000000
--- a/src/interfaces/ecpg/test/expected/complex-test2.c
+++ /dev/null
@@ -1,430 +0,0 @@
-/* Processed by ecpg (4.2.1) */
-/* These include files are added by the preprocessor */
-#include <ecpgtype.h>
-#include <ecpglib.h>
-#include <ecpgerrno.h>
-#include <sqlca.h>
-/* End of automatic include section */
-
-#line 1 "test2.pgc"
-#include <stdlib.h>
-#include <string.h>
-
-
-#line 1 "header_test.h"
-#include "stdlib.h"
-
-static void
-Finish(char *msg)
-{
- fprintf(stderr, "Error in statement '%s':\n", msg);
- sqlprint();
-
- /* finish transaction */
- { ECPGtrans(__LINE__, NULL, "rollback");}
-#line 10 "header_test.h"
-
-
- /* and remove test table */
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table meskes ", ECPGt_EOIT, ECPGt_EORT);}
-#line 13 "header_test.h"
-
- { ECPGtrans(__LINE__, NULL, "commit");}
-#line 14 "header_test.h"
-
-
- { ECPGdisconnect(__LINE__, "CURRENT");}
-#line 16 "header_test.h"
-
-
- exit(-1);
-}
-
-static void
-warn(void)
-{
- fprintf(stderr, "Warning: At least one column was truncated\n");
-}
-
-/* exec sql whenever sqlerror do Finish ( msg ) ; */
-#line 29 "header_test.h"
-
-/* exec sql whenever sql_warning do warn ( ) ; */
-#line 32 "header_test.h"
-
-
-#line 4 "test2.pgc"
-
-
-#line 1 "regression.h"
-
-
-
-
-
-
-#line 5 "test2.pgc"
-
-
-/* exec sql type c is char reference */
-#line 7 "test2.pgc"
-
-typedef char* c;
-
-/* exec sql type ind is union {
-#line 10 "test2.pgc"
- int integer ;
-
-#line 10 "test2.pgc"
- short smallint ;
- } */
-#line 10 "test2.pgc"
-
-typedef union { int integer; short smallint; } ind;
-
-#define BUFFERSIZ 8
-/* exec sql type str is [ BUFFERSIZ ] */
-#line 14 "test2.pgc"
-
-
-/* declare cur cursor for select name , born , age , married , children from meskes */
-#line 17 "test2.pgc"
-
-
-int
-main (void)
-{
- struct birthinfo {
-#line 22 "test2.pgc"
- long born ;
-
-#line 22 "test2.pgc"
- short age ;
- } ;
-#line 22 "test2.pgc"
-
-/* exec sql begin declare section */
-
-
-
-
-
-
-
-
-
-#line 26 "test2.pgc"
- struct personal_struct {
-#line 24 "test2.pgc"
- struct varchar_name { int len; char arr[ BUFFERSIZ ]; } name ;
-
-#line 25 "test2.pgc"
- struct birthinfo birth ;
- } personal , * p ;
-
-#line 29 "test2.pgc"
- struct personal_indicator {
-#line 27 "test2.pgc"
- int ind_name ;
-
-#line 28 "test2.pgc"
- struct birthinfo ind_birth ;
- } ind_personal , * i ;
-
-#line 30 "test2.pgc"
- ind ind_children ;
-
-#line 31 "test2.pgc"
- char * query = "select name, born, age, married, children from meskes where name = :var1" ;
-/* exec sql end declare section */
-#line 32 "test2.pgc"
-
-
-
-#line 34 "test2.pgc"
- char * married = NULL ;
-
-#line 34 "test2.pgc"
-
-
-#line 35 "test2.pgc"
- long ind_married ;
-
-#line 35 "test2.pgc"
-
-
-#line 36 "test2.pgc"
- ind children ;
-
-#line 36 "test2.pgc"
-
-
- char msg[128];
-
- ECPGdebug(1, stderr);
-
- strcpy(msg, "connect");
- { ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
-#line 43 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 43 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 43 "test2.pgc"
-
-
- strcpy(msg, "create");
- { ECPGdo(__LINE__, 0, 1, NULL, "create table meskes ( name char ( 8 ) , born integer , age smallint , married date , children integer ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 46 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 46 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 46 "test2.pgc"
-
-
- strcpy(msg, "insert");
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , married , children ) values ( 'Petra' , '19900404' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 49 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 49 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 49 "test2.pgc"
-
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age , married , children ) values ( 'Michael' , 19660117 , 35 , '19900404' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 50 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 50 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 50 "test2.pgc"
-
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values ( 'Carsten' , 19910103 , 10 ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 51 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 51 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 51 "test2.pgc"
-
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values ( 'Marc' , 19930907 , 8 ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 52 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 52 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 52 "test2.pgc"
-
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values ( 'Chris' , 19970923 , 4 ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 53 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 53 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 53 "test2.pgc"
-
-
- strcpy(msg, "commit");
- { ECPGtrans(__LINE__, NULL, "commit");
-#line 56 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 56 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 56 "test2.pgc"
-
-
- strcpy(msg, "open");
- { ECPGdo(__LINE__, 0, 1, NULL, "declare cur cursor for select name , born , age , married , children from meskes ", ECPGt_EOIT, ECPGt_EORT);
-#line 59 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 59 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 59 "test2.pgc"
-
-
- /* exec sql whenever not found break ; */
-#line 61 "test2.pgc"
-
-
- p=&personal;
- i=&ind_personal;
- memset(i, 0, sizeof(ind_personal));
- while (1) {
- strcpy(msg, "fetch");
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch cur", ECPGt_EOIT,
- ECPGt_varchar,&(p->name),(long)BUFFERSIZ,(long)1,sizeof(struct varchar_name),
- ECPGt_int,&(i->ind_name),(long)1,(long)1,sizeof(int),
- ECPGt_long,&(p->birth.born),(long)1,(long)1,sizeof(long),
- ECPGt_long,&(i->ind_birth.born),(long)1,(long)1,sizeof(long),
- ECPGt_short,&(p->birth.age),(long)1,(long)1,sizeof(short),
- ECPGt_short,&(i->ind_birth.age),(long)1,(long)1,sizeof(short),
- ECPGt_char,&(married),(long)0,(long)1,(1)*sizeof(char),
- ECPGt_long,&(ind_married),(long)1,(long)1,sizeof(long),
- ECPGt_int,&(children.integer),(long)1,(long)1,sizeof(int),
- ECPGt_short,&(ind_children.smallint),(long)1,(long)1,sizeof(short), ECPGt_EORT);
-#line 68 "test2.pgc"
-
-if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
-#line 68 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 68 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 68 "test2.pgc"
-
- printf("%8.8s", personal.name.arr);
- if (i->ind_birth.born >= 0)
- printf(", born %ld", personal.birth.born);
- if (i->ind_birth.age >= 0)
- printf(", age = %d", personal.birth.age);
- if (ind_married >= 0)
- printf(", married %s", married);
- if (ind_children.smallint >= 0)
- printf(", children = %d", children.integer);
- putchar('\n');
-
- free(married);
- married = NULL;
- }
-
- strcpy(msg, "close");
- { ECPGdo(__LINE__, 0, 1, NULL, "close cur", ECPGt_EOIT, ECPGt_EORT);
-#line 85 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 85 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 85 "test2.pgc"
-
-
- /* and now a same query with prepare */
- { ECPGprepare(__LINE__, "MM" , query);
-#line 88 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 88 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 88 "test2.pgc"
-
- /* declare prep cursor for ? */
-#line 89 "test2.pgc"
-
-
- strcpy(msg, "open");
- { ECPGdo(__LINE__, 0, 1, NULL, "declare prep cursor for ?",
- ECPGt_char_variable,(ECPGprepared_statement("MM")),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_const,"'Petra'",(long)7,(long)1,strlen("'Petra'"),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 92 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 92 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 92 "test2.pgc"
-
-
- /* exec sql whenever not found break ; */
-#line 94 "test2.pgc"
-
-
- while (1) {
- strcpy(msg, "fetch");
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch in prep", ECPGt_EOIT,
- ECPGt_varchar,&(personal.name),(long)BUFFERSIZ,(long)1,sizeof(struct varchar_name),
- ECPGt_int,&(ind_personal.ind_name),(long)1,(long)1,sizeof(int),
- ECPGt_long,&(personal.birth.born),(long)1,(long)1,sizeof(long),
- ECPGt_long,&(ind_personal.ind_birth.born),(long)1,(long)1,sizeof(long),
- ECPGt_short,&(personal.birth.age),(long)1,(long)1,sizeof(short),
- ECPGt_short,&(ind_personal.ind_birth.age),(long)1,(long)1,sizeof(short),
- ECPGt_char,&(married),(long)0,(long)1,(1)*sizeof(char),
- ECPGt_long,&(ind_married),(long)1,(long)1,sizeof(long),
- ECPGt_int,&(children.integer),(long)1,(long)1,sizeof(int),
- ECPGt_short,&(ind_children.smallint),(long)1,(long)1,sizeof(short), ECPGt_EORT);
-#line 98 "test2.pgc"
-
-if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
-#line 98 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 98 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 98 "test2.pgc"
-
- printf("%8.8s", personal.name.arr);
- if (ind_personal.ind_birth.born >= 0)
- printf(", born %ld", personal.birth.born);
- if (ind_personal.ind_birth.age >= 0)
- printf(", age = %d", personal.birth.age);
- if (ind_married >= 0)
- printf(", married %s", married);
- if (ind_children.smallint >= 0)
- printf(", children = %d", children.integer);
- putchar('\n');
- }
-
- free(married);
-
- strcpy(msg, "close");
- { ECPGdo(__LINE__, 0, 1, NULL, "close prep", ECPGt_EOIT, ECPGt_EORT);
-#line 114 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 114 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 114 "test2.pgc"
-
-
- strcpy(msg, "drop");
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table meskes ", ECPGt_EOIT, ECPGt_EORT);
-#line 117 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 117 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 117 "test2.pgc"
-
-
- strcpy(msg, "commit");
- { ECPGtrans(__LINE__, NULL, "commit");
-#line 120 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 120 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 120 "test2.pgc"
-
-
- strcpy(msg, "disconnect");
- { ECPGdisconnect(__LINE__, "CURRENT");
-#line 123 "test2.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 123 "test2.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 123 "test2.pgc"
-
-
- return (0);
-}
diff --git a/src/interfaces/ecpg/test/expected/complex-test2.stderr b/src/interfaces/ecpg/test/expected/complex-test2.stderr
deleted file mode 100644
index 79c1c836bff..00000000000
--- a/src/interfaces/ecpg/test/expected/complex-test2.stderr
+++ /dev/null
@@ -1,164 +0,0 @@
-[NO_PID]: ECPGdebug: set to 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 46: QUERY: create table meskes ( name char ( 8 ) , born integer , age smallint , married date , children integer ) on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 46 Ok: CREATE TABLE
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 49: QUERY: insert into meskes ( name , married , children ) values ( 'Petra' , '19900404' , 3 ) on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 49 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 50: QUERY: insert into meskes ( name , born , age , married , children ) values ( 'Michael' , 19660117 , 35 , '19900404' , 3 ) on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 50 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 51: QUERY: insert into meskes ( name , born , age ) values ( 'Carsten' , 19910103 , 10 ) on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 51 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 52: QUERY: insert into meskes ( name , born , age ) values ( 'Marc' , 19930907 , 8 ) on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 52 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: QUERY: insert into meskes ( name , born , age ) values ( 'Chris' , 19970923 , 4 ) on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 56 action = commit connection = regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 59: QUERY: declare cur cursor for select name , born , age , married , children from meskes on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 59 Ok: DECLARE CURSOR
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 68: QUERY: fetch cur on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 68: Correctly got 1 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: Petra offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGstore_result: line 68: allocating memory for 1 tuples
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: 04-04-1990 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: 3 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 68: QUERY: fetch cur on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 68: Correctly got 1 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: Michael offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: 19660117 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: 35 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGstore_result: line 68: allocating memory for 1 tuples
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: 04-04-1990 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: 3 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 68: QUERY: fetch cur on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 68: Correctly got 1 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: Carsten offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: 19910103 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: 10 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGstore_result: line 68: allocating memory for 1 tuples
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 68: QUERY: fetch cur on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 68: Correctly got 1 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: Marc offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: 19930907 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: 8 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGstore_result: line 68: allocating memory for 1 tuples
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 68: QUERY: fetch cur on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 68: Correctly got 1 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: Chris offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: 19970923 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: 4 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGstore_result: line 68: allocating memory for 1 tuples
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 68: QUERY: fetch cur on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 68: Correctly got 0 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 100 in line 68, 'No data found in line 68.'.
-[NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 85: QUERY: close cur on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 85 Ok: CLOSE CURSOR
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGprepare line 88: QUERY: select name, born, age, married, children from meskes where name = ?
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 92: QUERY: declare prep cursor for select name, born, age, married, children from meskes where name = 'Petra' on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 92 Ok: DECLARE CURSOR
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 98: QUERY: fetch in prep on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 98: Correctly got 1 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 98: RESULT: Petra offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 98: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 98: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGstore_result: line 98: allocating memory for 1 tuples
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 98: RESULT: 04-04-1990 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 98: RESULT: 3 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 98: QUERY: fetch in prep on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 98: Correctly got 0 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 100 in line 98, 'No data found in line 98.'.
-[NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 114: QUERY: close prep on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 114 Ok: CLOSE CURSOR
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 117: QUERY: drop table meskes on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 117 Ok: DROP TABLE
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 120 action = commit connection = regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_finish: Connection regress1 closed.
-[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/complex-test2.stdout b/src/interfaces/ecpg/test/expected/complex-test2.stdout
deleted file mode 100644
index 53d6e8b68f2..00000000000
--- a/src/interfaces/ecpg/test/expected/complex-test2.stdout
+++ /dev/null
@@ -1,6 +0,0 @@
-Petra , married 04-04-1990, children = 3
-Michael , born 19660117, age = 35, married 04-04-1990, children = 3
-Carsten , born 19910103, age = 10
-Marc , born 19930907, age = 8
-Chris , born 19970923, age = 4
-Petra , married 04-04-1990, children = 3
diff --git a/src/interfaces/ecpg/test/expected/complex-test3.c b/src/interfaces/ecpg/test/expected/complex-test3.c
deleted file mode 100644
index ab4c33def1a..00000000000
--- a/src/interfaces/ecpg/test/expected/complex-test3.c
+++ /dev/null
@@ -1,426 +0,0 @@
-/* Processed by ecpg (4.2.1) */
-/* These include files are added by the preprocessor */
-#include <ecpgtype.h>
-#include <ecpglib.h>
-#include <ecpgerrno.h>
-#include <sqlca.h>
-/* End of automatic include section */
-
-#line 1 "test3.pgc"
-/****************************************************************************/
-/* Test comment */
-/*--------------------------------------------------------------------------*/
-
-#line 1 "header_test.h"
-#include "stdlib.h"
-
-static void
-Finish(char *msg)
-{
- fprintf(stderr, "Error in statement '%s':\n", msg);
- sqlprint();
-
- /* finish transaction */
- { ECPGtrans(__LINE__, NULL, "rollback");}
-#line 10 "header_test.h"
-
-
- /* and remove test table */
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table meskes ", ECPGt_EOIT, ECPGt_EORT);}
-#line 13 "header_test.h"
-
- { ECPGtrans(__LINE__, NULL, "commit");}
-#line 14 "header_test.h"
-
-
- { ECPGdisconnect(__LINE__, "CURRENT");}
-#line 16 "header_test.h"
-
-
- exit(-1);
-}
-
-static void
-warn(void)
-{
- fprintf(stderr, "Warning: At least one column was truncated\n");
-}
-
-/* exec sql whenever sqlerror do Finish ( msg ) ; */
-#line 29 "header_test.h"
-
-/* exec sql whenever sql_warning do warn ( ) ; */
-#line 32 "header_test.h"
-
-
-#line 4 "test3.pgc"
-
-
-#line 1 "regression.h"
-
-
-
-
-
-
-#line 5 "test3.pgc"
-
-
-/* exec sql type str is [ 10 ] */
-#line 7 "test3.pgc"
-
-
-#include <stdlib.h>
-#include <string.h>
-
-int
-main (void)
-{
-/* exec sql begin declare section */
- typedef struct {
-#line 16 "test3.pgc"
- long born ;
-
-#line 16 "test3.pgc"
- short age ;
- } birthinfo ;
-
-#line 16 "test3.pgc"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#line 19 "test3.pgc"
- struct personal_struct {
-#line 17 "test3.pgc"
- struct varchar_name { int len; char arr[ 10 ]; } name ;
-
-#line 18 "test3.pgc"
- birthinfo birth ;
- } personal ;
-
-#line 22 "test3.pgc"
- struct personal_indicator {
-#line 20 "test3.pgc"
- int ind_name ;
-
-#line 21 "test3.pgc"
- birthinfo ind_birth ;
- } ind_personal ;
-
-#line 23 "test3.pgc"
- int * ind_married = NULL ;
-
-#line 24 "test3.pgc"
- int children , movevalue = 2 ;
-
-#line 25 "test3.pgc"
- int ind_children ;
-
-#line 26 "test3.pgc"
- struct varchar_married { int len; char arr[ 10 ]; } * married = NULL ;
-
-#line 27 "test3.pgc"
- char * wifesname = "Petra" ;
-
-#line 28 "test3.pgc"
- char * query = "select * from meskes where name = ?" ;
-/* exec sql end declare section */
-#line 29 "test3.pgc"
-
-
- /* declare cur cursor for select name , born , age , married , children from meskes */
-#line 32 "test3.pgc"
-
-
- char msg[128];
-
- ECPGdebug(1, stderr);
-
- strcpy(msg, "connect");
- { ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
-#line 39 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 39 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 39 "test3.pgc"
-
-
- strcpy(msg, "create");
- { ECPGdo(__LINE__, 0, 1, NULL, "create table meskes ( name char ( 8 ) , born integer , age smallint , married date , children integer ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 42 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 42 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 42 "test3.pgc"
-
-
- strcpy(msg, "insert");
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , married , children ) values( ? , '19900404' , 3 ) ",
- ECPGt_char,&(wifesname),(long)0,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 45 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 45 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 45 "test3.pgc"
-
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age , married , children ) values( 'Michael' , 19660117 , 35 , '19900404' , 3 ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 46 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 46 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 46 "test3.pgc"
-
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values( 'Carsten' , 19910103 , 10 ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 47 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 47 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 47 "test3.pgc"
-
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values( 'Marc' , 19930907 , 8 ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 48 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 48 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 48 "test3.pgc"
-
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into meskes ( name , born , age ) values( 'Chris' , 19970923 , 4 ) ", ECPGt_EOIT, ECPGt_EORT);
-#line 49 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 49 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 49 "test3.pgc"
-
-
- strcpy(msg, "commit");
- { ECPGtrans(__LINE__, NULL, "commit");
-#line 52 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 52 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 52 "test3.pgc"
-
-
- strcpy(msg, "open");
- { ECPGdo(__LINE__, 0, 1, NULL, "declare cur cursor for select name , born , age , married , children from meskes ", ECPGt_EOIT, ECPGt_EORT);
-#line 55 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 55 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 55 "test3.pgc"
-
-
- strcpy(msg, "move");
- { ECPGdo(__LINE__, 0, 1, NULL, "move ? in cur",
- ECPGt_int,&(movevalue),(long)1,(long)1,sizeof(int),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 58 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 58 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 58 "test3.pgc"
-
-
- /* exec sql whenever not found break ; */
-#line 60 "test3.pgc"
-
-
- while (1) {
- strcpy(msg, "fetch");
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch from cur", ECPGt_EOIT,
- ECPGt_varchar,&(personal.name),(long)10,(long)1,sizeof(struct varchar_name),
- ECPGt_int,&(ind_personal.ind_name),(long)1,(long)1,sizeof(int),
- ECPGt_long,&(personal.birth.born),(long)1,(long)1,sizeof(long),
- ECPGt_long,&(ind_personal.ind_birth.born),(long)1,(long)1,sizeof(long),
- ECPGt_short,&(personal.birth.age),(long)1,(long)1,sizeof(short),
- ECPGt_short,&(ind_personal.ind_birth.age),(long)1,(long)1,sizeof(short),
- ECPGt_varchar,&(married),(long)10,(long)0,sizeof(struct varchar_married),
- ECPGt_int,&(ind_married),(long)1,(long)0,sizeof(int),
- ECPGt_int,&(children),(long)1,(long)1,sizeof(int),
- ECPGt_int,&(ind_children),(long)1,(long)1,sizeof(int), ECPGt_EORT);
-#line 64 "test3.pgc"
-
-if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
-#line 64 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 64 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 64 "test3.pgc"
-
- printf("%8.8s", personal.name.arr);
- if (ind_personal.ind_birth.born >= 0)
- printf(", born %ld", personal.birth.born);
- if (ind_personal.ind_birth.age >= 0)
- printf(", age = %d", personal.birth.age);
- if (*ind_married >= 0)
- printf(", married %10.10s", married->arr);
- if (ind_children >= 0)
- printf(", children = %d", children);
- putchar('\n');
-
- free(married);
- married = NULL;
- }
-
- strcpy(msg, "close");
- { ECPGdo(__LINE__, 0, 1, NULL, "close cur", ECPGt_EOIT, ECPGt_EORT);
-#line 81 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 81 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 81 "test3.pgc"
-
-
- /* and now a query with prepare */
- { ECPGprepare(__LINE__, "MM" , query);
-#line 84 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 84 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 84 "test3.pgc"
-
- /* declare prep cursor for ? */
-#line 85 "test3.pgc"
-
-
- strcpy(msg, "open");
- { ECPGdo(__LINE__, 0, 1, NULL, "declare prep cursor for ?",
- ECPGt_char_variable,(ECPGprepared_statement("MM")),(long)1,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_char,&(wifesname),(long)0,(long)1,(1)*sizeof(char),
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 88 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 88 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 88 "test3.pgc"
-
-
- /* exec sql whenever not found break ; */
-#line 90 "test3.pgc"
-
-
- while (1) {
- strcpy(msg, "fetch");
- { ECPGdo(__LINE__, 0, 1, NULL, "fetch in prep", ECPGt_EOIT,
- ECPGt_varchar,&(personal.name),(long)10,(long)1,sizeof(struct varchar_name),
- ECPGt_int,&(ind_personal.ind_name),(long)1,(long)1,sizeof(int),
- ECPGt_long,&(personal.birth.born),(long)1,(long)1,sizeof(long),
- ECPGt_long,&(ind_personal.ind_birth.born),(long)1,(long)1,sizeof(long),
- ECPGt_short,&(personal.birth.age),(long)1,(long)1,sizeof(short),
- ECPGt_short,&(ind_personal.ind_birth.age),(long)1,(long)1,sizeof(short),
- ECPGt_varchar,&(married),(long)10,(long)0,sizeof(struct varchar_married),
- ECPGt_int,&(ind_married),(long)1,(long)0,sizeof(int),
- ECPGt_int,&(children),(long)1,(long)1,sizeof(int),
- ECPGt_int,&(ind_children),(long)1,(long)1,sizeof(int), ECPGt_EORT);
-#line 94 "test3.pgc"
-
-if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
-#line 94 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 94 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 94 "test3.pgc"
-
- printf("%8.8s", personal.name.arr);
- if (ind_personal.ind_birth.born >= 0)
- printf(", born %ld", personal.birth.born);
- if (ind_personal.ind_birth.age >= 0)
- printf(", age = %d", personal.birth.age);
- if (*ind_married >= 0)
- printf(", married %10.10s", married->arr);
- if (ind_children >= 0)
- printf(", children = %d", children);
- putchar('\n');
- }
-
- free(married);
-
- strcpy(msg, "close");
- { ECPGdo(__LINE__, 0, 1, NULL, "close prep", ECPGt_EOIT, ECPGt_EORT);
-#line 110 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 110 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 110 "test3.pgc"
-
-
- strcpy(msg, "drop");
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table meskes ", ECPGt_EOIT, ECPGt_EORT);
-#line 113 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 113 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 113 "test3.pgc"
-
-
- strcpy(msg, "commit");
- { ECPGtrans(__LINE__, NULL, "commit");
-#line 116 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 116 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 116 "test3.pgc"
-
-
- strcpy(msg, "disconnect");
- { ECPGdisconnect(__LINE__, "CURRENT");
-#line 119 "test3.pgc"
-
-if (sqlca.sqlwarn[0] == 'W') warn ( );
-#line 119 "test3.pgc"
-
-if (sqlca.sqlcode < 0) Finish ( msg );}
-#line 119 "test3.pgc"
-
-
- return (0);
-}
diff --git a/src/interfaces/ecpg/test/expected/complex-test3.stderr b/src/interfaces/ecpg/test/expected/complex-test3.stderr
deleted file mode 100644
index ea923fab168..00000000000
--- a/src/interfaces/ecpg/test/expected/complex-test3.stderr
+++ /dev/null
@@ -1,136 +0,0 @@
-[NO_PID]: ECPGdebug: set to 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 42: QUERY: create table meskes ( name char ( 8 ) , born integer , age smallint , married date , children integer ) on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 42 Ok: CREATE TABLE
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 45: QUERY: insert into meskes ( name , married , children ) values( 'Petra' , '19900404' , 3 ) on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 45 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 46: QUERY: insert into meskes ( name , born , age , married , children ) values( 'Michael' , 19660117 , 35 , '19900404' , 3 ) on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 46 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 47: QUERY: insert into meskes ( name , born , age ) values( 'Carsten' , 19910103 , 10 ) on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 47 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 48: QUERY: insert into meskes ( name , born , age ) values( 'Marc' , 19930907 , 8 ) on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 48 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 49: QUERY: insert into meskes ( name , born , age ) values( 'Chris' , 19970923 , 4 ) on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 49 Ok: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 52 action = commit connection = regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 55: QUERY: declare cur cursor for select name , born , age , married , children from meskes on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 55 Ok: DECLARE CURSOR
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 58: QUERY: move 2 in cur on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 58 Ok: MOVE 2
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 64: QUERY: fetch from cur on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 64: Correctly got 1 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: Carsten offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: 19910103 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: 10 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGstore_result: line 64: allocating memory for 1 tuples
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 64: QUERY: fetch from cur on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 64: Correctly got 1 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: Marc offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: 19930907 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: 8 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGstore_result: line 64: allocating memory for 1 tuples
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 64: QUERY: fetch from cur on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 64: Correctly got 1 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: Chris offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: 19970923 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: 4 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGstore_result: line 64: allocating memory for 1 tuples
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 64: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 64: QUERY: fetch from cur on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 64: Correctly got 0 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 100 in line 64, 'No data found in line 64.'.
-[NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 81: QUERY: close cur on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 81 Ok: CLOSE CURSOR
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGprepare line 84: QUERY: select * from meskes where name = ?
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 88: QUERY: declare prep cursor for select * from meskes where name = 'Petra' on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 88 Ok: DECLARE CURSOR
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 94: QUERY: fetch in prep on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 94: Correctly got 1 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 94: RESULT: Petra offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 94: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 94: RESULT: offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGstore_result: line 94: allocating memory for 1 tuples
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 94: RESULT: 04-04-1990 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 94: RESULT: 3 offset: -1 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 94: QUERY: fetch in prep on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 94: Correctly got 0 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 100 in line 94, 'No data found in line 94.'.
-[NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 110: QUERY: close prep on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 110 Ok: CLOSE CURSOR
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 113: QUERY: drop table meskes on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 113 Ok: DROP TABLE
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 116 action = commit connection = regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_finish: Connection regress1 closed.
-[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/complex-test3.stdout b/src/interfaces/ecpg/test/expected/complex-test3.stdout
deleted file mode 100644
index 210be871300..00000000000
--- a/src/interfaces/ecpg/test/expected/complex-test3.stdout
+++ /dev/null
@@ -1,4 +0,0 @@
-Carsten , born 19910103, age = 10
-Marc , born 19930907, age = 8
-Chris , born 19970923, age = 4
-Petra , married 04-04-1990, children = 3
diff --git a/src/interfaces/ecpg/test/expected/preproc-comment.c b/src/interfaces/ecpg/test/expected/preproc-comment.c
new file mode 100644
index 00000000000..39d092aa9e8
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-comment.c
@@ -0,0 +1,46 @@
+/* Processed by ecpg (4.2.1) */
+/* These include files are added by the preprocessor */
+#include <ecpgtype.h>
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+
+#line 1 "comment.pgc"
+#include <stdlib.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 3 "comment.pgc"
+
+
+/* just a test comment */ int i;
+/* just a test comment int j*/;
+
+/****************************************************************************/
+/* Test comment */
+/*--------------------------------------------------------------------------*/
+
+// we also understand this style
+int k;
+
+int main(void)
+{
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
+#line 20 "comment.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 22 "comment.pgc"
+
+ exit (0);
+}
+
diff --git a/src/interfaces/ecpg/test/expected/preproc-comment.stderr b/src/interfaces/ecpg/test/expected/preproc-comment.stderr
new file mode 100644
index 00000000000..51fbd68dfd9
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-comment.stderr
@@ -0,0 +1,6 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection regress1 closed.
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/preproc-comment.stdout b/src/interfaces/ecpg/test/expected/preproc-comment.stdout
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-comment.stdout
diff --git a/src/interfaces/ecpg/test/expected/preproc-type.c b/src/interfaces/ecpg/test/expected/preproc-type.c
index 19d443211c4..20e937188c1 100644
--- a/src/interfaces/ecpg/test/expected/preproc-type.c
+++ b/src/interfaces/ecpg/test/expected/preproc-type.c
@@ -164,5 +164,7 @@ main (void)
{ ECPGdisconnect(__LINE__, "CURRENT");}
#line 76 "type.pgc"
+
+ free(ptr);
exit (0);
}
diff --git a/src/interfaces/ecpg/test/expected/preproc-whenever.c b/src/interfaces/ecpg/test/expected/preproc-whenever.c
new file mode 100644
index 00000000000..79983ce2f3d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-whenever.c
@@ -0,0 +1,244 @@
+/* Processed by ecpg (4.2.1) */
+/* These include files are added by the preprocessor */
+#include <ecpgtype.h>
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+
+#line 1 "whenever.pgc"
+#include <stdlib.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 3 "whenever.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 5 "whenever.pgc"
+
+
+static void print(char *msg)
+{
+ fprintf(stderr, "Error in statement '%s':\n", msg);
+ sqlprint();
+}
+
+static void print2(void)
+{
+ fprintf(stderr, "Found another error\n");
+ sqlprint();
+}
+
+static void warn(void)
+{
+ fprintf(stderr, "Warning: At least one column was truncated\n");
+}
+
+int main(void)
+{
+
+#line 26 "whenever.pgc"
+ int i ;
+
+#line 26 "whenever.pgc"
+
+
+#line 27 "whenever.pgc"
+ char c [ 6 ] ;
+
+#line 27 "whenever.pgc"
+
+
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0);
+#line 31 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 31 "whenever.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( i int , c char ( 10 ) ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 32 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 32 "whenever.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "insert into test values ( 1 , 'abcdefghij' ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 33 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 33 "whenever.pgc"
+
+
+ /* exec sql whenever sql_warning do warn ( ) ; */
+#line 35 "whenever.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "select * from test ", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(c),(long)6,(long)1,(6)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 36 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 36 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 36 "whenever.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 37 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 37 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 37 "whenever.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 39 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 39 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 39 "whenever.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 40 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 40 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 40 "whenever.pgc"
+
+
+ /* exec sql whenever sqlerror do print ( \"select\" ) ; */
+#line 42 "whenever.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 43 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 43 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) print ( "select" );}
+#line 43 "whenever.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 44 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 44 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) print ( "select" );}
+#line 44 "whenever.pgc"
+
+
+ /* exec sql whenever sqlerror call print2 ( ) ; */
+#line 46 "whenever.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 47 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 47 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) print2 ( );}
+#line 47 "whenever.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 48 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 48 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) print2 ( );}
+#line 48 "whenever.pgc"
+
+
+ /* exec sql whenever sqlerror continue ; */
+#line 50 "whenever.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 51 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );}
+#line 51 "whenever.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 52 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );}
+#line 52 "whenever.pgc"
+
+
+ /* exec sql whenever sqlerror goto error ; */
+#line 54 "whenever.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 55 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 55 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) goto error;}
+#line 55 "whenever.pgc"
+
+ printf("Should not be reachable\n");
+
+ error:
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 59 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 59 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) goto error;}
+#line 59 "whenever.pgc"
+
+
+ /* exec sql whenever sqlerror stop ; */
+#line 61 "whenever.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "select * from nonexistant ", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 62 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 62 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 62 "whenever.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 63 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 63 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 63 "whenever.pgc"
+
+ exit (0);
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-whenever.stderr b/src/interfaces/ecpg/test/expected/preproc-whenever.stderr
new file mode 100644
index 00000000000..5d50d498328
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-whenever.stderr
@@ -0,0 +1,74 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: QUERY: create table test ( i int , c char ( 10 ) ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32 Ok: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 33: QUERY: insert into test values ( 1 , 'abcdefghij' ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 33 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: QUERY: select * from test on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 36: Correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 36: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 36: RESULT: abcdefghij offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+Warning: At least one column was truncated
+[NO_PID]: ECPGtrans line 37 action = rollback connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: QUERY: select * from nonexistant on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: Error: ERROR: relation "nonexistant" does not exist
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlstate 42P01 (sqlcode: -400) in line 39, ''relation "nonexistant" does not exist' in line 39.'.
+[NO_PID]: sqlca: code: -400, state: 42P01
+sql error 'relation "nonexistant" does not exist' in line 39.
+[NO_PID]: ECPGtrans line 40 action = rollback connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 43: QUERY: select * from nonexistant on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 43: Error: ERROR: relation "nonexistant" does not exist
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlstate 42P01 (sqlcode: -400) in line 43, ''relation "nonexistant" does not exist' in line 43.'.
+[NO_PID]: sqlca: code: -400, state: 42P01
+Error in statement 'select':
+sql error 'relation "nonexistant" does not exist' in line 43.
+[NO_PID]: ECPGtrans line 44 action = rollback connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 47: QUERY: select * from nonexistant on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 47: Error: ERROR: relation "nonexistant" does not exist
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlstate 42P01 (sqlcode: -400) in line 47, ''relation "nonexistant" does not exist' in line 47.'.
+[NO_PID]: sqlca: code: -400, state: 42P01
+Found another error
+sql error 'relation "nonexistant" does not exist' in line 47.
+[NO_PID]: ECPGtrans line 48 action = rollback connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 51: QUERY: select * from nonexistant on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 51: Error: ERROR: relation "nonexistant" does not exist
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlstate 42P01 (sqlcode: -400) in line 51, ''relation "nonexistant" does not exist' in line 51.'.
+[NO_PID]: sqlca: code: -400, state: 42P01
+[NO_PID]: ECPGtrans line 52 action = rollback connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 55: QUERY: select * from nonexistant on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 55: Error: ERROR: relation "nonexistant" does not exist
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlstate 42P01 (sqlcode: -400) in line 55, ''relation "nonexistant" does not exist' in line 55.'.
+[NO_PID]: sqlca: code: -400, state: 42P01
+[NO_PID]: ECPGtrans line 59 action = rollback connection = regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 62: QUERY: select * from nonexistant on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 62: Error: ERROR: relation "nonexistant" does not exist
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlstate 42P01 (sqlcode: -400) in line 62, ''relation "nonexistant" does not exist' in line 62.'.
+[NO_PID]: sqlca: code: -400, state: 42P01
diff --git a/src/interfaces/ecpg/test/expected/preproc-whenever.stdout b/src/interfaces/ecpg/test/expected/preproc-whenever.stdout
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-whenever.stdout
diff --git a/src/interfaces/ecpg/test/expected/sql-execute.c b/src/interfaces/ecpg/test/expected/sql-execute.c
new file mode 100644
index 00000000000..662f554f4ee
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-execute.c
@@ -0,0 +1,278 @@
+/* Processed by ecpg (4.2.1) */
+/* These include files are added by the preprocessor */
+#include <ecpgtype.h>
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+
+#line 1 "execute.pgc"
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 6 "execute.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 8 "execute.pgc"
+
+
+int
+main(void)
+{
+/* exec sql begin declare section */
+
+
+
+
+
+
+#line 14 "execute.pgc"
+ int amount [ 8 ] ;
+
+#line 15 "execute.pgc"
+ int increment = 100 ;
+
+#line 16 "execute.pgc"
+ char name [ 8 ] [ 8 ] ;
+
+#line 17 "execute.pgc"
+ char letter [ 8 ] [ 1 ] ;
+
+#line 18 "execute.pgc"
+ char command [ 128 ] ;
+/* exec sql end declare section */
+#line 19 "execute.pgc"
+
+ int i,j;
+
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , "main", 0);
+#line 24 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 24 "execute.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 25 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 25 "execute.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 26 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 26 "execute.pgc"
+
+
+ sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f')");
+ { ECPGdo(__LINE__, 0, 1, NULL, "?",
+ ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 29 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 29 "execute.pgc"
+
+
+ sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 2, 't')");
+ { ECPGdo(__LINE__, 0, 1, NULL, "?",
+ ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 32 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 32 "execute.pgc"
+
+
+ sprintf(command, "insert into test (name, amount, letter) select name, amount+10, letter from test");
+ { ECPGdo(__LINE__, 0, 1, NULL, "?",
+ ECPGt_char_variable,(command),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 35 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 35 "execute.pgc"
+
+
+ printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
+
+ sprintf(command, "insert into test (name, amount, letter) select name, amount+?, letter from test");
+ { ECPGprepare(__LINE__, "I" , command);
+#line 40 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 40 "execute.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "?",
+ ECPGt_char_variable,(ECPGprepared_statement("I")),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(increment),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 41 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 41 "execute.pgc"
+
+
+ printf("Inserted %ld tuples via prepared execute\n", sqlca.sqlerrd[2]);
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 45 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 45 "execute.pgc"
+
+
+ sprintf (command, "select * from test");
+
+ { ECPGprepare(__LINE__, "F" , command);
+#line 49 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 49 "execute.pgc"
+
+ /* declare CUR cursor for ? */
+#line 50 "execute.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "declare CUR cursor for ?",
+ ECPGt_char_variable,(ECPGprepared_statement("F")),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 52 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 52 "execute.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "fetch 8 in CUR", ECPGt_EOIT,
+ ECPGt_char,(name),(long)8,(long)8,(8)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,(amount),(long)1,(long)8,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(letter),(long)1,(long)8,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 53 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 53 "execute.pgc"
+
+
+ for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
+ {
+ /* exec sql begin declare section */
+
+
+
+#line 58 "execute.pgc"
+ char n [ 8 ] , l = letter [ i ] [ 0 ] ;
+
+#line 59 "execute.pgc"
+ int a = amount [ i ] ;
+/* exec sql end declare section */
+#line 60 "execute.pgc"
+
+
+ strncpy(n, name[i], 8);
+ printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "close CUR", ECPGt_EOIT, ECPGt_EORT);
+#line 66 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 66 "execute.pgc"
+
+
+ sprintf (command, "select * from test where amount = ?");
+
+ { ECPGprepare(__LINE__, "F" , command);
+#line 70 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 70 "execute.pgc"
+
+ /* declare CUR2 cursor for ? */
+#line 71 "execute.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "declare CUR2 cursor for ?",
+ ECPGt_char_variable,(ECPGprepared_statement("F")),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_const,"1",(long)1,(long)1,strlen("1"),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 73 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 73 "execute.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "fetch in CUR2", ECPGt_EOIT,
+ ECPGt_char,(name),(long)8,(long)8,(8)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,(amount),(long)1,(long)8,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(letter),(long)1,(long)8,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 74 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 74 "execute.pgc"
+
+
+ for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
+ {
+ /* exec sql begin declare section */
+
+
+
+#line 79 "execute.pgc"
+ char n [ 8 ] , l = letter [ i ] [ 0 ] ;
+
+#line 80 "execute.pgc"
+ int a = amount [ i ] ;
+/* exec sql end declare section */
+#line 81 "execute.pgc"
+
+
+ strncpy(n, name[i], 8);
+ printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "close CUR2", ECPGt_EOIT, ECPGt_EORT);
+#line 87 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 87 "execute.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
+#line 88 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 88 "execute.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 89 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 89 "execute.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 90 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 90 "execute.pgc"
+
+
+ return (0);
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-execute.stderr b/src/interfaces/ecpg/test/expected/sql-execute.stderr
new file mode 100644
index 00000000000..d98cd7724c1
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-execute.stderr
@@ -0,0 +1,120 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 25: QUERY: create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 25 Ok: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 26 action = commit connection = main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 29: QUERY: insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f') on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 29 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: QUERY: insert into test (name, amount, letter) values ('db: ''r1''', 2, 't') on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35: QUERY: insert into test (name, amount, letter) select name, amount+10, letter from test on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 35 Ok: INSERT 0 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 40: QUERY: insert into test (name, amount, letter) select name, amount+?, letter from test
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 41: QUERY: insert into test (name, amount, letter) select name, amount+100, letter from test on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 41 Ok: INSERT 0 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 45 action = commit connection = main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 49: QUERY: select * from test
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: QUERY: declare CUR cursor for select * from test on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52 Ok: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: QUERY: fetch 8 in CUR on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 53: Correctly got 8 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 2 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 11 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 12 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 101 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 102 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 111 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: 112 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: f offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: t offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: f offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: t offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: f offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: t offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: f offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 53: RESULT: t offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 66: QUERY: close CUR on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 66 Ok: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 70: QUERY: select * from test where amount = ?
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 73: QUERY: declare CUR2 cursor for select * from test where amount = 1 on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 73 Ok: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 74: QUERY: fetch in CUR2 on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 74: Correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 74: RESULT: db: 'r1' offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 74: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 74: RESULT: f offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 87: QUERY: close CUR2 on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 87 Ok: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 88: QUERY: drop table test on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 88 Ok: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans line 89 action = commit connection = main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection main closed.
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-execute.stdout b/src/interfaces/ecpg/test/expected/sql-execute.stdout
new file mode 100644
index 00000000000..1f4d4f25d0d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-execute.stdout
@@ -0,0 +1,11 @@
+Inserted 2 tuples via execute immediate
+Inserted 4 tuples via prepared execute
+name[0]=db: 'r1' amount[0]=1 letter[0]=f
+name[1]=db: 'r1' amount[1]=2 letter[1]=t
+name[2]=db: 'r1' amount[2]=11 letter[2]=f
+name[3]=db: 'r1' amount[3]=12 letter[3]=t
+name[4]=db: 'r1' amount[4]=101 letter[4]=f
+name[5]=db: 'r1' amount[5]=102 letter[5]=t
+name[6]=db: 'r1' amount[6]=111 letter[6]=f
+name[7]=db: 'r1' amount[7]=112 letter[7]=t
+name[0]=db: 'r1' amount[0]=1 letter[0]=f
diff --git a/src/interfaces/ecpg/test/expected/sql-fetch.c b/src/interfaces/ecpg/test/expected/sql-fetch.c
new file mode 100644
index 00000000000..2d6ff974262
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-fetch.c
@@ -0,0 +1,196 @@
+/* Processed by ecpg (4.2.1) */
+/* These include files are added by the preprocessor */
+#include <ecpgtype.h>
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+
+#line 1 "fetch.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 5 "fetch.pgc"
+
+
+int main(int argc, char* argv[]) {
+ /* exec sql begin declare section */
+
+
+
+#line 9 "fetch.pgc"
+ char str [ 25 ] ;
+
+#line 10 "fetch.pgc"
+ int i , how_many = 1 ;
+/* exec sql end declare section */
+#line 11 "fetch.pgc"
+
+
+ ECPGdebug(1, stderr);
+ { ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
+#line 14 "fetch.pgc"
+
+
+ /* exec sql whenever sql_warning sqlprint ; */
+#line 16 "fetch.pgc"
+
+ /* exec sql whenever sqlerror sqlprint ; */
+#line 17 "fetch.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "create table My_Table ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 19 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 19 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 19 "fetch.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 1 , 'text1' ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 21 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 21 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 21 "fetch.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 2 , 'text2' ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 22 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 22 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 22 "fetch.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 3 , 'text3' ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 23 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 23 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 23 "fetch.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values ( 4 , 'text4' ) ", ECPGt_EOIT, ECPGt_EORT);
+#line 24 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 24 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 24 "fetch.pgc"
+
+
+ /* declare C cursor for select * from My_Table */
+#line 26 "fetch.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "declare C cursor for select * from My_Table ", ECPGt_EOIT, ECPGt_EORT);
+#line 28 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 28 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 28 "fetch.pgc"
+
+
+ /* exec sql whenever not found break ; */
+#line 30 "fetch.pgc"
+
+ while (1) {
+ { ECPGdo(__LINE__, 0, 1, NULL, "fetch 1 in C", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(str),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 32 "fetch.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+#line 32 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 32 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 32 "fetch.pgc"
+
+ printf("%d: %s\n", i, str);
+ }
+
+ /* exec sql whenever not found continue ; */
+#line 36 "fetch.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "move backward 2 in C", ECPGt_EOIT, ECPGt_EORT);
+#line 37 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 37 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 37 "fetch.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "fetch ? in C",
+ ECPGt_int,&(how_many),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(str),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 39 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 39 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 39 "fetch.pgc"
+
+ printf("%d: %s\n", i, str);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "close C", ECPGt_EOIT, ECPGt_EORT);
+#line 42 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 42 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 42 "fetch.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "drop table My_Table ", ECPGt_EOIT, ECPGt_EORT);
+#line 44 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 44 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 44 "fetch.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 46 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 46 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 46 "fetch.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-fetch.stderr b/src/interfaces/ecpg/test/expected/sql-fetch.stderr
new file mode 100644
index 00000000000..10f8ec70b7c
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-fetch.stderr
@@ -0,0 +1,88 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 19: QUERY: create table My_Table ( Item1 int , Item2 text ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 19 Ok: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 21: QUERY: insert into My_Table values ( 1 , 'text1' ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 21 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 22: QUERY: insert into My_Table values ( 2 , 'text2' ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 22 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 23: QUERY: insert into My_Table values ( 3 , 'text3' ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 23 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 24: QUERY: insert into My_Table values ( 4 , 'text4' ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 24 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 28: QUERY: declare C cursor for select * from My_Table on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 28 Ok: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: Correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 32: RESULT: 1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 32: RESULT: text1 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: Correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 32: RESULT: 2 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 32: RESULT: text2 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: Correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 32: RESULT: 3 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 32: RESULT: text3 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: Correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 32: RESULT: 4 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 32: RESULT: text4 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: QUERY: fetch 1 in C on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 32: Correctly got 0 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 in line 32, 'No data found in line 32.'.
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ECPGexecute line 37: QUERY: move backward 2 in C on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 37 Ok: MOVE 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: QUERY: fetch 1 in C on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 39: Correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 39: RESULT: 4 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 39: RESULT: text4 offset: -1 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 42: QUERY: close C on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 42 Ok: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 44: QUERY: drop table My_Table on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 44 Ok: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection regress1 closed.
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-fetch.stdout b/src/interfaces/ecpg/test/expected/sql-fetch.stdout
new file mode 100644
index 00000000000..6defd497876
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-fetch.stdout
@@ -0,0 +1,5 @@
+1: text1
+2: text2
+3: text3
+4: text4
+4: text4
diff --git a/src/interfaces/ecpg/test/expected/sql-quote.c b/src/interfaces/ecpg/test/expected/sql-quote.c
index 5c2dceb4d03..5bb9ab005ac 100644
--- a/src/interfaces/ecpg/test/expected/sql-quote.c
+++ b/src/interfaces/ecpg/test/expected/sql-quote.c
@@ -47,7 +47,7 @@ int main(int argc, char* argv[]) {
#line 17 "quote.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "create table My_Table ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, "create table \"My_Table\" ( Item1 int , Item2 text ) ", ECPGt_EOIT, ECPGt_EORT);
#line 19 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
@@ -71,7 +71,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
printf("Standard conforming strings: %s\n", var);
/* this is a\\b actually */
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 25 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
@@ -81,7 +81,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
#line 25 "quote.pgc"
/* this is a\b */
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 27 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
@@ -102,7 +102,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
/* this is a\\b actually */
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 32 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
@@ -112,7 +112,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "quote.pgc"
/* this is a\b */
- { ECPGdo(__LINE__, 0, 1, NULL, "insert into My_Table values( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, "insert into \"My_Table\" values ( 1 , 'a\\\\b' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 34 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
@@ -122,7 +122,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
#line 34 "quote.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "select * from My_Table ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, "select * from \"My_Table\" ", ECPGt_EOIT, ECPGt_EORT);
#line 36 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
@@ -132,7 +132,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
#line 36 "quote.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, "drop table My_Table ", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, "drop table \"My_Table\" ", ECPGt_EOIT, ECPGt_EORT);
#line 38 "quote.pgc"
if (sqlca.sqlwarn[0] == 'W') sqlprint();
diff --git a/src/interfaces/ecpg/test/expected/sql-quote.stderr b/src/interfaces/ecpg/test/expected/sql-quote.stderr
index d8f56421fbf..cb70c7676ca 100644
--- a/src/interfaces/ecpg/test/expected/sql-quote.stderr
+++ b/src/interfaces/ecpg/test/expected/sql-quote.stderr
@@ -4,7 +4,7 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGsetcommit line 15 action = on connection = regress1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 19: QUERY: create table My_Table ( Item1 int , Item2 text ) on connection regress1
+[NO_PID]: ECPGexecute line 19: QUERY: create table "My_Table" ( Item1 int , Item2 text ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 19 Ok: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000
@@ -14,7 +14,7 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGget_data line 21: RESULT: off offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 25: QUERY: insert into My_Table values( 1 , 'a\\b' ) on connection regress1
+[NO_PID]: ECPGexecute line 25: QUERY: insert into "My_Table" values ( 1 , 'a\\b' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: nonstandard use of \\ in a string literal[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 0
@@ -22,7 +22,7 @@
[NO_PID]: ECPGexecute line 25 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 22P06
sql error nonstandard use of \\ in a string literal
-[NO_PID]: ECPGexecute line 27: QUERY: insert into My_Table values( 1 , 'a\\b' ) on connection regress1
+[NO_PID]: ECPGexecute line 27: QUERY: insert into "My_Table" values ( 1 , 'a\\b' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: nonstandard use of \\ in a string literal[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 0
@@ -34,22 +34,22 @@ sql error nonstandard use of \\ in a string literal
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 29 Ok: SET
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 32: QUERY: insert into My_Table values( 1 , 'a\\b' ) on connection regress1
+[NO_PID]: ECPGexecute line 32: QUERY: insert into "My_Table" values ( 1 , 'a\\b' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 32 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 34: QUERY: insert into My_Table values( 1 , 'a\\b' ) on connection regress1
+[NO_PID]: ECPGexecute line 34: QUERY: insert into "My_Table" values ( 1 , 'a\\b' ) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 34 Ok: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 36: QUERY: select * from My_Table on connection regress1
+[NO_PID]: ECPGexecute line 36: QUERY: select * from "My_Table" on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 36: Correctly got 4 tuples with 2 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode -202 in line 36, 'Too few arguments in line 36.'.
[NO_PID]: sqlca: code: -202, state: 07002
sql error Too few arguments in line 36.
-[NO_PID]: ECPGexecute line 38: QUERY: drop table My_Table on connection regress1
+[NO_PID]: ECPGexecute line 38: QUERY: drop table "My_Table" on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGexecute line 38 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/pg_regress.sh b/src/interfaces/ecpg/test/pg_regress.sh
index 000e4f6676e..a896042d53b 100644
--- a/src/interfaces/ecpg/test/pg_regress.sh
+++ b/src/interfaces/ecpg/test/pg_regress.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.12 2006/09/05 12:17:09 meskes Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.13 2006/09/08 13:32:27 meskes Exp $
me=`basename $0`
@@ -710,7 +710,6 @@ rm -f regression.diffs
for i in \
connect/*.pgc \
compat_informix/*.pgc \
- complex/*.pgc \
preproc/*.pgc \
pgtypeslib/*.pgc \
sql/*.pgc \
diff --git a/src/interfaces/ecpg/test/preproc/Makefile b/src/interfaces/ecpg/test/preproc/Makefile
index 005bc335988..937f89ca52a 100644
--- a/src/interfaces/ecpg/test/preproc/Makefile
+++ b/src/interfaces/ecpg/test/preproc/Makefile
@@ -4,10 +4,12 @@ include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/$(subdir)/../Makefile.regress
-TESTS = define define.c \
+TESTS = comment comment.c \
+ define define.c \
init init.c \
type type.c \
- variable variable.c
+ variable variable.c \
+ whenever whenever.c
all: $(TESTS)
diff --git a/src/interfaces/ecpg/test/preproc/comment.pgc b/src/interfaces/ecpg/test/preproc/comment.pgc
new file mode 100644
index 00000000000..5ef3b695ee5
--- /dev/null
+++ b/src/interfaces/ecpg/test/preproc/comment.pgc
@@ -0,0 +1,25 @@
+#include <stdlib.h>
+
+exec sql include ../regression;
+
+/* just a test comment */ int i;
+/* just a test comment int j*/;
+
+/****************************************************************************/
+/* Test comment */
+/*--------------------------------------------------------------------------*/
+
+// we also understand this style
+int k;
+
+int main(void)
+{
+ ECPGdebug(1, stderr);
+
+ exec sql --this is a comment too
+ connect to REGRESSDB1;
+
+ exec sql disconnect;
+ exit (0);
+}
+
diff --git a/src/interfaces/ecpg/test/preproc/type.pgc b/src/interfaces/ecpg/test/preproc/type.pgc
index 33ebcb77bb8..461401c8ee8 100644
--- a/src/interfaces/ecpg/test/preproc/type.pgc
+++ b/src/interfaces/ecpg/test/preproc/type.pgc
@@ -74,5 +74,7 @@ main (void)
printf ("id=%ld name='%s' accs=%d str='%s' ptr='%s' vc='%10.10s'\n", empl.idnum, empl.name, empl.accs, str, ptr, vc.text);
EXEC SQL disconnect;
+
+ free(ptr);
exit (0);
}
diff --git a/src/interfaces/ecpg/test/preproc/whenever.pgc b/src/interfaces/ecpg/test/preproc/whenever.pgc
new file mode 100644
index 00000000000..ad563278044
--- /dev/null
+++ b/src/interfaces/ecpg/test/preproc/whenever.pgc
@@ -0,0 +1,65 @@
+#include <stdlib.h>
+
+exec sql include ../regression;
+
+exec sql whenever sqlerror sqlprint;
+
+static void print(char *msg)
+{
+ fprintf(stderr, "Error in statement '%s':\n", msg);
+ sqlprint();
+}
+
+static void print2(void)
+{
+ fprintf(stderr, "Found another error\n");
+ sqlprint();
+}
+
+static void warn(void)
+{
+ fprintf(stderr, "Warning: At least one column was truncated\n");
+}
+
+int main(void)
+{
+ exec sql int i;
+ exec sql char c[6];
+
+ ECPGdebug(1, stderr);
+
+ exec sql connect to REGRESSDB1;
+ exec sql create table test(i int, c char(10));
+ exec sql insert into test values(1, 'abcdefghij');
+
+ exec sql whenever sqlwarning do warn();
+ exec sql select * into :i, :c from test;
+ exec sql rollback;
+
+ exec sql select * into :i from nonexistant;
+ exec sql rollback;
+
+ exec sql whenever sqlerror do print("select");
+ exec sql select * into :i from nonexistant;
+ exec sql rollback;
+
+ exec sql whenever sqlerror call print2();
+ exec sql select * into :i from nonexistant;
+ exec sql rollback;
+
+ exec sql whenever sqlerror continue;
+ exec sql select * into :i from nonexistant;
+ exec sql rollback;
+
+ exec sql whenever sqlerror goto error;
+ exec sql select * into :i from nonexistant;
+ printf("Should not be reachable\n");
+
+ error:
+ exec sql rollback;
+
+ exec sql whenever sqlerror stop;
+ exec sql select * into :i from nonexistant;
+ exec sql rollback;
+ exit (0);
+}
diff --git a/src/interfaces/ecpg/test/sql/Makefile b/src/interfaces/ecpg/test/sql/Makefile
index f44ec6a297c..2a05359400e 100644
--- a/src/interfaces/ecpg/test/sql/Makefile
+++ b/src/interfaces/ecpg/test/sql/Makefile
@@ -12,6 +12,8 @@ TESTS = array array.c \
dyntest dyntest.c \
dynalloc dynalloc.c \
dynalloc2 dynalloc2.c \
+ execute execute.c \
+ fetch fetch.c \
func func.c \
indicators indicators.c \
quote quote.c \
diff --git a/src/interfaces/ecpg/test/sql/execute.pgc b/src/interfaces/ecpg/test/sql/execute.pgc
new file mode 100644
index 00000000000..5c23bb36a49
--- /dev/null
+++ b/src/interfaces/ecpg/test/sql/execute.pgc
@@ -0,0 +1,93 @@
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+exec sql include ../regression;
+
+exec sql whenever sqlerror sqlprint;
+
+int
+main(void)
+{
+exec sql begin declare section;
+ int amount[8];
+ int increment=100;
+ char name[8][8];
+ char letter[8][1];
+ char command[128];
+exec sql end declare section;
+ int i,j;
+
+ ECPGdebug(1, stderr);
+
+ exec sql connect to REGRESSDB1 as main;
+ exec sql create table test (name char(8), amount int, letter char(1));
+ exec sql commit;
+
+ sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f')");
+ exec sql execute immediate :command;
+
+ sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 2, 't')");
+ exec sql execute immediate :command;
+
+ sprintf(command, "insert into test (name, amount, letter) select name, amount+10, letter from test");
+ exec sql execute immediate :command;
+
+ printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
+
+ sprintf(command, "insert into test (name, amount, letter) select name, amount+?, letter from test");
+ exec sql prepare I from :command;
+ exec sql execute I using :increment;
+
+ printf("Inserted %ld tuples via prepared execute\n", sqlca.sqlerrd[2]);
+
+ exec sql commit;
+
+ sprintf (command, "select * from test");
+
+ exec sql prepare F from :command;
+ exec sql declare CUR cursor for F;
+
+ exec sql open CUR;
+ exec sql fetch 8 in CUR into :name, :amount, :letter;
+
+ for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
+ {
+ exec sql begin declare section;
+ char n[8], l = letter[i][0];
+ int a = amount[i];
+ exec sql end declare section;
+
+ strncpy(n, name[i], 8);
+ printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
+ }
+
+ exec sql close CUR;
+
+ sprintf (command, "select * from test where amount = ?");
+
+ exec sql prepare F from :command;
+ exec sql declare CUR2 cursor for F;
+
+ exec sql open CUR2 using 1;
+ exec sql fetch in CUR2 into :name, :amount, :letter;
+
+ for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
+ {
+ exec sql begin declare section;
+ char n[8], l = letter[i][0];
+ int a = amount[i];
+ exec sql end declare section;
+
+ strncpy(n, name[i], 8);
+ printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
+ }
+
+ exec sql close CUR2;
+ exec sql drop table test;
+ exec sql commit;
+ exec sql disconnect;
+
+ return (0);
+}
diff --git a/src/interfaces/ecpg/test/sql/fetch.pgc b/src/interfaces/ecpg/test/sql/fetch.pgc
new file mode 100644
index 00000000000..936a4f8cd2d
--- /dev/null
+++ b/src/interfaces/ecpg/test/sql/fetch.pgc
@@ -0,0 +1,49 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+EXEC SQL INCLUDE ../regression;
+
+int main(int argc, char* argv[]) {
+ EXEC SQL BEGIN DECLARE SECTION;
+ char str[25];
+ int i, how_many = 1;
+ EXEC SQL END DECLARE SECTION;
+
+ ECPGdebug(1, stderr);
+ EXEC SQL CONNECT TO REGRESSDB1;
+
+ EXEC SQL WHENEVER SQLWARNING SQLPRINT;
+ EXEC SQL WHENEVER SQLERROR SQLPRINT;
+
+ EXEC SQL CREATE TABLE My_Table ( Item1 int, Item2 text );
+
+ EXEC SQL INSERT INTO My_Table VALUES ( 1, 'text1');
+ EXEC SQL INSERT INTO My_Table VALUES ( 2, 'text2');
+ EXEC SQL INSERT INTO My_Table VALUES ( 3, 'text3');
+ EXEC SQL INSERT INTO My_Table VALUES ( 4, 'text4');
+
+ EXEC SQL DECLARE C CURSOR FOR SELECT * FROM My_Table;
+
+ EXEC SQL OPEN C;
+
+ EXEC SQL WHENEVER NOT FOUND DO BREAK;
+ while (1) {
+ EXEC SQL FETCH 1 IN C INTO :i, :str;
+ printf("%d: %s\n", i, str);
+ }
+
+ EXEC SQL WHENEVER NOT FOUND CONTINUE;
+ EXEC SQL MOVE BACKWARD 2 IN C;
+
+ EXEC SQL FETCH :how_many IN C INTO :i, :str;
+ printf("%d: %s\n", i, str);
+
+ EXEC SQL CLOSE C;
+
+ EXEC SQL DROP TABLE My_Table;
+
+ EXEC SQL DISCONNECT ALL;
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/sql/quote.pgc b/src/interfaces/ecpg/test/sql/quote.pgc
index 244c628edcd..1349a181941 100644
--- a/src/interfaces/ecpg/test/sql/quote.pgc
+++ b/src/interfaces/ecpg/test/sql/quote.pgc
@@ -16,26 +16,26 @@ int main(int argc, char* argv[]) {
EXEC SQL WHENEVER SQLWARNING SQLPRINT;
EXEC SQL WHENEVER SQLERROR SQLPRINT;
- EXEC SQL CREATE TABLE My_Table ( Item1 int, Item2 text );
+ EXEC SQL CREATE TABLE "My_Table" ( Item1 int, Item2 text );
EXEC SQL SHOW standard_conforming_strings INTO :var;
printf("Standard conforming strings: %s\n", var);
/* this is a\\b actually */
- EXEC SQL INSERT INTO My_Table VALUES ( 1, 'a\\\\b' );
+ EXEC SQL INSERT INTO "My_Table" VALUES ( 1, 'a\\\\b' );
/* this is a\b */
- EXEC SQL INSERT INTO My_Table VALUES ( 1, E'a\\\\b' );
+ EXEC SQL INSERT INTO "My_Table" VALUES ( 1, E'a\\\\b' );
EXEC SQL SET standard_conforming_strings TO on;
/* this is a\\b actually */
- EXEC SQL INSERT INTO My_Table VALUES ( 1, 'a\\\\b' );
+ EXEC SQL INSERT INTO "My_Table" VALUES ( 1, 'a\\\\b' );
/* this is a\b */
- EXEC SQL INSERT INTO My_Table VALUES ( 1, E'a\\\\b' );
+ EXEC SQL INSERT INTO "My_Table" VALUES ( 1, E'a\\\\b' );
- EXEC SQL SELECT * FROM My_Table;
+ EXEC SQL SELECT * FROM "My_Table";
- EXEC SQL DROP TABLE My_Table;
+ EXEC SQL DROP TABLE "My_Table";
EXEC SQL DISCONNECT ALL;