summaryrefslogtreecommitdiffstats
path: root/src/interfaces/ecpg/test/expected
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
commit46651ce6fe013220ed397add242004d764fc0153 (patch)
tree6e5299f990f88e60174a1d3ae6e48eedd2688b2b /src/interfaces/ecpg/test/expected
parentInitial commit. (diff)
downloadpostgresql-14-upstream.tar.xz
postgresql-14-upstream.zip
Adding upstream version 14.5.upstream/14.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/interfaces/ecpg/test/expected')
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-charfuncs.c42
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-charfuncs.stderr0
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-charfuncs.stdout6
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-dec_test.c291
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-dec_test.stderr2
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-dec_test.stdout1293
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-describe.c467
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-describe.stderr112
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-describe.stdout24
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c186
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.stderr2
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.stdout36
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c84
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.stderr2
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.stdout10
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-rnull.c293
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-rnull.stderr124
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-rnull.stdout22
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-sqlda.c530
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-sqlda.stderr340
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-sqlda.stdout48
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-test_informix.c259
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr133
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-test_informix.stdout10
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c290
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-test_informix2.stderr64
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-test_informix2.stdout2
-rw-r--r--src/interfaces/ecpg/test/expected/compat_oracle-char_array.c223
-rw-r--r--src/interfaces/ecpg/test/expected/compat_oracle-char_array.stderr139
-rw-r--r--src/interfaces/ecpg/test/expected/compat_oracle-char_array.stdout10
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test1-minGW32.stderr73
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test1.c124
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test1.stderr73
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test1.stdout0
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test2.c104
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test2.stderr52
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test2.stdout0
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test3.c106
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test3.stderr38
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test3.stdout0
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test4.c44
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test4.stderr6
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test4.stdout0
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test5.c158
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test5.stderr80
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test5.stdout0
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c469
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stderr48
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stdout52
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c186
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stderr2
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout122
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c266
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.stderr360
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.stdout16
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c202
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr32
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stdout8
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c290
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stderr2
-rw-r--r--src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stdout1117
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-array_of_struct.c288
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-array_of_struct.stderr86
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-array_of_struct.stdout25
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-autoprep.c256
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-autoprep.stderr320
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-autoprep.stdout18
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-comment.c42
-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-cursor.c859
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-cursor.stderr412
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-cursor.stdout24
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-define.c184
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-define.stderr54
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-define.stdout2
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-describe.c481
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-describe.stderr140
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-describe.stdout4
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-init.c261
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-init.stderr14
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-init.stdout10
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-outofscope.c372
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-outofscope.stderr114
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-outofscope.stdout3
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.c293
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.stderr86
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.stdout25
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-strings.c82
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-strings.stderr56
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-strings.stdout2
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-type.c170
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-type.stderr40
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-type.stdout1
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-variable.c276
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-variable.stderr168
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-variable.stdout5
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-whenever.c246
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-whenever.stderr104
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-whenever.stdout0
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.c164
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.stderr112
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.stdout2
-rw-r--r--src/interfaces/ecpg/test/expected/sql-array.c355
-rw-r--r--src/interfaces/ecpg/test/expected/sql-array.stderr130
-rw-r--r--src/interfaces/ecpg/test/expected/sql-array.stdout13
-rw-r--r--src/interfaces/ecpg/test/expected/sql-binary.c230
-rw-r--r--src/interfaces/ecpg/test/expected/sql-binary.stderr102
-rw-r--r--src/interfaces/ecpg/test/expected/sql-binary.stdout3
-rw-r--r--src/interfaces/ecpg/test/expected/sql-bytea.c373
-rw-r--r--src/interfaces/ecpg/test/expected/sql-bytea.stderr191
-rw-r--r--src/interfaces/ecpg/test/expected/sql-bytea.stdout9
-rw-r--r--src/interfaces/ecpg/test/expected/sql-code100.c164
-rw-r--r--src/interfaces/ecpg/test/expected/sql-code100.stderr128
-rw-r--r--src/interfaces/ecpg/test/expected/sql-code100.stdout0
-rw-r--r--src/interfaces/ecpg/test/expected/sql-copystdout.c150
-rw-r--r--src/interfaces/ecpg/test/expected/sql-copystdout.stderr38
-rw-r--r--src/interfaces/ecpg/test/expected/sql-copystdout.stdout4
-rw-r--r--src/interfaces/ecpg/test/expected/sql-createtableas.c164
-rw-r--r--src/interfaces/ecpg/test/expected/sql-createtableas.stderr66
-rw-r--r--src/interfaces/ecpg/test/expected/sql-createtableas.stdout2
-rw-r--r--src/interfaces/ecpg/test/expected/sql-declare.c618
-rw-r--r--src/interfaces/ecpg/test/expected/sql-declare.stderr266
-rw-r--r--src/interfaces/ecpg/test/expected/sql-declare.stdout18
-rw-r--r--src/interfaces/ecpg/test/expected/sql-define.c205
-rw-r--r--src/interfaces/ecpg/test/expected/sql-define.stderr52
-rw-r--r--src/interfaces/ecpg/test/expected/sql-define.stdout1
-rw-r--r--src/interfaces/ecpg/test/expected/sql-desc.c377
-rw-r--r--src/interfaces/ecpg/test/expected/sql-desc.stderr140
-rw-r--r--src/interfaces/ecpg/test/expected/sql-desc.stdout4
-rw-r--r--src/interfaces/ecpg/test/expected/sql-describe.c465
-rw-r--r--src/interfaces/ecpg/test/expected/sql-describe.stderr112
-rw-r--r--src/interfaces/ecpg/test/expected/sql-describe.stdout24
-rw-r--r--src/interfaces/ecpg/test/expected/sql-dynalloc.c340
-rw-r--r--src/interfaces/ecpg/test/expected/sql-dynalloc.stderr102
-rw-r--r--src/interfaces/ecpg/test/expected/sql-dynalloc.stdout4
-rw-r--r--src/interfaces/ecpg/test/expected/sql-dynalloc2.c256
-rw-r--r--src/interfaces/ecpg/test/expected/sql-dynalloc2.stderr98
-rw-r--r--src/interfaces/ecpg/test/expected/sql-dynalloc2.stdout8
-rw-r--r--src/interfaces/ecpg/test/expected/sql-dyntest.c486
-rw-r--r--src/interfaces/ecpg/test/expected/sql-dyntest.stderr390
-rw-r--r--src/interfaces/ecpg/test/expected/sql-dyntest.stdout43
-rw-r--r--src/interfaces/ecpg/test/expected/sql-execute.c331
-rw-r--r--src/interfaces/ecpg/test/expected/sql-execute.stderr172
-rw-r--r--src/interfaces/ecpg/test/expected/sql-execute.stdout12
-rw-r--r--src/interfaces/ecpg/test/expected/sql-fetch.c237
-rw-r--r--src/interfaces/ecpg/test/expected/sql-fetch.stderr142
-rw-r--r--src/interfaces/ecpg/test/expected/sql-fetch.stdout6
-rw-r--r--src/interfaces/ecpg/test/expected/sql-func.c170
-rw-r--r--src/interfaces/ecpg/test/expected/sql-func.stderr76
-rw-r--r--src/interfaces/ecpg/test/expected/sql-func.stdout1
-rw-r--r--src/interfaces/ecpg/test/expected/sql-indicators.c189
-rw-r--r--src/interfaces/ecpg/test/expected/sql-indicators.stderr88
-rw-r--r--src/interfaces/ecpg/test/expected/sql-indicators.stdout3
-rw-r--r--src/interfaces/ecpg/test/expected/sql-insupd.c145
-rw-r--r--src/interfaces/ecpg/test/expected/sql-insupd.stderr74
-rw-r--r--src/interfaces/ecpg/test/expected/sql-insupd.stdout7
-rw-r--r--src/interfaces/ecpg/test/expected/sql-oldexec.c251
-rw-r--r--src/interfaces/ecpg/test/expected/sql-oldexec.stderr154
-rw-r--r--src/interfaces/ecpg/test/expected/sql-oldexec.stdout11
-rw-r--r--src/interfaces/ecpg/test/expected/sql-parser.c126
-rw-r--r--src/interfaces/ecpg/test/expected/sql-parser.stderr50
-rw-r--r--src/interfaces/ecpg/test/expected/sql-parser.stdout3
-rw-r--r--src/interfaces/ecpg/test/expected/sql-prepareas.c664
-rw-r--r--src/interfaces/ecpg/test/expected/sql-prepareas.stderr0
-rw-r--r--src/interfaces/ecpg/test/expected/sql-prepareas.stdout66
-rw-r--r--src/interfaces/ecpg/test/expected/sql-quote.c230
-rw-r--r--src/interfaces/ecpg/test/expected/sql-quote.stderr135
-rw-r--r--src/interfaces/ecpg/test/expected/sql-quote.stdout6
-rw-r--r--src/interfaces/ecpg/test/expected/sql-show.c170
-rw-r--r--src/interfaces/ecpg/test/expected/sql-show.stderr76
-rw-r--r--src/interfaces/ecpg/test/expected/sql-show.stdout5
-rw-r--r--src/interfaces/ecpg/test/expected/sql-sqlda.c545
-rw-r--r--src/interfaces/ecpg/test/expected/sql-sqlda.stderr460
-rw-r--r--src/interfaces/ecpg/test/expected/sql-sqlda.stdout84
-rw-r--r--src/interfaces/ecpg/test/expected/sql-twophase.c114
-rw-r--r--src/interfaces/ecpg/test/expected/sql-twophase.stderr34
-rw-r--r--src/interfaces/ecpg/test/expected/sql-twophase.stdout0
-rw-r--r--src/interfaces/ecpg/test/expected/thread-alloc.c218
-rw-r--r--src/interfaces/ecpg/test/expected/thread-alloc.stderr0
-rw-r--r--src/interfaces/ecpg/test/expected/thread-alloc.stdout0
-rw-r--r--src/interfaces/ecpg/test/expected/thread-alloc_2.stdout1
-rw-r--r--src/interfaces/ecpg/test/expected/thread-descriptor.c161
-rw-r--r--src/interfaces/ecpg/test/expected/thread-descriptor.stderr0
-rw-r--r--src/interfaces/ecpg/test/expected/thread-descriptor.stdout0
-rw-r--r--src/interfaces/ecpg/test/expected/thread-prep.c259
-rw-r--r--src/interfaces/ecpg/test/expected/thread-prep.stderr0
-rw-r--r--src/interfaces/ecpg/test/expected/thread-prep.stdout1
-rw-r--r--src/interfaces/ecpg/test/expected/thread-prep_2.stdout0
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread.c216
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread.stderr0
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread.stdout1
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread_2.stdout1
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread_implicit.c216
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread_implicit.stderr0
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread_implicit.stdout1
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread_implicit_2.stdout1
197 files changed, 26925 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-charfuncs.c b/src/interfaces/ecpg/test/expected/compat_informix-charfuncs.c
new file mode 100644
index 0000000..86b71a4
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-charfuncs.c
@@ -0,0 +1,42 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* Needed for informix compatibility */
+#include <ecpg_informix.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "charfuncs.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <sqltypes.h>
+
+int main(void)
+{
+ char t1[] = "abc def ghi ";
+ /* 123456789012345 */
+ char buf[50];
+ int k;
+
+ printf("t1: _%s_\n", t1);
+ rupshift(t1);
+ printf("t1: _%s_\n", t1);
+
+ k = 2;
+ ldchar(t1, k, buf);
+ printf("byleng(t1, %d): %d, ldchar: _%s_\n", k, byleng(t1, k), buf);
+ k = 5;
+ ldchar(t1, k, buf);
+ printf("byleng(t1, %d): %d, ldchar: _%s_\n", k, byleng(t1, k), buf);
+ k = 9;
+ ldchar(t1, k, buf);
+ printf("byleng(t1, %d): %d, ldchar: _%s_\n", k, byleng(t1, k), buf);
+ k = 15;
+ ldchar(t1, k, buf);
+ printf("byleng(t1, %d): %d, ldchar: _%s_\n", k, byleng(t1, k), buf);
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-charfuncs.stderr b/src/interfaces/ecpg/test/expected/compat_informix-charfuncs.stderr
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-charfuncs.stderr
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-charfuncs.stdout b/src/interfaces/ecpg/test/expected/compat_informix-charfuncs.stdout
new file mode 100644
index 0000000..a177579
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-charfuncs.stdout
@@ -0,0 +1,6 @@
+t1: _abc def ghi _
+t1: _ABC DEF GHI _
+byleng(t1, 2): 2, ldchar: _AB_
+byleng(t1, 5): 3, ldchar: _ABC_
+byleng(t1, 9): 8, ldchar: _ABC DEF_
+byleng(t1, 15): 13, ldchar: _ABC DEF GHI_
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c b/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c
new file mode 100644
index 0000000..8586650
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c
@@ -0,0 +1,291 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* Needed for informix compatibility */
+#include <ecpg_informix.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "dec_test.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <pgtypes_numeric.h>
+#include <pgtypes_error.h>
+#include <decimal.h>
+#include <sqltypes.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 8 "dec_test.pgc"
+
+
+
+#line 1 "printf_hack.h"
+/*
+ * print_double(x) has the same effect as printf("%g", x), but is intended
+ * to produce the same formatting across all platforms.
+ */
+static void
+print_double(double x)
+{
+#ifdef WIN32
+ /* Change Windows' 3-digit exponents to look like everyone else's */
+ char convert[128];
+ int vallen;
+
+ sprintf(convert, "%g", x);
+ vallen = strlen(convert);
+
+ if (vallen >= 6 &&
+ convert[vallen - 5] == 'e' &&
+ convert[vallen - 3] == '0')
+ {
+ convert[vallen - 3] = convert[vallen - 2];
+ convert[vallen - 2] = convert[vallen - 1];
+ convert[vallen - 1] = '\0';
+ }
+
+ printf("%s", convert);
+#else
+ printf("%g", x);
+#endif
+}
+
+#line 10 "dec_test.pgc"
+
+
+
+/*
+TODO:
+ deccmp => DECUNKNOWN
+ decimal point: , and/or . ?
+ ECPG_INFORMIX_BAD_EXPONENT ?
+*/
+
+char* decs[] = { "2E394", "-2", ".794", "3.44", "592.49E21", "-32.84e4",
+ "2E-394", ".1E-2", "+.0", "-592.49E-07", "+32.84e-4",
+ ".500001", "-.5000001",
+ "1234567890123456789012345678.91", /* 30 digits should fit
+ into decimal */
+ "1234567890123456789012345678.921", /* 31 digits should NOT
+ fit into decimal */
+ "not a number",
+ NULL};
+
+
+static void
+check_errno(void);
+
+#define BUFSIZE 200
+
+int
+main(void)
+{
+ decimal *dec, *din;
+ char buf[BUFSIZE];
+ long l;
+ int i, j, k, q, r, count = 0;
+ double dbl;
+ decimal **decarr = (decimal **) calloc(1, sizeof(decimal));
+
+ ECPGdebug(1, stderr);
+
+ for (i = 0; decs[i]; i++)
+ {
+ dec = PGTYPESdecimal_new();
+ r = deccvasc(decs[i], strlen(decs[i]), dec);
+ if (r)
+ {
+ check_errno();
+ printf("dec[%d,0]: r: %d\n", i, r);
+ PGTYPESdecimal_free(dec);
+ continue;
+ }
+ decarr = realloc(decarr, sizeof(decimal *) * (count + 1));
+ decarr[count++] = dec;
+
+ r = dectoasc(dec, buf, BUFSIZE-1, -1);
+ if (r < 0) check_errno();
+ printf("dec[%d,1]: r: %d, %s\n", i, r, buf);
+
+ r = dectoasc(dec, buf, BUFSIZE-1, 0);
+ if (r < 0) check_errno();
+ printf("dec[%d,2]: r: %d, %s\n", i, r, buf);
+ r = dectoasc(dec, buf, BUFSIZE-1, 1);
+ if (r < 0) check_errno();
+ printf("dec[%d,3]: r: %d, %s\n", i, r, buf);
+ r = dectoasc(dec, buf, BUFSIZE-1, 2);
+ if (r < 0) check_errno();
+ printf("dec[%d,4]: r: %d, %s\n", i, r, buf);
+
+ din = PGTYPESdecimal_new();
+ r = dectoasc(din, buf, BUFSIZE-1, 2);
+ if (r < 0) check_errno();
+ printf("dec[%d,5]: r: %d, %s\n", i, r, buf);
+
+ r = dectolong(dec, &l);
+ if (r) check_errno();
+ printf("dec[%d,6]: %ld (r: %d)\n", i, r?0L:l, r);
+ if (r == 0)
+ {
+ r = deccvlong(l, din);
+ if (r) check_errno();
+ dectoasc(din, buf, BUFSIZE-1, 2);
+ q = deccmp(dec, din);
+ printf("dec[%d,7]: %s (r: %d - cmp: %d)\n", i, buf, r, q);
+ }
+
+ r = dectoint(dec, &k);
+ if (r) check_errno();
+ printf("dec[%d,8]: %d (r: %d)\n", i, r?0:k, r);
+ if (r == 0)
+ {
+ r = deccvint(k, din);
+ if (r) check_errno();
+ dectoasc(din, buf, BUFSIZE-1, 2);
+ q = deccmp(dec, din);
+ printf("dec[%d,9]: %s (r: %d - cmp: %d)\n", i, buf, r, q);
+ }
+
+ if (i != 6)
+ {
+ /* underflow does not work reliable on several archs, so not testing it here */
+ /* this is a libc problem since we only call strtod() */
+ r = dectodbl(dec, &dbl);
+ if (r) check_errno();
+ printf("dec[%d,10]: ", i);
+ print_double(r ? 0.0 : dbl);
+ printf(" (r: %d)\n", r);
+ }
+
+ PGTYPESdecimal_free(din);
+ printf("\n");
+ }
+
+ /* add a NULL value */
+ dec = PGTYPESdecimal_new();
+ decarr = realloc(decarr, sizeof(decimal *) * (count + 1));
+ decarr[count++] = dec;
+
+ rsetnull(CDECIMALTYPE, (char *) decarr[count-1]);
+ printf("dec[%d]: %sNULL\n", count-1,
+ risnull(CDECIMALTYPE, (char *) decarr[count-1]) ? "" : "NOT ");
+ printf("dec[0]: %sNULL\n",
+ risnull(CDECIMALTYPE, (char *) decarr[0]) ? "" : "NOT ");
+
+ r = dectoasc(decarr[3], buf, -1, -1);
+ check_errno(); printf("dectoasc with len == -1: r: %d\n", r);
+ r = dectoasc(decarr[3], buf, 0, -1);
+ check_errno(); printf("dectoasc with len == 0: r: %d\n", r);
+
+ for (i = 0; i < count; i++)
+ {
+ for (j = 0; j < count; j++)
+ {
+ decimal a, s, m, d;
+ int c;
+ c = deccmp(decarr[i], decarr[j]);
+ printf("dec[c,%d,%d]: %d\n", i, j, c);
+
+ r = decadd(decarr[i], decarr[j], &a);
+ if (r)
+ {
+ check_errno();
+ printf("r: %d\n", r);
+ }
+ else
+ {
+ dectoasc(&a, buf, BUFSIZE-1, -1);
+ printf("dec[a,%d,%d]: %s\n", i, j, buf);
+ }
+
+ r = decsub(decarr[i], decarr[j], &s);
+ if (r)
+ {
+ check_errno();
+ printf("r: %d\n", r);
+ }
+ else
+ {
+ dectoasc(&s, buf, BUFSIZE-1, -1);
+ printf("dec[s,%d,%d]: %s\n", i, j, buf);
+ }
+
+ r = decmul(decarr[i], decarr[j], &m);
+ if (r)
+ {
+ check_errno();
+ printf("r: %d\n", r);
+ }
+ else
+ {
+ dectoasc(&m, buf, BUFSIZE-1, -1);
+ printf("dec[m,%d,%d]: %s\n", i, j, buf);
+ }
+
+ r = decdiv(decarr[i], decarr[j], &d);
+ if (r)
+ {
+ check_errno();
+ printf("r: %d\n", r);
+ }
+ else
+ {
+ dectoasc(&d, buf, BUFSIZE-1, -1);
+ printf("dec[d,%d,%d]: %s\n", i, j, buf);
+ }
+ }
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ dectoasc(decarr[i], buf, BUFSIZE-1, -1);
+ printf("%d: %s\n", i, buf);
+
+ PGTYPESdecimal_free(decarr[i]);
+ }
+ free(decarr);
+
+ return 0;
+}
+
+static void
+check_errno(void)
+{
+ switch(errno)
+ {
+ case 0:
+ printf("(no errno set) - ");
+ break;
+ case ECPG_INFORMIX_NUM_OVERFLOW:
+ printf("(errno == ECPG_INFORMIX_NUM_OVERFLOW) - ");
+ break;
+ case ECPG_INFORMIX_NUM_UNDERFLOW:
+ printf("(errno == ECPG_INFORMIX_NUM_UNDERFLOW) - ");
+ break;
+ case PGTYPES_NUM_OVERFLOW:
+ printf("(errno == PGTYPES_NUM_OVERFLOW) - ");
+ break;
+ case PGTYPES_NUM_UNDERFLOW:
+ printf("(errno == PGTYPES_NUM_UNDERFLOW) - ");
+ break;
+ case PGTYPES_NUM_BAD_NUMERIC:
+ printf("(errno == PGTYPES_NUM_BAD_NUMERIC) - ");
+ break;
+ case PGTYPES_NUM_DIVIDE_ZERO:
+ printf("(errno == PGTYPES_NUM_DIVIDE_ZERO) - ");
+ break;
+ default:
+ printf("(unknown errno (%d))\n", errno);
+ printf("(libc: (%s)) ", strerror(errno));
+ break;
+ }
+}
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-dec_test.stderr b/src/interfaces/ecpg/test/expected/compat_informix-dec_test.stderr
new file mode 100644
index 0000000..1a3639d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-dec_test.stderr
@@ -0,0 +1,2 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-dec_test.stdout b/src/interfaces/ecpg/test/expected/compat_informix-dec_test.stdout
new file mode 100644
index 0000000..1f8675b
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-dec_test.stdout
@@ -0,0 +1,1293 @@
+(no errno set) - dec[0,1]: r: -1, *
+(no errno set) - dec[0,2]: r: -1, *
+(no errno set) - dec[0,3]: r: -1, *
+(no errno set) - dec[0,4]: r: -1, *
+dec[0,5]: r: 0, 0.00
+(errno == PGTYPES_NUM_OVERFLOW) - dec[0,6]: 0 (r: -1)
+(errno == PGTYPES_NUM_OVERFLOW) - dec[0,8]: 0 (r: -1)
+(errno == PGTYPES_NUM_OVERFLOW) - dec[0,10]: 0 (r: -1)
+
+dec[1,1]: r: 0, -2
+dec[1,2]: r: 0, -2
+dec[1,3]: r: 0, -2.0
+dec[1,4]: r: 0, -2.00
+dec[1,5]: r: 0, 0.00
+dec[1,6]: -2 (r: 0)
+dec[1,7]: -2.00 (r: 0 - cmp: 0)
+dec[1,8]: -2 (r: 0)
+dec[1,9]: -2.00 (r: 0 - cmp: 0)
+dec[1,10]: -2 (r: 0)
+
+dec[2,1]: r: 0, 0.794
+dec[2,2]: r: 0, 1
+dec[2,3]: r: 0, 0.8
+dec[2,4]: r: 0, 0.79
+dec[2,5]: r: 0, 0.00
+dec[2,6]: 1 (r: 0)
+dec[2,7]: 1.00 (r: 0 - cmp: -1)
+dec[2,8]: 1 (r: 0)
+dec[2,9]: 1.00 (r: 0 - cmp: -1)
+dec[2,10]: 0.794 (r: 0)
+
+dec[3,1]: r: 0, 3.44
+dec[3,2]: r: 0, 3
+dec[3,3]: r: 0, 3.4
+dec[3,4]: r: 0, 3.44
+dec[3,5]: r: 0, 0.00
+dec[3,6]: 3 (r: 0)
+dec[3,7]: 3.00 (r: 0 - cmp: 1)
+dec[3,8]: 3 (r: 0)
+dec[3,9]: 3.00 (r: 0 - cmp: 1)
+dec[3,10]: 3.44 (r: 0)
+
+dec[4,1]: r: 0, 592490000000000000000000
+dec[4,2]: r: 0, 592490000000000000000000
+dec[4,3]: r: 0, 592490000000000000000000.0
+dec[4,4]: r: 0, 592490000000000000000000.00
+dec[4,5]: r: 0, 0.00
+(errno == PGTYPES_NUM_OVERFLOW) - dec[4,6]: 0 (r: -1)
+(errno == PGTYPES_NUM_OVERFLOW) - dec[4,8]: 0 (r: -1)
+dec[4,10]: 5.9249e+23 (r: 0)
+
+dec[5,1]: r: 0, -328400
+dec[5,2]: r: 0, -328400
+dec[5,3]: r: 0, -328400.0
+dec[5,4]: r: 0, -328400.00
+dec[5,5]: r: 0, 0.00
+dec[5,6]: -328400 (r: 0)
+dec[5,7]: -328400.00 (r: 0 - cmp: 0)
+dec[5,8]: -328400 (r: 0)
+dec[5,9]: -328400.00 (r: 0 - cmp: 0)
+dec[5,10]: -328400 (r: 0)
+
+(no errno set) - dec[6,1]: r: -1, *
+dec[6,2]: r: 0, 0
+dec[6,3]: r: 0, 0.0
+dec[6,4]: r: 0, 0.00
+dec[6,5]: r: 0, 0.00
+dec[6,6]: 0 (r: 0)
+dec[6,7]: 0.00 (r: 0 - cmp: 1)
+dec[6,8]: 0 (r: 0)
+dec[6,9]: 0.00 (r: 0 - cmp: 1)
+
+dec[7,1]: r: 0, 0.001
+dec[7,2]: r: 0, 0
+dec[7,3]: r: 0, 0.0
+dec[7,4]: r: 0, 0.00
+dec[7,5]: r: 0, 0.00
+dec[7,6]: 0 (r: 0)
+dec[7,7]: 0.00 (r: 0 - cmp: 1)
+dec[7,8]: 0 (r: 0)
+dec[7,9]: 0.00 (r: 0 - cmp: 1)
+dec[7,10]: 0.001 (r: 0)
+
+dec[8,1]: r: 0, 0.0
+dec[8,2]: r: 0, 0
+dec[8,3]: r: 0, 0.0
+dec[8,4]: r: 0, 0.00
+dec[8,5]: r: 0, 0.00
+dec[8,6]: 0 (r: 0)
+dec[8,7]: 0.00 (r: 0 - cmp: 0)
+dec[8,8]: 0 (r: 0)
+dec[8,9]: 0.00 (r: 0 - cmp: 0)
+dec[8,10]: 0 (r: 0)
+
+dec[9,1]: r: 0, -0.000059249
+dec[9,2]: r: 0, -0
+dec[9,3]: r: 0, -0.0
+dec[9,4]: r: 0, -0.00
+dec[9,5]: r: 0, 0.00
+dec[9,6]: 0 (r: 0)
+dec[9,7]: 0.00 (r: 0 - cmp: -1)
+dec[9,8]: 0 (r: 0)
+dec[9,9]: 0.00 (r: 0 - cmp: -1)
+dec[9,10]: -5.9249e-05 (r: 0)
+
+dec[10,1]: r: 0, 0.003284
+dec[10,2]: r: 0, 0
+dec[10,3]: r: 0, 0.0
+dec[10,4]: r: 0, 0.00
+dec[10,5]: r: 0, 0.00
+dec[10,6]: 0 (r: 0)
+dec[10,7]: 0.00 (r: 0 - cmp: 1)
+dec[10,8]: 0 (r: 0)
+dec[10,9]: 0.00 (r: 0 - cmp: 1)
+dec[10,10]: 0.003284 (r: 0)
+
+dec[11,1]: r: 0, 0.500001
+dec[11,2]: r: 0, 1
+dec[11,3]: r: 0, 0.5
+dec[11,4]: r: 0, 0.50
+dec[11,5]: r: 0, 0.00
+dec[11,6]: 1 (r: 0)
+dec[11,7]: 1.00 (r: 0 - cmp: -1)
+dec[11,8]: 1 (r: 0)
+dec[11,9]: 1.00 (r: 0 - cmp: -1)
+dec[11,10]: 0.500001 (r: 0)
+
+dec[12,1]: r: 0, -0.5000001
+dec[12,2]: r: 0, -1
+dec[12,3]: r: 0, -0.5
+dec[12,4]: r: 0, -0.50
+dec[12,5]: r: 0, 0.00
+dec[12,6]: -1 (r: 0)
+dec[12,7]: -1.00 (r: 0 - cmp: 1)
+dec[12,8]: -1 (r: 0)
+dec[12,9]: -1.00 (r: 0 - cmp: 1)
+dec[12,10]: -0.5 (r: 0)
+
+dec[13,1]: r: 0, 1234567890123456789012345678.91
+dec[13,2]: r: 0, 1234567890123456789012345679
+dec[13,3]: r: 0, 1234567890123456789012345678.9
+dec[13,4]: r: 0, 1234567890123456789012345678.91
+dec[13,5]: r: 0, 0.00
+(errno == PGTYPES_NUM_OVERFLOW) - dec[13,6]: 0 (r: -1)
+(errno == PGTYPES_NUM_OVERFLOW) - dec[13,8]: 0 (r: -1)
+dec[13,10]: 1.23457e+27 (r: 0)
+
+(errno == PGTYPES_NUM_OVERFLOW) - dec[14,0]: r: -1200
+(errno == PGTYPES_NUM_BAD_NUMERIC) - dec[15,0]: r: -1213
+dec[14]: NULL
+dec[0]: NOT NULL
+(errno == PGTYPES_NUM_BAD_NUMERIC) - dectoasc with len == -1: r: -1
+(errno == PGTYPES_NUM_BAD_NUMERIC) - dectoasc with len == 0: r: -1
+dec[c,0,0]: 0
+dec[a,0,0]: *
+dec[s,0,0]: 0
+dec[m,0,0]: *
+dec[d,0,0]: 1.00000000000000000
+dec[c,0,1]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,0,1]:
+dec[m,0,1]: *
+dec[d,0,1]: *
+dec[c,0,2]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,0,2]:
+dec[m,0,2]: *
+dec[d,0,2]:
+dec[c,0,3]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,0,3]:
+dec[m,0,3]: *
+dec[d,0,3]:
+dec[c,0,4]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,0,4]:
+dec[m,0,4]: *
+dec[d,0,4]:
+dec[c,0,5]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,0,5]:
+dec[m,0,5]: *
+dec[d,0,5]:
+dec[c,0,6]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,0,6]:
+dec[m,0,6]: *
+dec[d,0,6]: *
+dec[c,0,7]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,0,7]:
+dec[m,0,7]: *
+dec[d,0,7]: *
+dec[c,0,8]: 1
+dec[a,0,8]: *
+dec[s,0,8]: *
+dec[m,0,8]: 0.0
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,0,9]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,0,9]:
+dec[m,0,9]: *
+dec[d,0,9]:
+dec[c,0,10]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,0,10]:
+dec[m,0,10]: *
+dec[d,0,10]:
+dec[c,0,11]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,0,11]:
+dec[m,0,11]: *
+dec[d,0,11]:
+dec[c,0,12]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,0,12]:
+dec[m,0,12]: *
+dec[d,0,12]:
+dec[c,0,13]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,0,13]:
+dec[m,0,13]: *
+dec[d,0,13]:
+dec[c,0,14]: 2147483647
+dec[a,0,14]:
+dec[s,0,14]:
+dec[m,0,14]: *
+dec[d,0,14]:
+dec[c,1,0]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,1,0]:
+dec[m,1,0]: *
+dec[d,1,0]: *
+dec[c,1,1]: 0
+dec[a,1,1]: -4
+dec[s,1,1]: 0
+dec[m,1,1]: 4
+dec[d,1,1]: 1.00000000000000000
+dec[c,1,2]: -1
+dec[a,1,2]: -1.206
+dec[s,1,2]: -2.794
+dec[m,1,2]: -1.588
+dec[d,1,2]: -2.5188916876574307
+dec[c,1,3]: -1
+dec[a,1,3]: 1.44
+dec[s,1,3]: -5.44
+dec[m,1,3]: -6.88
+dec[d,1,3]: -0.58139534883720930
+dec[c,1,4]: -1
+dec[a,1,4]: 592489999999999999999998
+dec[s,1,4]: -592490000000000000000002
+dec[m,1,4]: -1184980000000000000000000
+dec[d,1,4]: -0.0000000000000000000000033755843980489122
+dec[c,1,5]: 1
+dec[a,1,5]: -328402
+dec[s,1,5]: 328398
+dec[m,1,5]: 656800
+dec[d,1,5]: 0.0000060901339829476248
+dec[c,1,6]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,1,6]:
+dec[m,1,6]: *
+dec[d,1,6]: *
+dec[c,1,7]: -1
+dec[a,1,7]: -1.999
+dec[s,1,7]: -2.001
+dec[m,1,7]: -0.002
+dec[d,1,7]: -2000.0000000000000
+dec[c,1,8]: -1
+dec[a,1,8]: -2.0
+dec[s,1,8]: -2.0
+dec[m,1,8]: 0.0
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,1,9]: -1
+dec[a,1,9]: -2.000059249
+dec[s,1,9]: -1.999940751
+dec[m,1,9]: 0.000118498
+dec[d,1,9]: 33755.843980489122
+dec[c,1,10]: -1
+dec[a,1,10]: -1.996716
+dec[s,1,10]: -2.003284
+dec[m,1,10]: -0.006568
+dec[d,1,10]: -609.01339829476248
+dec[c,1,11]: -1
+dec[a,1,11]: -1.499999
+dec[s,1,11]: -2.500001
+dec[m,1,11]: -1.000002
+dec[d,1,11]: -3.9999920000160000
+dec[c,1,12]: -1
+dec[a,1,12]: -2.5000001
+dec[s,1,12]: -1.4999999
+dec[m,1,12]: 1.0000002
+dec[d,1,12]: 3.9999992000001600
+dec[c,1,13]: -1
+dec[a,1,13]: 1234567890123456789012345676.91
+dec[s,1,13]: -1234567890123456789012345680.91
+dec[m,1,13]: -2469135780246913578024691357.82
+dec[d,1,13]: -0.0000000000000000000000000016200000145800001
+dec[c,1,14]: 2147483647
+dec[a,1,14]: 1234567890123456789012345676.91
+dec[s,1,14]: -1234567890123456789012345680.91
+dec[m,1,14]: -2469135780246913578024691357.82
+dec[d,1,14]: -0.0000000000000000000000000016200000145800001
+dec[c,2,0]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,2,0]:
+dec[m,2,0]: *
+dec[d,2,0]: *
+dec[c,2,1]: 1
+dec[a,2,1]: -1.206
+dec[s,2,1]: 2.794
+dec[m,2,1]: -1.588
+dec[d,2,1]: -0.39700000000000000
+dec[c,2,2]: 0
+dec[a,2,2]: 1.588
+dec[s,2,2]: 0.000
+dec[m,2,2]: 0.630436
+dec[d,2,2]: 1.00000000000000000
+dec[c,2,3]: -1
+dec[a,2,3]: 4.234
+dec[s,2,3]: -2.646
+dec[m,2,3]: 2.73136
+dec[d,2,3]: 0.23081395348837209
+dec[c,2,4]: -1
+dec[a,2,4]: 592490000000000000000000.794
+dec[s,2,4]: -592489999999999999999999.206
+dec[m,2,4]: 470437060000000000000000.000
+dec[d,2,4]: 0.0000000000000000000000013401070060254182
+dec[c,2,5]: 1
+dec[a,2,5]: -328399.206
+dec[s,2,5]: 328400.794
+dec[m,2,5]: -260749.600
+dec[d,2,5]: -0.0000024177831912302071
+dec[c,2,6]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,2,6]:
+dec[m,2,6]: *
+dec[d,2,6]: *
+dec[c,2,7]: 1
+dec[a,2,7]: 0.795
+dec[s,2,7]: 0.793
+dec[m,2,7]: 0.000794
+dec[d,2,7]: 794.00000000000000
+dec[c,2,8]: 1
+dec[a,2,8]: 0.794
+dec[s,2,8]: 0.794
+dec[m,2,8]: 0.0000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,2,9]: 1
+dec[a,2,9]: 0.793940751
+dec[s,2,9]: 0.794059249
+dec[m,2,9]: -0.000047043706
+dec[d,2,9]: -13401.070060254182
+dec[c,2,10]: 1
+dec[a,2,10]: 0.797284
+dec[s,2,10]: 0.790716
+dec[m,2,10]: 0.002607496
+dec[d,2,10]: 241.77831912302071
+dec[c,2,11]: 1
+dec[a,2,11]: 1.294001
+dec[s,2,11]: 0.293999
+dec[m,2,11]: 0.397000794
+dec[d,2,11]: 1.5879968240063520
+dec[c,2,12]: 1
+dec[a,2,12]: 0.2939999
+dec[s,2,12]: 1.2940001
+dec[m,2,12]: -0.3970000794
+dec[d,2,12]: -1.5879996824000635
+dec[c,2,13]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,2,13]:
+dec[m,2,13]:
+dec[d,2,13]: 0.00000000000000000000000000064314000578826005
+dec[c,2,14]: 2147483647
+dec[a,2,14]:
+dec[s,2,14]:
+dec[m,2,14]:
+dec[d,2,14]: 0.00000000000000000000000000064314000578826005
+dec[c,3,0]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,3,0]:
+dec[m,3,0]: *
+dec[d,3,0]: *
+dec[c,3,1]: 1
+dec[a,3,1]: 1.44
+dec[s,3,1]: 5.44
+dec[m,3,1]: -6.88
+dec[d,3,1]: -1.7200000000000000
+dec[c,3,2]: 1
+dec[a,3,2]: 4.234
+dec[s,3,2]: 2.646
+dec[m,3,2]: 2.73136
+dec[d,3,2]: 4.3324937027707809
+dec[c,3,3]: 0
+dec[a,3,3]: 6.88
+dec[s,3,3]: 0.00
+dec[m,3,3]: 11.8336
+dec[d,3,3]: 1.00000000000000000
+dec[c,3,4]: -1
+dec[a,3,4]: 592490000000000000000003.44
+dec[s,3,4]: -592489999999999999999996.56
+dec[m,3,4]: 2038165600000000000000000.00
+dec[d,3,4]: 0.0000000000000000000000058060051646441290
+dec[c,3,5]: 1
+dec[a,3,5]: -328396.56
+dec[s,3,5]: 328403.44
+dec[m,3,5]: -1129696.00
+dec[d,3,5]: -0.0000104750304506699147
+dec[c,3,6]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,3,6]:
+dec[m,3,6]: *
+dec[d,3,6]: *
+dec[c,3,7]: 1
+dec[a,3,7]: 3.441
+dec[s,3,7]: 3.439
+dec[m,3,7]: 0.00344
+dec[d,3,7]: 3440.0000000000000
+dec[c,3,8]: 1
+dec[a,3,8]: 3.44
+dec[s,3,8]: 3.44
+dec[m,3,8]: 0.000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,3,9]: 1
+dec[a,3,9]: 3.439940751
+dec[s,3,9]: 3.440059249
+dec[m,3,9]: -0.00020381656
+dec[d,3,9]: -58060.051646441290
+dec[c,3,10]: 1
+dec[a,3,10]: 3.443284
+dec[s,3,10]: 3.436716
+dec[m,3,10]: 0.01129696
+dec[d,3,10]: 1047.50304506699147
+dec[c,3,11]: 1
+dec[a,3,11]: 3.940001
+dec[s,3,11]: 2.939999
+dec[m,3,11]: 1.72000344
+dec[d,3,11]: 6.8799862400275199
+dec[c,3,12]: 1
+dec[a,3,12]: 2.9399999
+dec[s,3,12]: 3.9400001
+dec[m,3,12]: -1.720000344
+dec[d,3,12]: -6.8799986240002752
+dec[c,3,13]: -1
+dec[a,3,13]: 1234567890123456789012345682.35
+dec[s,3,13]: -1234567890123456789012345675.47
+dec[m,3,13]:
+dec[d,3,13]: 0.0000000000000000000000000027864000250776002
+dec[c,3,14]: 2147483647
+dec[a,3,14]: 1234567890123456789012345682.35
+dec[s,3,14]: -1234567890123456789012345675.47
+dec[m,3,14]:
+dec[d,3,14]: 0.0000000000000000000000000027864000250776002
+dec[c,4,0]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,4,0]:
+dec[m,4,0]: *
+dec[d,4,0]: *
+dec[c,4,1]: 1
+dec[a,4,1]: 592489999999999999999998
+dec[s,4,1]: 592490000000000000000002
+dec[m,4,1]: -1184980000000000000000000
+dec[d,4,1]: -296245000000000000000000
+dec[c,4,2]: 1
+dec[a,4,2]: 592490000000000000000000.794
+dec[s,4,2]: 592489999999999999999999.206
+dec[m,4,2]: 470437060000000000000000.000
+dec[d,4,2]:
+dec[c,4,3]: 1
+dec[a,4,3]: 592490000000000000000003.44
+dec[s,4,3]: 592489999999999999999996.56
+dec[m,4,3]: 2038165600000000000000000.00
+dec[d,4,3]: 172235465116279069767441.86
+dec[c,4,4]: 0
+dec[a,4,4]: 1184980000000000000000000
+dec[s,4,4]: 0
+dec[m,4,4]: 351044400100000000000000000000000000000000000000
+dec[d,4,4]: 1.00000000000000000
+dec[c,4,5]: 1
+dec[a,4,5]: 592489999999999999671600
+dec[s,4,5]: 592490000000000000328400
+dec[m,4,5]: -194573716000000000000000000000
+dec[d,4,5]: -1804171741778319123
+dec[c,4,6]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,4,6]:
+dec[m,4,6]: *
+dec[d,4,6]: *
+dec[c,4,7]: 1
+dec[a,4,7]: 592490000000000000000000.001
+dec[s,4,7]: 592489999999999999999999.999
+dec[m,4,7]: 592490000000000000000.000
+dec[d,4,7]: 592490000000000000000000000.000
+dec[c,4,8]: 1
+dec[a,4,8]: 592490000000000000000000.0
+dec[s,4,8]: 592490000000000000000000.0
+dec[m,4,8]: 0.0
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,4,9]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,4,9]:
+dec[m,4,9]: -35104440010000000000.000000000
+dec[d,4,9]: -10000000000000000000000000000.000000000
+dec[c,4,10]: 1
+dec[a,4,10]: 592490000000000000000000.003284
+dec[s,4,10]: 592489999999999999999999.996716
+dec[m,4,10]: 1945737160000000000000.000000
+dec[d,4,10]:
+dec[c,4,11]: 1
+dec[a,4,11]: 592490000000000000000000.500001
+dec[s,4,11]: 592489999999999999999999.499999
+dec[m,4,11]: 296245592490000000000000.000000
+dec[d,4,11]:
+dec[c,4,12]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,4,12]:
+dec[m,4,12]: -296245059249000000000000.0000000
+dec[d,4,12]:
+dec[c,4,13]: -1
+dec[a,4,13]: 1235160380123456789012345678.91
+dec[s,4,13]: -1233975400123456789012345678.91
+dec[m,4,13]:
+dec[d,4,13]: 0.00047991690431925214
+dec[c,4,14]: 2147483647
+dec[a,4,14]: 1235160380123456789012345678.91
+dec[s,4,14]: -1233975400123456789012345678.91
+dec[m,4,14]:
+dec[d,4,14]: 0.00047991690431925214
+dec[c,5,0]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,5,0]:
+dec[m,5,0]: *
+dec[d,5,0]: *
+dec[c,5,1]: -1
+dec[a,5,1]: -328402
+dec[s,5,1]: -328398
+dec[m,5,1]: 656800
+dec[d,5,1]: 164200.00000000000
+dec[c,5,2]: -1
+dec[a,5,2]: -328399.206
+dec[s,5,2]: -328400.794
+dec[m,5,2]: -260749.600
+dec[d,5,2]: -413602.01511335013
+dec[c,5,3]: -1
+dec[a,5,3]: -328396.56
+dec[s,5,3]: -328403.44
+dec[m,5,3]: -1129696.00
+dec[d,5,3]: -95465.116279069767
+dec[c,5,4]: -1
+dec[a,5,4]: 592489999999999999671600
+dec[s,5,4]: -592490000000000000328400
+dec[m,5,4]: -194573716000000000000000000000
+dec[d,5,4]: -0.00000000000000000055427095815963139
+dec[c,5,5]: 0
+dec[a,5,5]: -656800
+dec[s,5,5]: 0
+dec[m,5,5]: 107846560000
+dec[d,5,5]: 1.00000000000000000
+dec[c,5,6]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,5,6]:
+dec[m,5,6]: *
+dec[d,5,6]: *
+dec[c,5,7]: -1
+dec[a,5,7]: -328399.999
+dec[s,5,7]: -328400.001
+dec[m,5,7]: -328.400
+dec[d,5,7]: -328400000.00000000
+dec[c,5,8]: -1
+dec[a,5,8]: -328400.0
+dec[s,5,8]: -328400.0
+dec[m,5,8]: 0.0
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,5,9]: -1
+dec[a,5,9]: -328400.000059249
+dec[s,5,9]: -328399.999940751
+dec[m,5,9]: 19.457371600
+dec[d,5,9]: 5542709581.596313862
+dec[c,5,10]: -1
+dec[a,5,10]: -328399.996716
+dec[s,5,10]: -328400.003284
+dec[m,5,10]: -1078.465600
+dec[d,5,10]: -100000000.000000000
+dec[c,5,11]: -1
+dec[a,5,11]: -328399.499999
+dec[s,5,11]: -328400.500001
+dec[m,5,11]: -164200.328400
+dec[d,5,11]: -656798.68640262719
+dec[c,5,12]: -1
+dec[a,5,12]: -328400.5000001
+dec[s,5,12]: -328399.4999999
+dec[m,5,12]: 164200.0328400
+dec[d,5,12]: 656799.86864002627
+dec[c,5,13]: -1
+dec[a,5,13]: 1234567890123456789012017278.91
+dec[s,5,13]: -1234567890123456789012674078.91
+dec[m,5,13]:
+dec[d,5,13]: -0.00000000000000000000026600400239403602
+dec[c,5,14]: 2147483647
+dec[a,5,14]: 1234567890123456789012017278.91
+dec[s,5,14]: -1234567890123456789012674078.91
+dec[m,5,14]:
+dec[d,5,14]: -0.00000000000000000000026600400239403602
+dec[c,6,0]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,6,0]:
+dec[m,6,0]: *
+dec[d,6,0]: *
+dec[c,6,1]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,6,1]:
+dec[m,6,1]: *
+dec[d,6,1]: *
+dec[c,6,2]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,6,2]:
+dec[m,6,2]: *
+dec[d,6,2]: *
+dec[c,6,3]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,6,3]:
+dec[m,6,3]: *
+dec[d,6,3]: *
+dec[c,6,4]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,6,4]:
+dec[m,6,4]: *
+dec[d,6,4]: *
+dec[c,6,5]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,6,5]:
+dec[m,6,5]: *
+dec[d,6,5]: *
+dec[c,6,6]: 0
+dec[a,6,6]: *
+dec[s,6,6]: *
+dec[m,6,6]: *
+dec[d,6,6]: *
+dec[c,6,7]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,6,7]:
+dec[m,6,7]: *
+dec[d,6,7]: *
+dec[c,6,8]: 1
+dec[a,6,8]: *
+dec[s,6,8]: *
+dec[m,6,8]: *
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,6,9]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,6,9]:
+dec[m,6,9]: *
+dec[d,6,9]: *
+dec[c,6,10]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,6,10]:
+dec[m,6,10]: *
+dec[d,6,10]: *
+dec[c,6,11]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,6,11]:
+dec[m,6,11]: *
+dec[d,6,11]: *
+dec[c,6,12]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,6,12]:
+dec[m,6,12]: *
+dec[d,6,12]: *
+dec[c,6,13]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,6,13]:
+dec[m,6,13]: *
+dec[d,6,13]: *
+dec[c,6,14]: 2147483647
+dec[a,6,14]:
+dec[s,6,14]:
+dec[m,6,14]: *
+dec[d,6,14]: *
+dec[c,7,0]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,7,0]:
+dec[m,7,0]: *
+dec[d,7,0]: *
+dec[c,7,1]: 1
+dec[a,7,1]: -1.999
+dec[s,7,1]: 2.001
+dec[m,7,1]: -0.002
+dec[d,7,1]: -0.00050000000000000000
+dec[c,7,2]: -1
+dec[a,7,2]: 0.795
+dec[s,7,2]: -0.793
+dec[m,7,2]: 0.000794
+dec[d,7,2]: 0.0012594458438287154
+dec[c,7,3]: -1
+dec[a,7,3]: 3.441
+dec[s,7,3]: -3.439
+dec[m,7,3]: 0.00344
+dec[d,7,3]: 0.00029069767441860465
+dec[c,7,4]: -1
+dec[a,7,4]: 592490000000000000000000.001
+dec[s,7,4]: -592489999999999999999999.999
+dec[m,7,4]: 592490000000000000000.000
+dec[d,7,4]: 0.0000000000000000000000000016877921990244561
+dec[c,7,5]: 1
+dec[a,7,5]: -328399.999
+dec[s,7,5]: 328400.001
+dec[m,7,5]: -328.400
+dec[d,7,5]: -0.0000000030450669914738124
+dec[c,7,6]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,7,6]:
+dec[m,7,6]: *
+dec[d,7,6]: *
+dec[c,7,7]: 0
+dec[a,7,7]: 0.002
+dec[s,7,7]: 0.000
+dec[m,7,7]: 0.000001
+dec[d,7,7]: 1.00000000000000000
+dec[c,7,8]: 1
+dec[a,7,8]: 0.001
+dec[s,7,8]: 0.001
+dec[m,7,8]: 0.0000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,7,9]: 1
+dec[a,7,9]: 0.000940751
+dec[s,7,9]: 0.001059249
+dec[m,7,9]: -0.000000059249
+dec[d,7,9]: -16.877921990244561
+dec[c,7,10]: -1
+dec[a,7,10]: 0.004284
+dec[s,7,10]: -0.002284
+dec[m,7,10]: 0.000003284
+dec[d,7,10]: 0.30450669914738124
+dec[c,7,11]: -1
+dec[a,7,11]: 0.501001
+dec[s,7,11]: -0.499001
+dec[m,7,11]: 0.000500001
+dec[d,7,11]: 0.0019999960000080000
+dec[c,7,12]: 1
+dec[a,7,12]: -0.4990001
+dec[s,7,12]: 0.5010001
+dec[m,7,12]: -0.0005000001
+dec[d,7,12]: -0.0019999996000000800
+dec[c,7,13]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,7,13]:
+dec[m,7,13]: 1234567890123456789012345.67891
+dec[d,7,13]: 0.00000000000000000000000000000081000000729000007
+dec[c,7,14]: 2147483647
+dec[a,7,14]:
+dec[s,7,14]:
+dec[m,7,14]: 1234567890123456789012345.67891
+dec[d,7,14]: 0.00000000000000000000000000000081000000729000007
+dec[c,8,0]: -1
+dec[a,8,0]: *
+dec[s,8,0]: *
+dec[m,8,0]: 0.0
+dec[d,8,0]: 0
+dec[c,8,1]: 1
+dec[a,8,1]: -2.0
+dec[s,8,1]: 2.0
+dec[m,8,1]: 0.0
+dec[d,8,1]: 0
+dec[c,8,2]: -1
+dec[a,8,2]: 0.794
+dec[s,8,2]: -0.794
+dec[m,8,2]: 0.0000
+dec[d,8,2]: 0
+dec[c,8,3]: -1
+dec[a,8,3]: 3.44
+dec[s,8,3]: -3.44
+dec[m,8,3]: 0.000
+dec[d,8,3]: 0
+dec[c,8,4]: -1
+dec[a,8,4]: 592490000000000000000000.0
+dec[s,8,4]: -592490000000000000000000.0
+dec[m,8,4]: 0.0
+dec[d,8,4]: 0
+dec[c,8,5]: 1
+dec[a,8,5]: -328400.0
+dec[s,8,5]: 328400.0
+dec[m,8,5]: 0.0
+dec[d,8,5]: 0
+dec[c,8,6]: -1
+dec[a,8,6]: *
+dec[s,8,6]: *
+dec[m,8,6]: *
+dec[d,8,6]: 0
+dec[c,8,7]: -1
+dec[a,8,7]: 0.001
+dec[s,8,7]: -0.001
+dec[m,8,7]: 0.0000
+dec[d,8,7]: 0
+dec[c,8,8]: 0
+dec[a,8,8]: 0.0
+dec[s,8,8]: 0.0
+dec[m,8,8]: 0.00
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,8,9]: 1
+dec[a,8,9]: -0.000059249
+dec[s,8,9]: 0.000059249
+dec[m,8,9]: 0.0000000000
+dec[d,8,9]: 0
+dec[c,8,10]: -1
+dec[a,8,10]: 0.003284
+dec[s,8,10]: -0.003284
+dec[m,8,10]: 0.0000000
+dec[d,8,10]: 0
+dec[c,8,11]: -1
+dec[a,8,11]: 0.500001
+dec[s,8,11]: -0.500001
+dec[m,8,11]: 0.0000000
+dec[d,8,11]: 0
+dec[c,8,12]: 1
+dec[a,8,12]: -0.5000001
+dec[s,8,12]: 0.5000001
+dec[m,8,12]: 0.00000000
+dec[d,8,12]: 0
+dec[c,8,13]: -1
+dec[a,8,13]: 1234567890123456789012345678.91
+dec[s,8,13]: -1234567890123456789012345678.91
+dec[m,8,13]: 0.000
+dec[d,8,13]: 0
+dec[c,8,14]: 2147483647
+dec[a,8,14]: 1234567890123456789012345678.91
+dec[s,8,14]: -1234567890123456789012345678.91
+dec[m,8,14]: 0.000
+dec[d,8,14]: 0
+dec[c,9,0]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,9,0]:
+dec[m,9,0]: *
+dec[d,9,0]: *
+dec[c,9,1]: 1
+dec[a,9,1]: -2.000059249
+dec[s,9,1]: 1.999940751
+dec[m,9,1]: 0.000118498
+dec[d,9,1]: 0.000029624500000000000
+dec[c,9,2]: -1
+dec[a,9,2]: 0.793940751
+dec[s,9,2]: -0.794059249
+dec[m,9,2]: -0.000047043706
+dec[d,9,2]: -0.000074620906801007557
+dec[c,9,3]: -1
+dec[a,9,3]: 3.439940751
+dec[s,9,3]: -3.440059249
+dec[m,9,3]: -0.00020381656
+dec[d,9,3]: -0.000017223546511627907
+dec[c,9,4]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,9,4]:
+dec[m,9,4]: -35104440010000000000.000000000
+dec[d,9,4]: -0.000000000000000000000000000100000000000000000
+dec[c,9,5]: 1
+dec[a,9,5]: -328400.000059249
+dec[s,9,5]: 328399.999940751
+dec[m,9,5]: 19.457371600
+dec[d,9,5]: 0.00000000018041717417783191
+dec[c,9,6]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,9,6]:
+dec[m,9,6]: *
+dec[d,9,6]: *
+dec[c,9,7]: -1
+dec[a,9,7]: 0.000940751
+dec[s,9,7]: -0.001059249
+dec[m,9,7]: -0.000000059249
+dec[d,9,7]: -0.059249000000000000
+dec[c,9,8]: -1
+dec[a,9,8]: -0.000059249
+dec[s,9,8]: -0.000059249
+dec[m,9,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,9,9]: 0
+dec[a,9,9]: -0.000118498
+dec[s,9,9]: 0.000000000
+dec[m,9,9]: 0.000000003510444001
+dec[d,9,9]: 1.00000000000000000
+dec[c,9,10]: -1
+dec[a,9,10]: 0.003224751
+dec[s,9,10]: -0.003343249
+dec[m,9,10]: -0.000000194573716
+dec[d,9,10]: -0.018041717417783191
+dec[c,9,11]: -1
+dec[a,9,11]: 0.499941751
+dec[s,9,11]: -0.500060249
+dec[m,9,11]: -0.000029624559249
+dec[d,9,11]: -0.000118497763004473991
+dec[c,9,12]: 1
+dec[a,9,12]: -0.500059349
+dec[s,9,12]: 0.499940851
+dec[m,9,12]: 0.0000296245059249
+dec[d,9,12]: 0.000118497976300404740
+dec[c,9,13]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,9,13]:
+dec[m,9,13]:
+dec[d,9,13]: -0.000000000000000000000000000000047991690431925214
+dec[c,9,14]: 2147483647
+dec[a,9,14]:
+dec[s,9,14]:
+dec[m,9,14]:
+dec[d,9,14]: -0.000000000000000000000000000000047991690431925214
+dec[c,10,0]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,10,0]:
+dec[m,10,0]: *
+dec[d,10,0]: *
+dec[c,10,1]: 1
+dec[a,10,1]: -1.996716
+dec[s,10,1]: 2.003284
+dec[m,10,1]: -0.006568
+dec[d,10,1]: -0.0016420000000000000
+dec[c,10,2]: -1
+dec[a,10,2]: 0.797284
+dec[s,10,2]: -0.790716
+dec[m,10,2]: 0.002607496
+dec[d,10,2]: 0.0041360201511335013
+dec[c,10,3]: -1
+dec[a,10,3]: 3.443284
+dec[s,10,3]: -3.436716
+dec[m,10,3]: 0.01129696
+dec[d,10,3]: 0.00095465116279069767
+dec[c,10,4]: -1
+dec[a,10,4]: 592490000000000000000000.003284
+dec[s,10,4]: -592489999999999999999999.996716
+dec[m,10,4]: 1945737160000000000000.000000
+dec[d,10,4]: 0.0000000000000000000000000055427095815963139
+dec[c,10,5]: 1
+dec[a,10,5]: -328399.996716
+dec[s,10,5]: 328400.003284
+dec[m,10,5]: -1078.465600
+dec[d,10,5]: -0.0000000100000000000000000
+dec[c,10,6]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,10,6]:
+dec[m,10,6]: *
+dec[d,10,6]: *
+dec[c,10,7]: 1
+dec[a,10,7]: 0.004284
+dec[s,10,7]: 0.002284
+dec[m,10,7]: 0.000003284
+dec[d,10,7]: 3.2840000000000000
+dec[c,10,8]: 1
+dec[a,10,8]: 0.003284
+dec[s,10,8]: 0.003284
+dec[m,10,8]: 0.0000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,10,9]: 1
+dec[a,10,9]: 0.003224751
+dec[s,10,9]: 0.003343249
+dec[m,10,9]: -0.000000194573716
+dec[d,10,9]: -55.427095815963139
+dec[c,10,10]: 0
+dec[a,10,10]: 0.006568
+dec[s,10,10]: 0.000000
+dec[m,10,10]: 0.000010784656
+dec[d,10,10]: 1.00000000000000000
+dec[c,10,11]: -1
+dec[a,10,11]: 0.503285
+dec[s,10,11]: -0.496717
+dec[m,10,11]: 0.001642003284
+dec[d,10,11]: 0.0065679868640262719
+dec[c,10,12]: 1
+dec[a,10,12]: -0.4967161
+dec[s,10,12]: 0.5032841
+dec[m,10,12]: -0.0016420003284
+dec[d,10,12]: -0.0065679986864002627
+dec[c,10,13]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,10,13]:
+dec[m,10,13]:
+dec[d,10,13]: 0.0000000000000000000000000000026600400239403602
+dec[c,10,14]: 2147483647
+dec[a,10,14]:
+dec[s,10,14]:
+dec[m,10,14]:
+dec[d,10,14]: 0.0000000000000000000000000000026600400239403602
+dec[c,11,0]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,11,0]:
+dec[m,11,0]: *
+dec[d,11,0]: *
+dec[c,11,1]: 1
+dec[a,11,1]: -1.499999
+dec[s,11,1]: 2.500001
+dec[m,11,1]: -1.000002
+dec[d,11,1]: -0.25000050000000000
+dec[c,11,2]: -1
+dec[a,11,2]: 1.294001
+dec[s,11,2]: -0.293999
+dec[m,11,2]: 0.397000794
+dec[d,11,2]: 0.62972418136020151
+dec[c,11,3]: -1
+dec[a,11,3]: 3.940001
+dec[s,11,3]: -2.939999
+dec[m,11,3]: 1.72000344
+dec[d,11,3]: 0.14534912790697674
+dec[c,11,4]: -1
+dec[a,11,4]: 592490000000000000000000.500001
+dec[s,11,4]: -592489999999999999999999.499999
+dec[m,11,4]: 296245592490000000000000.000000
+dec[d,11,4]: 0.00000000000000000000000084389778730442708
+dec[c,11,5]: 1
+dec[a,11,5]: -328399.499999
+dec[s,11,5]: 328400.500001
+dec[m,11,5]: -164200.328400
+dec[d,11,5]: -0.0000015225365408038977
+dec[c,11,6]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,11,6]:
+dec[m,11,6]: *
+dec[d,11,6]: *
+dec[c,11,7]: 1
+dec[a,11,7]: 0.501001
+dec[s,11,7]: 0.499001
+dec[m,11,7]: 0.000500001
+dec[d,11,7]: 500.00100000000000
+dec[c,11,8]: 1
+dec[a,11,8]: 0.500001
+dec[s,11,8]: 0.500001
+dec[m,11,8]: 0.0000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,11,9]: 1
+dec[a,11,9]: 0.499941751
+dec[s,11,9]: 0.500060249
+dec[m,11,9]: -0.000029624559249
+dec[d,11,9]: -8438.9778730442708
+dec[c,11,10]: 1
+dec[a,11,10]: 0.503285
+dec[s,11,10]: 0.496717
+dec[m,11,10]: 0.001642003284
+dec[d,11,10]: 152.25365408038977
+dec[c,11,11]: 0
+dec[a,11,11]: 1.000002
+dec[s,11,11]: 0.000000
+dec[m,11,11]: 0.250001000001
+dec[d,11,11]: 1.00000000000000000
+dec[c,11,12]: 1
+dec[a,11,12]: 0.0000009
+dec[s,11,12]: 1.0000011
+dec[m,11,12]: -0.2500005500001
+dec[d,11,12]: -1.00000179999964000
+dec[c,11,13]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,11,13]:
+dec[m,11,13]:
+dec[d,11,13]: 0.00000000000000000000000000040500081364500732
+dec[c,11,14]: 2147483647
+dec[a,11,14]:
+dec[s,11,14]:
+dec[m,11,14]:
+dec[d,11,14]: 0.00000000000000000000000000040500081364500732
+dec[c,12,0]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,12,0]:
+dec[m,12,0]: *
+dec[d,12,0]: *
+dec[c,12,1]: 1
+dec[a,12,1]: -2.5000001
+dec[s,12,1]: 1.4999999
+dec[m,12,1]: 1.0000002
+dec[d,12,1]: 0.25000005000000000
+dec[c,12,2]: -1
+dec[a,12,2]: 0.2939999
+dec[s,12,2]: -1.2940001
+dec[m,12,2]: -0.3970000794
+dec[d,12,2]: -0.62972304785894207
+dec[c,12,3]: -1
+dec[a,12,3]: 2.9399999
+dec[s,12,3]: -3.9400001
+dec[m,12,3]: -1.720000344
+dec[d,12,3]: -0.14534886627906977
+dec[c,12,4]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,12,4]:
+dec[m,12,4]: -296245059249000000000000.0000000
+dec[d,12,4]: -0.00000000000000000000000084389626829144796
+dec[c,12,5]: 1
+dec[a,12,5]: -328400.5000001
+dec[s,12,5]: 328399.4999999
+dec[m,12,5]: 164200.0328400
+dec[d,12,5]: 0.0000015225338002436054
+dec[c,12,6]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,12,6]:
+dec[m,12,6]: *
+dec[d,12,6]: *
+dec[c,12,7]: -1
+dec[a,12,7]: -0.4990001
+dec[s,12,7]: -0.5010001
+dec[m,12,7]: -0.0005000001
+dec[d,12,7]: -500.00010000000000
+dec[c,12,8]: -1
+dec[a,12,8]: -0.5000001
+dec[s,12,8]: -0.5000001
+dec[m,12,8]: 0.00000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,12,9]: -1
+dec[a,12,9]: -0.500059349
+dec[s,12,9]: -0.499940851
+dec[m,12,9]: 0.0000296245059249
+dec[d,12,9]: 8438.9626829144796
+dec[c,12,10]: -1
+dec[a,12,10]: -0.4967161
+dec[s,12,10]: -0.5032841
+dec[m,12,10]: -0.0016420003284
+dec[d,12,10]: -152.25338002436054
+dec[c,12,11]: -1
+dec[a,12,11]: 0.0000009
+dec[s,12,11]: -1.0000011
+dec[m,12,11]: -0.2500005500001
+dec[d,12,11]: -0.99999820000359999
+dec[c,12,12]: 0
+dec[a,12,12]: -1.0000002
+dec[s,12,12]: 0.0000000
+dec[m,12,12]: 0.25000010000001
+dec[d,12,12]: 1.00000000000000000
+dec[c,12,13]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,12,13]:
+dec[m,12,13]:
+dec[d,12,13]: -0.00000000000000000000000000040500008464500076
+dec[c,12,14]: 2147483647
+dec[a,12,14]:
+dec[s,12,14]:
+dec[m,12,14]:
+dec[d,12,14]: -0.00000000000000000000000000040500008464500076
+dec[c,13,0]: -1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,13,0]:
+dec[m,13,0]: *
+dec[d,13,0]: *
+dec[c,13,1]: 1
+dec[a,13,1]: 1234567890123456789012345676.91
+dec[s,13,1]: 1234567890123456789012345680.91
+dec[m,13,1]: -2469135780246913578024691357.82
+dec[d,13,1]: -617283945061728394506172839.46
+dec[c,13,2]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,13,2]:
+dec[m,13,2]:
+dec[d,13,2]:
+dec[c,13,3]: 1
+dec[a,13,3]: 1234567890123456789012345682.35
+dec[s,13,3]: 1234567890123456789012345675.47
+dec[m,13,3]:
+dec[d,13,3]:
+dec[c,13,4]: 1
+dec[a,13,4]: 1235160380123456789012345678.91
+dec[s,13,4]: 1233975400123456789012345678.91
+dec[m,13,4]:
+dec[d,13,4]: 2083.6940541164522
+dec[c,13,5]: 1
+dec[a,13,5]: 1234567890123456789012017278.91
+dec[s,13,5]: 1234567890123456789012674078.91
+dec[m,13,5]:
+dec[d,13,5]: -3759341930948406787491.92
+dec[c,13,6]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,13,6]:
+dec[m,13,6]: *
+dec[d,13,6]: *
+dec[c,13,7]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,13,7]:
+dec[m,13,7]: 1234567890123456789012345.67891
+dec[d,13,7]: 1234567890123456789012345678910.000
+dec[c,13,8]: 1
+dec[a,13,8]: 1234567890123456789012345678.91
+dec[s,13,8]: 1234567890123456789012345678.91
+dec[m,13,8]: 0.000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1202
+dec[c,13,9]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,13,9]:
+dec[m,13,9]:
+dec[d,13,9]:
+dec[c,13,10]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,13,10]:
+dec[m,13,10]:
+dec[d,13,10]:
+dec[c,13,11]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,13,11]:
+dec[m,13,11]:
+dec[d,13,11]:
+dec[c,13,12]: 1
+(errno == PGTYPES_NUM_OVERFLOW) - r: -1200
+dec[s,13,12]:
+dec[m,13,12]:
+dec[d,13,12]:
+dec[c,13,13]: 0
+dec[a,13,13]: 2469135780246913578024691357.82
+dec[s,13,13]: 0.00
+dec[m,13,13]:
+dec[d,13,13]: 1.00000000000000000
+dec[c,13,14]: 2147483647
+dec[a,13,14]: 2469135780246913578024691357.82
+dec[s,13,14]: 0.00
+dec[m,13,14]:
+dec[d,13,14]: 1.00000000000000000
+dec[c,14,0]: 2147483647
+dec[a,14,0]: 2469135780246913578024691357.82
+dec[s,14,0]: 0.00
+dec[m,14,0]:
+dec[d,14,0]: 1.00000000000000000
+dec[c,14,1]: 2147483647
+dec[a,14,1]: 2469135780246913578024691357.82
+dec[s,14,1]: 0.00
+dec[m,14,1]:
+dec[d,14,1]: 1.00000000000000000
+dec[c,14,2]: 2147483647
+dec[a,14,2]: 2469135780246913578024691357.82
+dec[s,14,2]: 0.00
+dec[m,14,2]:
+dec[d,14,2]: 1.00000000000000000
+dec[c,14,3]: 2147483647
+dec[a,14,3]: 2469135780246913578024691357.82
+dec[s,14,3]: 0.00
+dec[m,14,3]:
+dec[d,14,3]: 1.00000000000000000
+dec[c,14,4]: 2147483647
+dec[a,14,4]: 2469135780246913578024691357.82
+dec[s,14,4]: 0.00
+dec[m,14,4]:
+dec[d,14,4]: 1.00000000000000000
+dec[c,14,5]: 2147483647
+dec[a,14,5]: 2469135780246913578024691357.82
+dec[s,14,5]: 0.00
+dec[m,14,5]:
+dec[d,14,5]: 1.00000000000000000
+dec[c,14,6]: 2147483647
+dec[a,14,6]: 2469135780246913578024691357.82
+dec[s,14,6]: 0.00
+dec[m,14,6]:
+dec[d,14,6]: 1.00000000000000000
+dec[c,14,7]: 2147483647
+dec[a,14,7]: 2469135780246913578024691357.82
+dec[s,14,7]: 0.00
+dec[m,14,7]:
+dec[d,14,7]: 1.00000000000000000
+dec[c,14,8]: 2147483647
+dec[a,14,8]: 2469135780246913578024691357.82
+dec[s,14,8]: 0.00
+dec[m,14,8]:
+dec[d,14,8]: 1.00000000000000000
+dec[c,14,9]: 2147483647
+dec[a,14,9]: 2469135780246913578024691357.82
+dec[s,14,9]: 0.00
+dec[m,14,9]:
+dec[d,14,9]: 1.00000000000000000
+dec[c,14,10]: 2147483647
+dec[a,14,10]: 2469135780246913578024691357.82
+dec[s,14,10]: 0.00
+dec[m,14,10]:
+dec[d,14,10]: 1.00000000000000000
+dec[c,14,11]: 2147483647
+dec[a,14,11]: 2469135780246913578024691357.82
+dec[s,14,11]: 0.00
+dec[m,14,11]:
+dec[d,14,11]: 1.00000000000000000
+dec[c,14,12]: 2147483647
+dec[a,14,12]: 2469135780246913578024691357.82
+dec[s,14,12]: 0.00
+dec[m,14,12]:
+dec[d,14,12]: 1.00000000000000000
+dec[c,14,13]: 2147483647
+dec[a,14,13]: 2469135780246913578024691357.82
+dec[s,14,13]: 0.00
+dec[m,14,13]:
+dec[d,14,13]: 1.00000000000000000
+dec[c,14,14]: 2147483647
+dec[a,14,14]: 2469135780246913578024691357.82
+dec[s,14,14]: 0.00
+dec[m,14,14]:
+dec[d,14,14]: 1.00000000000000000
+0: *
+1: -2
+2: 0.794
+3: 3.44
+4: 592490000000000000000000
+5: -328400
+6: *
+7: 0.001
+8: 0.0
+9: -0.000059249
+10: 0.003284
+11: 0.500001
+12: -0.5000001
+13: 1234567890123456789012345678.91
+14:
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-describe.c b/src/interfaces/ecpg/test/expected/compat_informix-describe.c
new file mode 100644
index 0000000..031a2d7
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-describe.c
@@ -0,0 +1,467 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* Needed for informix compatibility */
+#include <ecpg_informix.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "describe.pgc"
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "describe.pgc"
+
+
+#line 1 "sqlda.h"
+#ifndef ECPG_SQLDA_H
+#define ECPG_SQLDA_H
+
+#ifdef _ECPG_INFORMIX_H
+
+#include "sqlda-compat.h"
+typedef struct sqlvar_compat sqlvar_t;
+typedef struct sqlda_compat sqlda_t;
+
+#else
+
+#include "sqlda-native.h"
+typedef struct sqlvar_struct sqlvar_t;
+typedef struct sqlda_struct sqlda_t;
+
+#endif
+
+#endif /* ECPG_SQLDA_H */
+
+#line 5 "describe.pgc"
+
+
+/* exec sql whenever sqlerror stop ; */
+#line 7 "describe.pgc"
+
+
+sqlda_t *sqlda1, *sqlda2, *sqlda3;
+
+int
+main (void)
+{
+/* exec sql begin declare section */
+
+
+
+
+
+
+#line 15 "describe.pgc"
+ char * stmt1 = "SELECT id, t FROM descr_t1" ;
+
+#line 16 "describe.pgc"
+ char * stmt2 = "SELECT id, t FROM descr_t1 WHERE id = -1" ;
+
+#line 17 "describe.pgc"
+ int i , count1 , count2 ;
+
+#line 18 "describe.pgc"
+ char field_name1 [ 30 ] = "not set" ;
+
+#line 19 "describe.pgc"
+ char field_name2 [ 30 ] = "not set" ;
+/* exec sql end declare section */
+#line 20 "describe.pgc"
+
+
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ { ECPGconnect(__LINE__, 1, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 27 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 27 "describe.pgc"
+
+
+ strcpy(msg, "set");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+#line 30 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 30 "describe.pgc"
+
+
+ strcpy(msg, "create");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "create table descr_t1 ( id serial primary key , t text )", ECPGt_EOIT, ECPGt_EORT);
+#line 33 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 33 "describe.pgc"
+
+
+ strcpy(msg, "insert");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into descr_t1 ( id , t ) values ( default , 'a' )", ECPGt_EOIT, ECPGt_EORT);
+#line 36 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 36 "describe.pgc"
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into descr_t1 ( id , t ) values ( default , 'b' )", ECPGt_EOIT, ECPGt_EORT);
+#line 37 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 37 "describe.pgc"
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into descr_t1 ( id , t ) values ( default , 'c' )", ECPGt_EOIT, ECPGt_EORT);
+#line 38 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 38 "describe.pgc"
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into descr_t1 ( id , t ) values ( default , 'd' )", ECPGt_EOIT, ECPGt_EORT);
+#line 39 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 39 "describe.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 42 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 42 "describe.pgc"
+
+
+ /*
+ * Test DESCRIBE with a query producing tuples.
+ * DESCRIPTOR and SQL DESCRIPTOR are NOT the same in
+ * Informix-compat mode.
+ */
+
+ strcpy(msg, "allocate");
+ ECPGallocate_desc(__LINE__, "desc1");
+#line 51 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 51 "describe.pgc"
+
+ ECPGallocate_desc(__LINE__, "desc2");
+#line 52 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 52 "describe.pgc"
+
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, NULL, 0, "st_id1", stmt1);
+#line 55 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 55 "describe.pgc"
+
+
+ sqlda1 = sqlda2 = sqlda3 = NULL;
+
+ strcpy(msg, "describe");
+ { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id1",
+ ECPGt_descriptor, "desc1", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 60 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id1",
+ ECPGt_descriptor, "desc2", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 61 "describe.pgc"
+
+
+ { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id1",
+ ECPGt_sqlda, &sqlda1, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 63 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id1",
+ ECPGt_sqlda, &sqlda2, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 64 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id1",
+ ECPGt_sqlda, &sqlda3, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 65 "describe.pgc"
+
+
+ if (sqlda1 == NULL)
+ {
+ printf("sqlda1 NULL\n");
+ exit(1);
+ }
+
+ if (sqlda2 == NULL)
+ {
+ printf("sqlda2 NULL\n");
+ exit(1);
+ }
+
+ if (sqlda3 == NULL)
+ {
+ printf("sqlda3 NULL\n");
+ exit(1);
+ }
+
+ strcpy(msg, "get descriptor");
+ { ECPGget_desc_header(__LINE__, "desc1", &(count1));
+
+#line 86 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 86 "describe.pgc"
+
+ { ECPGget_desc_header(__LINE__, "desc1", &(count2));
+
+#line 87 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 87 "describe.pgc"
+
+
+ if (count1 != count2)
+ {
+ printf("count1 (%d) != count2 (%d)\n", count1, count2);
+ exit(1);
+ }
+
+ if (count1 != sqlda1->sqld)
+ {
+ printf("count1 (%d) != sqlda1->sqld (%d)\n", count1, sqlda1->sqld);
+ exit(1);
+ }
+
+ if (count1 != sqlda2->sqld)
+ {
+ printf("count1 (%d) != sqlda2->sqld (%d)\n", count1, sqlda2->sqld);
+ exit(1);
+ }
+
+ if (count1 != sqlda3->sqld)
+ {
+ printf("count1 (%d) != sqlda3->sqld (%d)\n", count1, sqlda3->sqld);
+ exit(1);
+ }
+
+ for (i = 1; i <= count1; i++)
+ {
+ { ECPGget_desc(__LINE__, "desc1", i,ECPGd_name,
+ ECPGt_char,(field_name1),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 115 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 115 "describe.pgc"
+
+ { ECPGget_desc(__LINE__, "desc2", i,ECPGd_name,
+ ECPGt_char,(field_name2),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 116 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 116 "describe.pgc"
+
+ printf("%d\n\tfield_name1 '%s'\n\tfield_name2 '%s'\n\t"
+ "sqlda1 '%s'\n\tsqlda2 '%s'\n\tsqlda3 '%s'\n",
+ i, field_name1, field_name2,
+ sqlda1->sqlvar[i-1].sqlname,
+ sqlda2->sqlvar[i-1].sqlname,
+ sqlda3->sqlvar[i-1].sqlname);
+ }
+
+ strcpy(msg, "deallocate");
+ ECPGdeallocate_desc(__LINE__, "desc1");
+#line 126 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 126 "describe.pgc"
+
+ ECPGdeallocate_desc(__LINE__, "desc2");
+#line 127 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 127 "describe.pgc"
+
+ free(sqlda1);
+ free(sqlda2);
+ free(sqlda3);
+
+ { ECPGdeallocate(__LINE__, 1, NULL, "st_id1");
+#line 132 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 132 "describe.pgc"
+
+
+ /* Test DESCRIBE with a query not producing tuples */
+
+ strcpy(msg, "allocate");
+ ECPGallocate_desc(__LINE__, "desc1");
+#line 137 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 137 "describe.pgc"
+
+ ECPGallocate_desc(__LINE__, "desc2");
+#line 138 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 138 "describe.pgc"
+
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, NULL, 0, "st_id2", stmt2);
+#line 141 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 141 "describe.pgc"
+
+
+ sqlda1 = sqlda2 = sqlda3 = NULL;
+
+ strcpy(msg, "describe");
+ { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id2",
+ ECPGt_descriptor, "desc1", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 146 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id2",
+ ECPGt_descriptor, "desc2", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 147 "describe.pgc"
+
+
+ { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id2",
+ ECPGt_sqlda, &sqlda1, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 149 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id2",
+ ECPGt_sqlda, &sqlda2, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 150 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 1, 0, NULL, "st_id2",
+ ECPGt_sqlda, &sqlda3, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 151 "describe.pgc"
+
+
+ if (sqlda1 == NULL || sqlda2 == NULL || sqlda3 == NULL)
+ exit(1);
+
+ strcpy(msg, "get descriptor");
+ { ECPGget_desc_header(__LINE__, "desc1", &(count1));
+
+#line 157 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 157 "describe.pgc"
+
+ { ECPGget_desc_header(__LINE__, "desc1", &(count2));
+
+#line 158 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 158 "describe.pgc"
+
+
+ if (!( count1 == count2 &&
+ count1 == sqlda1->sqld &&
+ count1 == sqlda2->sqld &&
+ count1 == sqlda3->sqld))
+ exit(1);
+
+ for (i = 1; i <= count1; i++)
+ {
+ { ECPGget_desc(__LINE__, "desc1", i,ECPGd_name,
+ ECPGt_char,(field_name1),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 168 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 168 "describe.pgc"
+
+ { ECPGget_desc(__LINE__, "desc2", i,ECPGd_name,
+ ECPGt_char,(field_name2),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 169 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 169 "describe.pgc"
+
+ printf("%d\n\tfield_name1 '%s'\n\tfield_name2 '%s'\n\t"
+ "sqlda1 '%s'\n\tsqlda2 '%s'\n\tsqlda3 '%s'\n",
+ i, field_name1, field_name2,
+ sqlda1->sqlvar[i-1].sqlname,
+ sqlda2->sqlvar[i-1].sqlname,
+ sqlda3->sqlvar[i-1].sqlname);
+ }
+
+ strcpy(msg, "deallocate");
+ ECPGdeallocate_desc(__LINE__, "desc1");
+#line 179 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 179 "describe.pgc"
+
+ ECPGdeallocate_desc(__LINE__, "desc2");
+#line 180 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 180 "describe.pgc"
+
+ free(sqlda1);
+ free(sqlda2);
+ free(sqlda3);
+
+ { ECPGdeallocate(__LINE__, 1, NULL, "st_id2");
+#line 185 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 185 "describe.pgc"
+
+
+ /* End test */
+
+ strcpy(msg, "drop");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table descr_t1", ECPGt_EOIT, ECPGt_EORT);
+#line 190 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 190 "describe.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 193 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 193 "describe.pgc"
+
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 196 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 196 "describe.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-describe.stderr b/src/interfaces/ecpg/test/expected/compat_informix-describe.stderr
new file mode 100644
index 0000000..8c4c9b7
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-describe.stderr
@@ -0,0 +1,112 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: query: set datestyle to iso; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 30: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: query: create table descr_t1 ( id serial primary key , t text ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 33: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: insert into descr_t1 ( id , t ) values ( default , 'a' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: query: insert into descr_t1 ( id , t ) values ( default , 'b' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 37: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: query: insert into descr_t1 ( id , t ) values ( default , 'c' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 38: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: query: insert into descr_t1 ( id , t ) values ( default , 'd' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 39: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 42: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 55: name st_id1; query: "SELECT id, t FROM descr_t1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 63 sqld = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 64 sqld = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 65 sqld = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 132: name st_id1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 141: name st_id2; query: "SELECT id, t FROM descr_t1 WHERE id = -1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 149 sqld = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 150 sqld = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 151 sqld = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 185: name st_id2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 190: query: drop table descr_t1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 190: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 190: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 193: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-describe.stdout b/src/interfaces/ecpg/test/expected/compat_informix-describe.stdout
new file mode 100644
index 0000000..1e3fe10
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-describe.stdout
@@ -0,0 +1,24 @@
+1
+ field_name1 'id'
+ field_name2 'id'
+ sqlda1 'id'
+ sqlda2 'id'
+ sqlda3 'id'
+2
+ field_name1 't'
+ field_name2 't'
+ sqlda1 't'
+ sqlda2 't'
+ sqlda3 't'
+1
+ field_name1 'id'
+ field_name2 'id'
+ sqlda1 'id'
+ sqlda2 'id'
+ sqlda3 'id'
+2
+ field_name1 't'
+ field_name2 't'
+ sqlda1 't'
+ sqlda2 't'
+ sqlda3 't'
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c b/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c
new file mode 100644
index 0000000..68be082
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c
@@ -0,0 +1,186 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* Needed for informix compatibility */
+#include <ecpg_informix.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "rfmtdate.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <pgtypes_error.h>
+#include <sqltypes.h>
+
+/*
+ * This file tests various forms of date-input/output by means of
+ * rfmtdate / rdefmtdate / rstrdate
+ */
+
+
+static void
+check_return(int ret);
+
+static void
+date_test_strdate(const char *input)
+{
+ static int i;
+ date d;
+ int r, q;
+ char dbuf[11];
+
+ r = rstrdate(input, &d);
+ printf("r: %d ", r);
+ if (r == 0)
+ {
+ q = rdatestr(d, dbuf);
+ printf("q: %d ", q);
+ if (q == 0)
+ {
+ printf("date %d: %s\n", i++, dbuf);
+ }
+ else
+ printf("\n");
+ }
+ else
+ check_return(r);
+}
+
+static void
+date_test_defmt(const char *fmt, const char *input)
+{
+ static int i;
+ char dbuf[11];
+ date d;
+ int q, r;
+
+ r = rdefmtdate(&d, fmt, input);
+ printf("r: %d ", r);
+ if (r == 0)
+ {
+ q = rdatestr(d, dbuf);
+ printf("q: %d ", q);
+ if (q == 0)
+ {
+ printf("date %d: %s\n", i++, dbuf);
+ }
+ else
+ printf("\n");
+ }
+ else
+ check_return(r);
+}
+
+static void
+date_test_fmt(date d, const char *fmt)
+{
+ static int i;
+ char buf[200];
+ int r;
+
+ r = rfmtdate(d, fmt, buf);
+ printf("r: %d ", r);
+ if (r != 0)
+ check_return(r);
+ else
+ printf("date: %d: %s\n", i++, buf);
+}
+
+
+int
+main(void)
+{
+ short mdy[3] = { 11, 23, 1959 };
+ char dbuf[11];
+ date d;
+ int r;
+
+ ECPGdebug(1, stderr);
+
+ r = rmdyjul(mdy, &d);
+ printf("create: r: %d\n", r);
+ if (r == 0)
+ {
+ rdatestr(d, dbuf);
+ printf("date: %s\n", dbuf);
+ }
+
+ /* input mask is mmddyyyy */
+ date_test_strdate("12031994");
+ date_test_strdate("9.6.1994");
+
+ date_test_fmt(d, "mmddyy");
+ date_test_fmt(d, "ddmmyy");
+ date_test_fmt(d, "yymmdd");
+ date_test_fmt(d, "yy/mm/dd");
+ date_test_fmt(d, "yy mm dd");
+ date_test_fmt(d, "yy.mm.dd");
+ date_test_fmt(d, ".mm.yyyy.dd.");
+ date_test_fmt(d, "mmm. dd, yyyy");
+ date_test_fmt(d, "mmm dd yyyy");
+ date_test_fmt(d, "yyyy dd mm");
+ date_test_fmt(d, "ddd, mmm. dd, yyyy");
+ date_test_fmt(d, "(ddd) mmm. dd, yyyy");
+
+ date_test_defmt("ddmmyy", "21-2-54");
+ date_test_defmt("ddmmyy", "2-12-54");
+ date_test_defmt("ddmmyy", "20111954");
+ date_test_defmt("ddmmyy", "130464");
+ date_test_defmt("mmm.dd.yyyy", "MAR-12-1967");
+ date_test_defmt("yy/mm/dd", "1954, February 3rd");
+ date_test_defmt("mmm.dd.yyyy", "041269");
+ date_test_defmt("yy/mm/dd", "In the year 2525, in the month of July, mankind will be alive on the 28th day");
+ date_test_defmt("dd-mm-yy", "I said on the 28th of July in the year 2525");
+ date_test_defmt("mmm.dd.yyyy", "9/14/58");
+ date_test_defmt("yy/mm/dd", "47/03/29");
+ date_test_defmt("mmm.dd.yyyy", "oct 28 1975");
+ date_test_defmt("mmddyy", "Nov 14th, 1985");
+ /* ok: still contains dd mm yy */
+ date_test_defmt("bladdfoommbaryybong", "20/11/1954");
+ /* 1994 is not a leap year, it accepts the date as 01-03-1994 */
+ date_test_defmt("ddmmyy", "29-02-1994");
+
+ /* ECPG_INFORMIX_ENOTDMY, need "dd", "mm" and "yy" */
+ date_test_defmt("dmy", "20/11/1954");
+
+ /* ECPG_INFORMIX_ENOSHORTDATE */
+ date_test_defmt("ddmmyy", "21254");
+ date_test_defmt("ddmmyy", " 21254 ");
+
+ /* ECPG_INFORMIX_BAD_DAY */
+ date_test_defmt("ddmmyy", "320494");
+
+ /* ECPG_INFORMIX_BAD_MONTH */
+ date_test_defmt("mm-yyyy-dd", "13-1993-21");
+
+ /* ECPG_INFORMIX_BAD_YEAR */
+ /* ??? */
+
+ return 0;
+}
+
+static void
+check_return(int ret)
+{
+ switch(ret)
+ {
+ case ECPG_INFORMIX_ENOTDMY:
+ printf("(ECPG_INFORMIX_ENOTDMY)");
+ break;
+ case ECPG_INFORMIX_ENOSHORTDATE:
+ printf("(ECPG_INFORMIX_ENOSHORTDATE)");
+ break;
+ case ECPG_INFORMIX_BAD_DAY:
+ printf("(ECPG_INFORMIX_BAD_DAY)");
+ break;
+ case ECPG_INFORMIX_BAD_MONTH:
+ printf("(ECPG_INFORMIX_BAD_MONTH)");
+ break;
+ default:
+ printf("(unknown ret: %d)", ret);
+ break;
+ }
+ printf("\n");
+}
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.stderr b/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.stderr
new file mode 100644
index 0000000..1a3639d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.stderr
@@ -0,0 +1,2 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.stdout b/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.stdout
new file mode 100644
index 0000000..16880d4
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.stdout
@@ -0,0 +1,36 @@
+create: r: 0
+date: 1959-11-23
+r: 0 q: 0 date 0: 1994-12-03
+r: 0 q: 0 date 1: 1994-09-06
+r: 0 date: 0: 112359
+r: 0 date: 1: 231159
+r: 0 date: 2: 591123
+r: 0 date: 3: 59/11/23
+r: 0 date: 4: 59 11 23
+r: 0 date: 5: 59.11.23
+r: 0 date: 6: .11.1959.23.
+r: 0 date: 7: Nov. 23, 1959
+r: 0 date: 8: Nov 23 1959
+r: 0 date: 9: 1959 23 11
+r: 0 date: 10: Mon, Nov. 23, 1959
+r: 0 date: 11: (Mon) Nov. 23, 1959
+r: 0 q: 0 date 0: 0054-02-21
+r: 0 q: 0 date 1: 0054-12-02
+r: 0 q: 0 date 2: 1954-11-20
+r: 0 q: 0 date 3: 0064-04-13
+r: 0 q: 0 date 4: 1967-03-12
+r: 0 q: 0 date 5: 1954-02-03
+r: 0 q: 0 date 6: 0069-04-12
+r: 0 q: 0 date 7: 2525-07-28
+r: 0 q: 0 date 8: 2525-07-28
+r: 0 q: 0 date 9: 0058-09-14
+r: 0 q: 0 date 10: 0047-03-29
+r: 0 q: 0 date 11: 1975-10-28
+r: 0 q: 0 date 12: 1985-11-14
+r: 0 q: 0 date 13: 1954-11-20
+r: 0 q: 0 date 14: 1994-03-01
+r: -1212 (ECPG_INFORMIX_ENOTDMY)
+r: -1209 (ECPG_INFORMIX_ENOSHORTDATE)
+r: -1209 (ECPG_INFORMIX_ENOSHORTDATE)
+r: -1206 (ECPG_INFORMIX_BAD_DAY)
+r: -1205 (ECPG_INFORMIX_BAD_MONTH)
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c b/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c
new file mode 100644
index 0000000..b2e397e
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c
@@ -0,0 +1,84 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* Needed for informix compatibility */
+#include <ecpg_informix.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "rfmtlong.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <pgtypes_error.h>
+#include <sqltypes.h>
+
+/*
+ * This file tests various forms of long-input/output by means of
+ * rfmtlong
+ */
+
+
+static void
+check_return(int ret);
+
+static void
+fmtlong(long lng, const char *fmt)
+{
+ static int i;
+ int r;
+ char buf[30];
+
+ r = rfmtlong(lng, fmt, buf);
+ printf("r: %d ", r);
+ if (r == 0)
+ {
+ printf("%d: %s (fmt was: %s)\n", i++, buf, fmt);
+ }
+ else
+ check_return(r);
+}
+
+int
+main(void)
+{
+ ECPGdebug(1, stderr);
+
+ fmtlong(-8494493, "-<<<<,<<<,<<<,<<<");
+ fmtlong(-8494493, "################");
+ fmtlong(-8494493, "+++$$$$$$$$$$$$$.##");
+ fmtlong(-8494493, "(&,&&&,&&&,&&&.)");
+ fmtlong(-8494493, "<<<<,<<<,<<<,<<<");
+ fmtlong(-8494493, "$************.**");
+ fmtlong(-8494493, "---$************.**");
+ fmtlong(-8494493, "+-+################");
+ fmtlong(-8494493, "abc: ################+-+");
+ fmtlong(-8494493, "+<<<<,<<<,<<<,<<<");
+
+ return 0;
+}
+
+static void
+check_return(int ret)
+{
+ switch(ret)
+ {
+ case ECPG_INFORMIX_ENOTDMY:
+ printf("(ECPG_INFORMIX_ENOTDMY)");
+ break;
+ case ECPG_INFORMIX_ENOSHORTDATE:
+ printf("(ECPG_INFORMIX_ENOSHORTDATE)");
+ break;
+ case ECPG_INFORMIX_BAD_DAY:
+ printf("(ECPG_INFORMIX_BAD_DAY)");
+ break;
+ case ECPG_INFORMIX_BAD_MONTH:
+ printf("(ECPG_INFORMIX_BAD_MONTH)");
+ break;
+ default:
+ printf("(unknown ret: %d)", ret);
+ break;
+ }
+ printf("\n");
+}
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.stderr b/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.stderr
new file mode 100644
index 0000000..1a3639d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.stderr
@@ -0,0 +1,2 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.stdout b/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.stdout
new file mode 100644
index 0000000..5965e6d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.stdout
@@ -0,0 +1,10 @@
+r: 0 0: -8,494,493 (fmt was: -<<<<,<<<,<<<,<<<)
+r: 0 1: 8494493 (fmt was: ################)
+r: 0 2: - $8494493.00 (fmt was: +++$$$$$$$$$$$$$.##)
+r: 0 3: (00008,494,493.) (fmt was: (&,&&&,&&&,&&&.))
+r: 0 4: 8,494,493 (fmt was: <<<<,<<<,<<<,<<<)
+r: 0 5: $*****8494493.00 (fmt was: $************.**)
+r: 0 6: -$*****8494493.00 (fmt was: ---$************.**)
+r: 0 7: - 8494493 (fmt was: +-+################)
+r: 0 8: abc: 8494493 (fmt was: abc: ################+-+)
+r: 0 9: -8,494,493 (fmt was: +<<<<,<<<,<<<,<<<)
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rnull.c b/src/interfaces/ecpg/test/expected/compat_informix-rnull.c
new file mode 100644
index 0000000..d7ba69c
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rnull.c
@@ -0,0 +1,293 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* Needed for informix compatibility */
+#include <ecpg_informix.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "rnull.pgc"
+#include "sqltypes.h"
+#include <stdlib.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "rnull.pgc"
+
+
+
+static void
+test_null(int type, char *ptr)
+{
+ printf("null: %d\n", risnull(type, ptr));
+}
+
+int main(void)
+{
+
+#line 15 "rnull.pgc"
+ char c [] = "abc" ;
+
+#line 15 "rnull.pgc"
+
+
+#line 16 "rnull.pgc"
+ short s = 17 ;
+
+#line 16 "rnull.pgc"
+
+
+#line 17 "rnull.pgc"
+ int i = - 74874 ;
+
+#line 17 "rnull.pgc"
+
+
+#line 18 "rnull.pgc"
+ bool b = 1 ;
+
+#line 18 "rnull.pgc"
+
+
+#line 19 "rnull.pgc"
+ float f = 3.71 ;
+
+#line 19 "rnull.pgc"
+
+
+#line 20 "rnull.pgc"
+ long l = 487444 ;
+
+#line 20 "rnull.pgc"
+
+
+#line 21 "rnull.pgc"
+ double dbl = 404.404 ;
+
+#line 21 "rnull.pgc"
+
+
+#line 22 "rnull.pgc"
+ decimal dec ;
+
+#line 22 "rnull.pgc"
+
+
+#line 23 "rnull.pgc"
+ date dat ;
+
+#line 23 "rnull.pgc"
+
+
+#line 24 "rnull.pgc"
+ timestamp tmp ;
+
+#line 24 "rnull.pgc"
+
+
+ ECPGdebug(1, stderr);
+ /* exec sql whenever sqlerror do sqlprint ( ) ; */
+#line 27 "rnull.pgc"
+
+
+ { ECPGconnect(__LINE__, 1, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 29 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 29 "rnull.pgc"
+
+
+ { ECPGdo(__LINE__, 1, 0, NULL, 0, ECPGst_normal, "create table test ( id int , c char ( 10 ) , s smallint , i int , b bool , f float , l bigint , dbl double precision , dec decimal , dat date , tmp timestamptz )", ECPGt_EOIT, ECPGt_EORT);
+#line 33 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 33 "rnull.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 34 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 34 "rnull.pgc"
+
+
+ { ECPGdo(__LINE__, 1, 0, NULL, 0, ECPGst_normal, "insert into test ( id , c , s , i , b , f , l , dbl ) values ( 1 , $1 , $2 , $3 , $4 , $5 , $6 , $7 )",
+ ECPGt_char,(c),(long)sizeof("abc"),(long)1,(sizeof("abc"))*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_bool,&(b),(long)1,(long)1,sizeof(bool),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_float,&(f),(long)1,(long)1,sizeof(float),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_long,&(l),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_double,&(dbl),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 38 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 38 "rnull.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 39 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 39 "rnull.pgc"
+
+
+ rsetnull(CCHARTYPE, (char *) c);
+ rsetnull(CSHORTTYPE, (char *) &s);
+ rsetnull(CINTTYPE, (char *) &i);
+ rsetnull(CBOOLTYPE, (char *) &b);
+ rsetnull(CFLOATTYPE, (char *) &f);
+ rsetnull(CLONGTYPE, (char *) &l);
+ rsetnull(CDOUBLETYPE, (char *) &dbl);
+ rsetnull(CDECIMALTYPE, (char *) &dec);
+ rsetnull(CDATETYPE, (char *) &dat);
+ rsetnull(CDTIMETYPE, (char *) &tmp);
+
+ { ECPGdo(__LINE__, 1, 0, NULL, 0, ECPGst_normal, "insert into test ( id , c , s , i , b , f , l , dbl , dec , dat , tmp ) values ( 2 , $1 , $2 , $3 , $4 , $5 , $6 , $7 , $8 , $9 , $10 )",
+ ECPGt_char,(c),(long)sizeof("abc"),(long)1,(sizeof("abc"))*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_bool,&(b),(long)1,(long)1,sizeof(bool),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_float,&(f),(long)1,(long)1,sizeof(float),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_long,&(l),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_double,&(dbl),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_decimal,&(dec),(long)1,(long)1,sizeof(decimal),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_date,&(dat),(long)1,(long)1,sizeof(date),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_timestamp,&(tmp),(long)1,(long)1,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 54 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 54 "rnull.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 55 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 55 "rnull.pgc"
+
+
+ printf("first select\n");
+
+ { ECPGdo(__LINE__, 1, 0, NULL, 0, ECPGst_normal, "select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 1", ECPGt_EOIT,
+ ECPGt_char,(c),(long)sizeof("abc"),(long)1,(sizeof("abc"))*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_bool,&(b),(long)1,(long)1,sizeof(bool),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_float,&(f),(long)1,(long)1,sizeof(float),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_long,&(l),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_double,&(dbl),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_decimal,&(dec),(long)1,(long)1,sizeof(decimal),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_date,&(dat),(long)1,(long)1,sizeof(date),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_timestamp,&(tmp),(long)1,(long)1,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 61 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 61 "rnull.pgc"
+
+
+ test_null(CCHARTYPE, (char *) c);
+ test_null(CSHORTTYPE, (char *) &s);
+ test_null(CINTTYPE, (char *) &i);
+ test_null(CBOOLTYPE, (char *) &b);
+ test_null(CFLOATTYPE, (char *) &f);
+ test_null(CLONGTYPE, (char *) &l);
+ test_null(CDOUBLETYPE, (char *) &dbl);
+ test_null(CDECIMALTYPE, (char *) &dec);
+ test_null(CDATETYPE, (char *) &dat);
+ test_null(CDTIMETYPE, (char *) &tmp);
+
+ printf("second select\n");
+
+ { ECPGdo(__LINE__, 1, 0, NULL, 0, ECPGst_normal, "select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 2", ECPGt_EOIT,
+ ECPGt_char,(c),(long)sizeof("abc"),(long)1,(sizeof("abc"))*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_short,&(s),(long)1,(long)1,sizeof(short),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_bool,&(b),(long)1,(long)1,sizeof(bool),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_float,&(f),(long)1,(long)1,sizeof(float),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_long,&(l),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_double,&(dbl),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_decimal,&(dec),(long)1,(long)1,sizeof(decimal),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_date,&(dat),(long)1,(long)1,sizeof(date),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_timestamp,&(tmp),(long)1,(long)1,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 78 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 78 "rnull.pgc"
+
+
+ test_null(CCHARTYPE, (char *) c);
+ test_null(CSHORTTYPE, (char *) &s);
+ test_null(CINTTYPE, (char *) &i);
+ test_null(CBOOLTYPE, (char *) &b);
+ test_null(CFLOATTYPE, (char *) &f);
+ test_null(CLONGTYPE, (char *) &l);
+ test_null(CDOUBLETYPE, (char *) &dbl);
+ test_null(CDECIMALTYPE, (char *) &dec);
+ test_null(CDATETYPE, (char *) &dat);
+ test_null(CDTIMETYPE, (char *) &tmp);
+
+ { ECPGdo(__LINE__, 1, 0, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
+#line 91 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 91 "rnull.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 92 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 92 "rnull.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 94 "rnull.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 94 "rnull.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rnull.stderr b/src/interfaces/ecpg/test/expected/compat_informix-rnull.stderr
new file mode 100644
index 0000000..dd3d8b7
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rnull.stderr
@@ -0,0 +1,124 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: query: create table test ( id int , c char ( 10 ) , s smallint , i int , b bool , f float , l bigint , dbl double precision , dec decimal , dat date , tmp timestamptz ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 31: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 34: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: insert into test ( id , c , s , i , b , f , l , dbl ) values ( 1 , $1 , $2 , $3 , $4 , $5 , $6 , $7 ); with 7 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 36: parameter 1 = abc
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 36: parameter 2 = 17
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 36: parameter 3 = -74874
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 36: parameter 4 = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 36: parameter 5 = 3.71000003814697
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 36: parameter 6 = 487444
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 36: parameter 7 = 404.404
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 39: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 52: query: insert into test ( id , c , s , i , b , f , l , dbl , dec , dat , tmp ) values ( 2 , $1 , $2 , $3 , $4 , $5 , $6 , $7 , $8 , $9 , $10 ); with 10 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 52: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 52: parameter 1 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 52: parameter 2 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 52: parameter 3 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 52: parameter 4 = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 52: parameter 5 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 52: parameter 6 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 52: parameter 7 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 52: parameter 8 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 52: parameter 9 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 52: parameter 10 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 52: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 55: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 59: query: select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 59: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 59: correctly got 1 tuples with 10 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: abc offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: 17 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: -74874 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: 3.71000003814697 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: 487444 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: 404.404 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 76: query: select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 76: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 76: correctly got 1 tuples with 10 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 91: query: drop table test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 91: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 91: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 92: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rnull.stdout b/src/interfaces/ecpg/test/expected/compat_informix-rnull.stdout
new file mode 100644
index 0000000..ff2e405
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rnull.stdout
@@ -0,0 +1,22 @@
+first select
+null: 0
+null: 0
+null: 0
+null: 0
+null: 0
+null: 0
+null: 0
+null: 1
+null: 1
+null: 1
+second select
+null: 1
+null: 1
+null: 1
+null: 0
+null: 1
+null: 1
+null: 1
+null: 1
+null: 1
+null: 1
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
new file mode 100644
index 0000000..7e19319
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
@@ -0,0 +1,530 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* Needed for informix compatibility */
+#include <ecpg_informix.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "sqlda.pgc"
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 5 "sqlda.pgc"
+
+
+
+#line 1 "sqlda.h"
+#ifndef ECPG_SQLDA_H
+#define ECPG_SQLDA_H
+
+#ifdef _ECPG_INFORMIX_H
+
+#include "sqlda-compat.h"
+typedef struct sqlvar_compat sqlvar_t;
+typedef struct sqlda_compat sqlda_t;
+
+#else
+
+#include "sqlda-native.h"
+typedef struct sqlvar_struct sqlvar_t;
+typedef struct sqlda_struct sqlda_t;
+
+#endif
+
+#endif /* ECPG_SQLDA_H */
+
+#line 7 "sqlda.pgc"
+
+
+#line 1 "sqltypes.h"
+#ifndef ECPG_SQLTYPES_H
+#define ECPG_SQLTYPES_H
+
+#include <limits.h>
+
+#define CCHARTYPE ECPGt_char
+#define CSHORTTYPE ECPGt_short
+#define CINTTYPE ECPGt_int
+#define CLONGTYPE ECPGt_long
+#define CFLOATTYPE ECPGt_float
+#define CDOUBLETYPE ECPGt_double
+#define CDECIMALTYPE ECPGt_decimal
+#define CFIXCHARTYPE 108
+#define CSTRINGTYPE ECPGt_char
+#define CDATETYPE ECPGt_date
+#define CMONEYTYPE 111
+#define CDTIMETYPE ECPGt_timestamp
+#define CLOCATORTYPE 113
+#define CVCHARTYPE ECPGt_varchar
+#define CINVTYPE 115
+#define CFILETYPE 116
+#define CINT8TYPE ECPGt_long_long
+#define CCOLLTYPE 118
+#define CLVCHARTYPE 119
+#define CFIXBINTYPE 120
+#define CVARBINTYPE 121
+#define CBOOLTYPE ECPGt_bool
+#define CROWTYPE 123
+#define CLVCHARPTRTYPE 124
+#define CTYPEMAX 25
+
+/*
+ * Values used in sqlda->sqlvar[i]->sqltype
+ */
+#define SQLCHAR ECPGt_char
+#define SQLSMINT ECPGt_short
+#define SQLINT ECPGt_int
+#define SQLFLOAT ECPGt_double
+#define SQLSMFLOAT ECPGt_float
+#define SQLDECIMAL ECPGt_decimal
+#define SQLSERIAL ECPGt_int
+#define SQLDATE ECPGt_date
+#define SQLDTIME ECPGt_timestamp
+#define SQLTEXT ECPGt_char
+#define SQLVCHAR ECPGt_char
+#define SQLINTERVAL ECPGt_interval
+#define SQLNCHAR ECPGt_char
+#define SQLNVCHAR ECPGt_char
+#ifdef HAVE_LONG_LONG_INT_64
+#define SQLINT8 ECPGt_long_long
+#define SQLSERIAL8 ECPGt_long_long
+#else
+#define SQLINT8 ECPGt_long
+#define SQLSERIAL8 ECPGt_long
+#endif
+
+#endif /* ndef ECPG_SQLTYPES_H */
+
+#line 8 "sqlda.pgc"
+
+
+/* exec sql whenever sqlerror stop ; */
+#line 10 "sqlda.pgc"
+
+
+/* These shouldn't be under DECLARE SECTION */
+sqlda_t *inp_sqlda, *outp_sqlda;
+
+static void
+dump_sqlda(sqlda_t *sqlda)
+{
+ int i;
+
+ if (sqlda == NULL)
+ {
+ printf("dump_sqlda called with NULL sqlda\n");
+ return;
+ }
+
+ for (i = 0; i < sqlda->sqld; i++)
+ {
+ if (sqlda->sqlvar[i].sqlind && *(sqlda->sqlvar[i].sqlind) == -1)
+ printf("name sqlda descriptor: '%s' value NULL'\n", sqlda->sqlvar[i].sqlname);
+ else
+ switch (sqlda->sqlvar[i].sqltype)
+ {
+ case SQLCHAR:
+ printf("name sqlda descriptor: '%s' value '%s'\n", sqlda->sqlvar[i].sqlname, sqlda->sqlvar[i].sqldata);
+ break;
+ case SQLINT:
+ printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname, *(int *)sqlda->sqlvar[i].sqldata);
+ break;
+ case SQLFLOAT:
+ printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
+ break;
+ case SQLDECIMAL:
+ {
+ char val[64];
+ dectoasc((decimal *)sqlda->sqlvar[i].sqldata, val, 64, -1);
+ printf("name sqlda descriptor: '%s' value DECIMAL '%s'\n", sqlda->sqlvar[i].sqlname, val);
+ break;
+ }
+ }
+ }
+}
+
+int
+main (void)
+{
+/* exec sql begin declare section */
+
+
+
+
+
+#line 57 "sqlda.pgc"
+ char * stmt1 = "SELECT * FROM t1" ;
+
+#line 58 "sqlda.pgc"
+ char * stmt2 = "SELECT * FROM t1 WHERE id = ?" ;
+
+#line 59 "sqlda.pgc"
+ int rec ;
+
+#line 60 "sqlda.pgc"
+ int id ;
+/* exec sql end declare section */
+#line 61 "sqlda.pgc"
+
+
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ { ECPGconnect(__LINE__, 1, "ecpg1_regression" , NULL, NULL , "regress1", 0);
+#line 68 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 68 "sqlda.pgc"
+
+
+ strcpy(msg, "set");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+#line 71 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 71 "sqlda.pgc"
+
+
+ strcpy(msg, "create");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "create table t1 ( id integer , t text , d1 numeric , d2 float8 , c char ( 10 ) )", ECPGt_EOIT, ECPGt_EORT);
+#line 79 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 79 "sqlda.pgc"
+
+
+ strcpy(msg, "insert");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' ) , ( 2 , null , null , null , null ) , ( 4 , 'd' , 4.0 , 4 , 'd' )", ECPGt_EOIT, ECPGt_EORT);
+#line 85 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 85 "sqlda.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 88 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 88 "sqlda.pgc"
+
+
+ /* SQLDA test for getting all records from a table */
+
+ outp_sqlda = NULL;
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, NULL, 0, "st_id1", stmt1);
+#line 95 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 95 "sqlda.pgc"
+
+
+ strcpy(msg, "declare");
+ /* declare mycur1 cursor for $1 */
+#line 98 "sqlda.pgc"
+
+
+ strcpy(msg, "open");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare mycur1 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id1", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 101 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 101 "sqlda.pgc"
+
+
+ /* exec sql whenever not found break ; */
+#line 103 "sqlda.pgc"
+
+
+ rec = 0;
+ while (1)
+ {
+ strcpy(msg, "fetch");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch 1 from mycur1", ECPGt_EOIT,
+ ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 109 "sqlda.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+#line 109 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 109 "sqlda.pgc"
+
+
+ printf("FETCH RECORD %d\n", ++rec);
+ dump_sqlda(outp_sqlda);
+ }
+
+ /* exec sql whenever not found continue ; */
+#line 115 "sqlda.pgc"
+
+
+ strcpy(msg, "close");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "close mycur1", ECPGt_EOIT, ECPGt_EORT);
+#line 118 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 118 "sqlda.pgc"
+
+
+ strcpy(msg, "deallocate");
+ { ECPGdeallocate(__LINE__, 1, NULL, "st_id1");
+#line 121 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 121 "sqlda.pgc"
+
+
+ free(outp_sqlda);
+
+ /* SQLDA test for getting all records from a table
+ using the Informix-specific FETCH ... USING DESCRIPTOR
+ */
+
+ outp_sqlda = NULL;
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, NULL, 0, "st_id2", stmt1);
+#line 132 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 132 "sqlda.pgc"
+
+
+ strcpy(msg, "declare");
+ /* declare mycur2 cursor for $1 */
+#line 135 "sqlda.pgc"
+
+
+ strcpy(msg, "open");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare mycur2 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id2", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 138 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 138 "sqlda.pgc"
+
+
+ /* exec sql whenever not found break ; */
+#line 140 "sqlda.pgc"
+
+
+ rec = 0;
+ while (1)
+ {
+ strcpy(msg, "fetch");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch from mycur2", ECPGt_EOIT,
+ ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 146 "sqlda.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+#line 146 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 146 "sqlda.pgc"
+
+
+ printf("FETCH RECORD %d\n", ++rec);
+ dump_sqlda(outp_sqlda);
+ }
+
+ /* exec sql whenever not found continue ; */
+#line 152 "sqlda.pgc"
+
+
+ strcpy(msg, "close");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "close mycur2", ECPGt_EOIT, ECPGt_EORT);
+#line 155 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 155 "sqlda.pgc"
+
+
+ strcpy(msg, "deallocate");
+ { ECPGdeallocate(__LINE__, 1, NULL, "st_id2");
+#line 158 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 158 "sqlda.pgc"
+
+
+ free(outp_sqlda);
+
+ /* SQLDA test for getting one record using an input descriptor */
+
+ /* Input sqlda has to be built manually */
+ inp_sqlda = (sqlda_t *)malloc(sizeof(sqlda_t));
+ memset(inp_sqlda, 0, sizeof(sqlda_t));
+ inp_sqlda->sqld = 1;
+ inp_sqlda->sqlvar = malloc(sizeof(sqlvar_t));
+ memset(inp_sqlda->sqlvar, 0, sizeof(sqlvar_t));
+
+ inp_sqlda->sqlvar[0].sqltype = SQLINT;
+ inp_sqlda->sqlvar[0].sqldata = (char *)&id;
+
+ printf("EXECUTE RECORD 4\n");
+
+ id = 4;
+
+ outp_sqlda = NULL;
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, NULL, 0, "st_id3", stmt2);
+#line 181 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 181 "sqlda.pgc"
+
+
+ strcpy(msg, "execute");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_execute, "st_id3",
+ ECPGt_sqlda, &inp_sqlda, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 184 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 184 "sqlda.pgc"
+
+
+ dump_sqlda(outp_sqlda);
+
+ strcpy(msg, "deallocate");
+ { ECPGdeallocate(__LINE__, 1, NULL, "st_id3");
+#line 189 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 189 "sqlda.pgc"
+
+
+ free(inp_sqlda->sqlvar);
+ free(inp_sqlda);
+ free(outp_sqlda);
+
+ /* SQLDA test for getting one record using an input descriptor
+ * on a named connection
+ */
+
+ { ECPGconnect(__LINE__, 1, "ecpg1_regression" , NULL, NULL , "con2", 0);
+#line 199 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 199 "sqlda.pgc"
+
+
+ /* Input sqlda has to be built manually */
+ inp_sqlda = (sqlda_t *)malloc(sizeof(sqlda_t));
+ memset(inp_sqlda, 0, sizeof(sqlda_t));
+ inp_sqlda->sqld = 1;
+ inp_sqlda->sqlvar = malloc(sizeof(sqlvar_t));
+ memset(inp_sqlda->sqlvar, 0, sizeof(sqlvar_t));
+
+ inp_sqlda->sqlvar[0].sqltype = SQLINT;
+ inp_sqlda->sqlvar[0].sqldata = (char *)&id;
+
+ printf("EXECUTE RECORD 4\n");
+
+ id = 4;
+
+ outp_sqlda = NULL;
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, "con2", 0, "st_id4", stmt2);
+#line 218 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 218 "sqlda.pgc"
+
+
+ strcpy(msg, "execute");
+ { ECPGdo(__LINE__, 1, 1, "con2", 0, ECPGst_execute, "st_id4",
+ ECPGt_sqlda, &inp_sqlda, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 221 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 221 "sqlda.pgc"
+
+
+ dump_sqlda(outp_sqlda);
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, "con2", "commit");
+#line 226 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 226 "sqlda.pgc"
+
+
+ strcpy(msg, "deallocate");
+ { ECPGdeallocate(__LINE__, 1, NULL, "st_id4");
+#line 229 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 229 "sqlda.pgc"
+
+
+ free(inp_sqlda->sqlvar);
+ free(inp_sqlda);
+ free(outp_sqlda);
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "con2");
+#line 236 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 236 "sqlda.pgc"
+
+
+ /* End test */
+
+ strcpy(msg, "drop");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT);
+#line 241 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 241 "sqlda.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 244 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 244 "sqlda.pgc"
+
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 247 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 247 "sqlda.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-sqlda.stderr b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.stderr
new file mode 100644
index 0000000..51cb46b
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.stderr
@@ -0,0 +1,340 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 71: query: set datestyle to iso; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 71: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 71: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: query: create table t1 ( id integer , t text , d1 numeric , d2 float8 , c char ( 10 ) ); with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 74: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 82: query: insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' ) , ( 2 , null , null , null , null ) , ( 4 , 'd' , 4.0 , 4 , 'd' ); with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 82: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 82: OK: INSERT 0 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 88: action "commit"; connection "regress1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 95: name st_id1; query: "SELECT * FROM t1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 101: query: declare mycur1 cursor for SELECT * FROM t1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 101: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 101: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 109: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 109: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 109: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 109 sqld = 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 109: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 109: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 109: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 109: RESULT: 1.0 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 109: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 109: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 109: putting result (1 tuple 5 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 109: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 109: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 109: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 109 sqld = 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 109: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 109: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 1 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 2 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 3 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 4 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 109: putting result (1 tuple 5 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 109: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 109: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 109: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 109 sqld = 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 109: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 109: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 109: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 109: RESULT: 4.0 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 109: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 109 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 109: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 109: putting result (1 tuple 5 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 109: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 109: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 109: correctly got 0 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 109: no data found on line 109
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 118: query: close mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 118: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 118: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 121: name st_id1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 132: name st_id2; query: "SELECT * FROM t1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 138: query: declare mycur2 cursor for SELECT * FROM t1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 138: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 138: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 146: query: fetch from mycur2; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 146: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 146: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 146 sqld = 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 146: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 146: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 146: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 146: RESULT: 1.0 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 146: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 146: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 146: putting result (1 tuple 5 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 146: query: fetch from mycur2; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 146: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 146: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 146 sqld = 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 146: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 146: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 1 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 2 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 3 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 4 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 146: putting result (1 tuple 5 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 146: query: fetch from mycur2; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 146: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 146: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 146 sqld = 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 146: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 146: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 146: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 146: RESULT: 4.0 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 146: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 146 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 146: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 146: putting result (1 tuple 5 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 146: query: fetch from mycur2; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 146: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 146: correctly got 0 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 146: no data found on line 146
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 155: query: close mycur2; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 155: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 155: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 158: name st_id2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 181: name st_id3; query: "SELECT * FROM t1 WHERE id = $1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 184: query: SELECT * FROM t1 WHERE id = $1; with 1 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 184: using PQexecPrepared for "SELECT * FROM t1 WHERE id = $1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 184: parameter 1 = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 184: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 184 sqld = 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 184: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 184 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 184: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 184 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 184: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 184 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 184: RESULT: 4.0 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 184 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 184: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 184 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 184: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 184: putting result (1 tuple 5 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 189: name st_id3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 218: name st_id4; query: "SELECT * FROM t1 WHERE id = $1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 221: query: SELECT * FROM t1 WHERE id = $1; with 1 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 221: using PQexecPrepared for "SELECT * FROM t1 WHERE id = $1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 221: parameter 1 = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 221: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_compat_sqlda on line 221 sqld = 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 221: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 221 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 221: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 221 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 221: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 221 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 221: RESULT: 4.0 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 221 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 221: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_compat_sqlda on line 221 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 221: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 221: putting result (1 tuple 5 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 226: action "commit"; connection "con2"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 229: name st_id4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection con2 closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 241: query: drop table t1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 241: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 241: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 244: 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/compat_informix-sqlda.stdout b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.stdout
new file mode 100644
index 0000000..68335df
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.stdout
@@ -0,0 +1,48 @@
+FETCH RECORD 1
+name sqlda descriptor: 'id' value 1
+name sqlda descriptor: 't' value 'a'
+name sqlda descriptor: 'd1' value DECIMAL '1.0'
+name sqlda descriptor: 'd2' value 1.000000
+name sqlda descriptor: 'c' value 'a '
+FETCH RECORD 2
+name sqlda descriptor: 'id' value 2
+name sqlda descriptor: 't' value NULL'
+name sqlda descriptor: 'd1' value NULL'
+name sqlda descriptor: 'd2' value NULL'
+name sqlda descriptor: 'c' value NULL'
+FETCH RECORD 3
+name sqlda descriptor: 'id' value 4
+name sqlda descriptor: 't' value 'd'
+name sqlda descriptor: 'd1' value DECIMAL '4.0'
+name sqlda descriptor: 'd2' value 4.000000
+name sqlda descriptor: 'c' value 'd '
+FETCH RECORD 1
+name sqlda descriptor: 'id' value 1
+name sqlda descriptor: 't' value 'a'
+name sqlda descriptor: 'd1' value DECIMAL '1.0'
+name sqlda descriptor: 'd2' value 1.000000
+name sqlda descriptor: 'c' value 'a '
+FETCH RECORD 2
+name sqlda descriptor: 'id' value 2
+name sqlda descriptor: 't' value NULL'
+name sqlda descriptor: 'd1' value NULL'
+name sqlda descriptor: 'd2' value NULL'
+name sqlda descriptor: 'c' value NULL'
+FETCH RECORD 3
+name sqlda descriptor: 'id' value 4
+name sqlda descriptor: 't' value 'd'
+name sqlda descriptor: 'd1' value DECIMAL '4.0'
+name sqlda descriptor: 'd2' value 4.000000
+name sqlda descriptor: 'c' value 'd '
+EXECUTE RECORD 4
+name sqlda descriptor: 'id' value 4
+name sqlda descriptor: 't' value 'd'
+name sqlda descriptor: 'd1' value DECIMAL '4.0'
+name sqlda descriptor: 'd2' value 4.000000
+name sqlda descriptor: 'c' value 'd '
+EXECUTE RECORD 4
+name sqlda descriptor: 'id' value 4
+name sqlda descriptor: 't' value 'd'
+name sqlda descriptor: 'd1' value DECIMAL '4.0'
+name sqlda descriptor: 'd2' value 4.000000
+name sqlda descriptor: 'c' value 'd '
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
new file mode 100644
index 0000000..cc65049
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
@@ -0,0 +1,259 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* Needed for informix compatibility */
+#include <ecpg_informix.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "test_informix.pgc"
+#include "sqltypes.h"
+#include <stdlib.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "test_informix.pgc"
+
+
+
+static void openit(void);
+static void dosqlprint(void) {
+ printf("doSQLprint: Error: %s\n", sqlca.sqlerrm.sqlerrmc);
+}
+
+int main(void)
+{
+
+#line 14 "test_informix.pgc"
+ int i = 14 , loopcount ;
+
+#line 14 "test_informix.pgc"
+
+
+#line 15 "test_informix.pgc"
+ decimal j , m , n ;
+
+#line 15 "test_informix.pgc"
+
+
+#line 16 "test_informix.pgc"
+ char c [ 10 ] ;
+
+#line 16 "test_informix.pgc"
+
+
+ ECPGdebug(1, stderr);
+ /* exec sql whenever sqlerror do dosqlprint ( ) ; */
+#line 19 "test_informix.pgc"
+
+
+ { ECPGconnect(__LINE__, 1, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 21 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 21 "test_informix.pgc"
+
+ if (sqlca.sqlcode != 0) exit(1);
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "create table test ( i int primary key , j int , c text )", ECPGt_EOIT, ECPGt_EORT);
+#line 24 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 24 "test_informix.pgc"
+
+
+ /* this INSERT works */
+ rsetnull(CDECIMALTYPE, (char *)&j);
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into test ( i , j , c ) values ( 7 , $1 , 'test ' )",
+ ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 28 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 28 "test_informix.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 29 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 29 "test_informix.pgc"
+
+
+ /* this INSERT should fail because i is a unique column */
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into test ( i , j , c ) values ( 7 , 12 , 'a' )", ECPGt_EOIT, ECPGt_EORT);
+#line 32 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 32 "test_informix.pgc"
+
+ printf("INSERT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
+ if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback");
+#line 34 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 34 "test_informix.pgc"
+
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into test ( i , j , c ) values ( $1 , 1 , 'a ' )",
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 36 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 36 "test_informix.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 37 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 37 "test_informix.pgc"
+
+
+ /* this will fail (more than one row in subquery) */
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select i from test where j = ( select j from test )", ECPGt_EOIT, ECPGt_EORT);
+#line 40 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 40 "test_informix.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 41 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 41 "test_informix.pgc"
+
+
+ /* this however should be ok */
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select i from test where j = ( select j from test order by i limit 1 )", ECPGt_EOIT, ECPGt_EORT);
+#line 44 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 44 "test_informix.pgc"
+
+ printf("SELECT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
+ if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback");
+#line 46 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 46 "test_informix.pgc"
+
+
+ sqlca.sqlcode = 100;
+ ECPGset_var( 0, &( i ), __LINE__);\
+ /* declare c cursor for select * from test where i <= $1 */
+#line 49 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );
+#line 49 "test_informix.pgc"
+
+#line 49 "test_informix.pgc"
+
+ printf ("%ld\n", sqlca.sqlcode);
+ openit();
+
+ deccvint(0, &j);
+
+ for (loopcount = 0; loopcount < 100; loopcount++)
+ {
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch forward c", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_string,(c),(long)10,(long)1,(10)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 57 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 57 "test_informix.pgc"
+
+ if (sqlca.sqlcode == 100) break;
+
+ if (risnull(CDECIMALTYPE, (char *)&j))
+ printf("%d NULL\n", i);
+ else
+ {
+ int a;
+
+ dectoint(&j, &a);
+ printf("%d %d \"%s\"\n", i, a, c);
+ }
+ }
+
+ deccvint(7, &j);
+ deccvint(14, &m);
+ decadd(&j, &m, &n);
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "delete from test where i = $1 :: decimal",
+ ECPGt_decimal,&(n),(long)1,(long)1,sizeof(decimal),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 74 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 74 "test_informix.pgc"
+
+ printf("DELETE: %ld\n", sqlca.sqlcode);
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select 1 from test where i = 14", ECPGt_EOIT, ECPGt_EORT);
+#line 77 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 77 "test_informix.pgc"
+
+ printf("Exists: %ld\n", sqlca.sqlcode);
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select 1 from test where i = 147", ECPGt_EOIT, ECPGt_EORT);
+#line 80 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 80 "test_informix.pgc"
+
+ printf("Does not exist: %ld\n", sqlca.sqlcode);
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 83 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 83 "test_informix.pgc"
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
+#line 84 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 84 "test_informix.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 85 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 85 "test_informix.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 87 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 87 "test_informix.pgc"
+
+
+ return 0;
+}
+
+static void openit(void)
+{
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare c cursor for select * from test where i <= $1 ",
+ ECPGt_int,&(*( int *)(ECPGget_var( 0))),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 94 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint ( );}
+#line 94 "test_informix.pgc"
+
+}
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr
new file mode 100644
index 0000000..d5e8712
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr
@@ -0,0 +1,133 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: query: create table test ( i int primary key , j int , c text ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 24: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: query: insert into test ( i , j , c ) values ( 7 , $1 , 'test ' ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 28: parameter 1 = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 28: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 29: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: insert into test ( i , j , c ) values ( 7 , 12 , 'a' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_check_PQresult on line 32: bad response - ERROR: duplicate key value violates unique constraint "test_pkey"
+DETAIL: Key (i)=(7) already exists.
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlstate 23505 (sqlcode -239): duplicate key value violates unique constraint "test_pkey" on line 32
+[NO_PID]: sqlca: code: -239, state: 23505
+[NO_PID]: ECPGtrans on line 34: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: insert into test ( i , j , c ) values ( $1 , 1 , 'a ' ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 36: parameter 1 = 14
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 37: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: query: select i from test where j = ( select j from test ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_check_PQresult on line 40: bad response - ERROR: more than one row returned by a subquery used as an expression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlstate 21000 (sqlcode -284): more than one row returned by a subquery used as an expression on line 40
+[NO_PID]: sqlca: code: -284, state: 21000
+[NO_PID]: ECPGtrans on line 41: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 44: query: select i from test where j = ( select j from test order by i limit 1 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 44: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 44: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 94: query: declare c cursor for select * from test where i <= $1 ; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 94: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 94: parameter 1 = 14
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 94: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 57: query: fetch forward c; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 57: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 57: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 57: RESULT: 7 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 57: RESULT: 0 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 57: RESULT: test offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 57: query: fetch forward c; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 57: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 57: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 57: RESULT: 14 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 57: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 57: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 57: query: fetch forward c; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 57: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 57: correctly got 0 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 57: no data found on line 57
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 74: query: delete from test where i = $1 :: decimal; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 74: parameter 1 = 21.0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 74: OK: DELETE 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 74: no data found on line 74
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 77: query: select 1 from test where i = 14; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 77: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 77: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 80: query: select 1 from test where i = 147; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 80: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 80: correctly got 0 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 80: no data found on line 80
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ECPGtrans on line 83: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 84: query: drop table test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 84: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 84: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 85: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stdout b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stdout
new file mode 100644
index 0000000..454fd18
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stdout
@@ -0,0 +1,10 @@
+doSQLprint: Error: duplicate key value violates unique constraint "test_pkey" on line 32
+INSERT: -239=duplicate key value violates unique constraint "test_pkey" on line 32
+doSQLprint: Error: more than one row returned by a subquery used as an expression on line 40
+SELECT: 0=
+0
+7 0 "test"
+14 1 "a"
+DELETE: 100
+Exists: 0
+Does not exist: 100
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c b/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
new file mode 100644
index 0000000..fc30e32
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
@@ -0,0 +1,290 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* Needed for informix compatibility */
+#include <ecpg_informix.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "test_informix2.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include "sqltypes.h"
+
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 5 "test_informix2.pgc"
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 6 "test_informix2.pgc"
+
+
+
+/* Check SQLCODE, and produce a "standard error" if it's wrong! */
+static void sql_check(const char *fn, const char *caller, int ignore)
+{
+ char errorstring[255];
+
+ if (SQLCODE == ignore)
+ return;
+ else
+ {
+ if (SQLCODE != 0)
+ {
+
+ sprintf(errorstring, "**SQL error %ld doing '%s' in function '%s'. [%s]",
+ SQLCODE, caller, fn, sqlca.sqlerrm.sqlerrmc);
+ fprintf(stderr, "%s", errorstring);
+ printf("%s\n", errorstring);
+
+ /* attempt a ROLLBACK */
+ { ECPGtrans(__LINE__, NULL, "rollback");}
+#line 27 "test_informix2.pgc"
+
+
+ if (SQLCODE == 0)
+ {
+ sprintf(errorstring, "Rollback successful.\n");
+ } else {
+ sprintf(errorstring, "Rollback failed with code %ld.\n", SQLCODE);
+ }
+
+ fprintf(stderr, "%s", errorstring);
+ printf("%s\n", errorstring);
+
+ exit(1);
+ }
+ }
+}
+
+int main(void)
+{
+ /* exec sql begin declare section */
+
+
+
+
+
+
+#line 47 "test_informix2.pgc"
+ int c ;
+
+#line 48 "test_informix2.pgc"
+ timestamp d ;
+
+#line 49 "test_informix2.pgc"
+ timestamp e ;
+
+#line 50 "test_informix2.pgc"
+ timestamp maxd ;
+
+#line 51 "test_informix2.pgc"
+ char dbname [ 30 ] ;
+/* exec sql end declare section */
+#line 52 "test_informix2.pgc"
+
+
+ interval *intvl;
+
+ /* exec sql whenever sqlerror stop ; */
+#line 56 "test_informix2.pgc"
+
+
+ ECPGdebug(1, stderr);
+
+ strcpy(dbname, "ecpg1_regression");
+ { ECPGconnect(__LINE__, 1, dbname , NULL, NULL , NULL, 0);
+#line 61 "test_informix2.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 61 "test_informix2.pgc"
+
+ sql_check("main", "connect", 0);
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "set DateStyle to 'DMY'", ECPGt_EOIT, ECPGt_EORT);
+#line 64 "test_informix2.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 64 "test_informix2.pgc"
+
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "create table history ( customerid integer , timestamp timestamp without time zone , action_taken char ( 5 ) , narrative varchar ( 100 ) )", ECPGt_EOIT, ECPGt_EORT);
+#line 66 "test_informix2.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 66 "test_informix2.pgc"
+
+ sql_check("main", "create", 0);
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into history ( customerid , timestamp , action_taken , narrative ) values ( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' )", ECPGt_EOIT, ECPGt_EORT);
+#line 71 "test_informix2.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 71 "test_informix2.pgc"
+
+ sql_check("main", "insert", 0);
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select max ( timestamp ) from history", ECPGt_EOIT,
+ ECPGt_timestamp,&(maxd),(long)1,(long)1,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 76 "test_informix2.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 76 "test_informix2.pgc"
+
+ sql_check("main", "select max", 100);
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select customerid , timestamp from history where timestamp = $1 limit 1",
+ ECPGt_timestamp,&(maxd),(long)1,(long)1,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(c),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_timestamp,&(d),(long)1,(long)1,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 83 "test_informix2.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 83 "test_informix2.pgc"
+
+ sql_check("main", "select", 0);
+
+ printf("Read in customer %d\n", c);
+
+ intvl = PGTYPESinterval_from_asc("1 day 2 hours 24 minutes 65 seconds", NULL);
+ PGTYPEStimestamp_add_interval(&d, intvl, &e);
+ free(intvl);
+ c++;
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into history ( customerid , timestamp , action_taken , narrative ) values ( $1 , $2 , 'test' , 'test' )",
+ ECPGt_int,&(c),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_timestamp,&(e),(long)1,(long)1,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 95 "test_informix2.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 95 "test_informix2.pgc"
+
+ sql_check("main", "update", 0);
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 98 "test_informix2.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 98 "test_informix2.pgc"
+
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table history", ECPGt_EOIT, ECPGt_EORT);
+#line 100 "test_informix2.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 100 "test_informix2.pgc"
+
+ sql_check("main", "drop", 0);
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 103 "test_informix2.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 103 "test_informix2.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 105 "test_informix2.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 105 "test_informix2.pgc"
+
+ sql_check("main", "disconnect", 0);
+
+ printf("All OK!\n");
+
+ exit(0);
+
+/*
+ Table "public.history"
+ Column | Type | Nullable
+--------------+-----------------------------+----------
+ customerid | integer | not null
+ timestamp | timestamp without time zone | not null
+ action_taken | character(5) | not null
+ narrative | character varying(100) |
+*/
+
+}
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.stderr b/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.stderr
new file mode 100644
index 0000000..3e90319
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.stderr
@@ -0,0 +1,64 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 64: query: set DateStyle to 'DMY'; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 64: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 64: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 66: query: create table history ( customerid integer , timestamp timestamp without time zone , action_taken char ( 5 ) , narrative varchar ( 100 ) ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 66: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 66: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 69: query: insert into history ( customerid , timestamp , action_taken , narrative ) values ( 1 , '2003-05-07 13:28:34 CEST' , 'test' , 'test' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 69: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 69: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: query: select max ( timestamp ) from history; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 74: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 74: RESULT: Wed 07 May 13:28:34 2003 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 79: query: select customerid , timestamp from history where timestamp = $1 limit 1; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 79: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 79: parameter 1 = 2003-05-07 13:28:34
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 79: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 79: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 79: RESULT: Wed 07 May 13:28:34 2003 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 93: query: insert into history ( customerid , timestamp , action_taken , narrative ) values ( $1 , $2 , 'test' , 'test' ); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 93: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 93: parameter 1 = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 93: parameter 2 = 2003-05-08 15:53:39
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 93: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 98: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 100: query: drop table history; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 100: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 100: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 103: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.stdout b/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.stdout
new file mode 100644
index 0000000..ce3f426
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.stdout
@@ -0,0 +1,2 @@
+Read in customer 1
+All OK!
diff --git a/src/interfaces/ecpg/test/expected/compat_oracle-char_array.c b/src/interfaces/ecpg/test/expected/compat_oracle-char_array.c
new file mode 100644
index 0000000..04d4e19
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_oracle-char_array.c
@@ -0,0 +1,223 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "char_array.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 5 "char_array.pgc"
+
+
+static void warn(void)
+{
+ fprintf(stderr, "Warning: At least one column was truncated\n");
+}
+
+/* Compatible handling of char array to retrieve varchar field to char array
+ should be fixed-length, blank-padded, then null-terminated.
+ Conforms to the ANSI Fixed Character type. */
+
+int main() {
+
+ /* exec sql whenever sql_warning do warn ( ) ; */
+#line 18 "char_array.pgc"
+
+ /* exec sql whenever sqlerror stop ; */
+#line 19 "char_array.pgc"
+
+
+ const char *ppppp = "XXXXX";
+ int loopcount;
+ /* exec sql begin declare section */
+
+
+
+
+
+#line 24 "char_array.pgc"
+ char shortstr [ 5 ] ;
+
+#line 25 "char_array.pgc"
+ char bigstr [ 11 ] ;
+
+#line 26 "char_array.pgc"
+ short shstr_ind = 0 ;
+
+#line 27 "char_array.pgc"
+ short bigstr_ind = 0 ;
+/* exec sql end declare section */
+#line 28 "char_array.pgc"
+
+
+ ECPGdebug(1, stderr);
+ { ECPGconnect(__LINE__, 3, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 31 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 31 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 31 "char_array.pgc"
+
+
+ { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "create table strdbase ( strval varchar ( 10 ) )", ECPGt_EOIT, ECPGt_EORT);
+#line 33 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 33 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 33 "char_array.pgc"
+
+ { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( '' )", ECPGt_EOIT, ECPGt_EORT);
+#line 34 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 34 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 34 "char_array.pgc"
+
+ { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'AB' )", ECPGt_EOIT, ECPGt_EORT);
+#line 35 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 35 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 35 "char_array.pgc"
+
+ { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'ABCD' )", ECPGt_EOIT, ECPGt_EORT);
+#line 36 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 36 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 36 "char_array.pgc"
+
+ { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'ABCDE' )", ECPGt_EOIT, ECPGt_EORT);
+#line 37 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 37 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 37 "char_array.pgc"
+
+ { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'ABCDEF' )", ECPGt_EOIT, ECPGt_EORT);
+#line 38 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 38 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 38 "char_array.pgc"
+
+ { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'ABCDEFGHIJ' )", ECPGt_EOIT, ECPGt_EORT);
+#line 39 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 39 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 39 "char_array.pgc"
+
+
+ /* declare C cursor for select strval , strval from strdbase */
+#line 41 "char_array.pgc"
+
+ { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "declare C cursor for select strval , strval from strdbase", ECPGt_EOIT, ECPGt_EORT);
+#line 42 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 42 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 42 "char_array.pgc"
+
+
+ /* exec sql whenever not found break ; */
+#line 44 "char_array.pgc"
+
+
+ printf("Full Str. : Short Ind.\n");
+ for (loopcount = 0; loopcount < 100; loopcount++) {
+ strncpy(shortstr, ppppp, sizeof shortstr);
+ memset(bigstr, 0, sizeof bigstr);
+ { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "fetch C", ECPGt_EOIT,
+ ECPGt_char,(bigstr),(long)11,(long)1,(11)*sizeof(char),
+ ECPGt_short,&(bigstr_ind),(long)1,(long)1,sizeof(short),
+ ECPGt_char,(shortstr),(long)5,(long)1,(5)*sizeof(char),
+ ECPGt_short,&(shstr_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);
+#line 50 "char_array.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+#line 50 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 50 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 50 "char_array.pgc"
+
+ printf("\"%s\": \"%s\" %d\n", bigstr, shortstr, shstr_ind);
+ }
+
+ { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "close C", ECPGt_EOIT, ECPGt_EORT);
+#line 54 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 54 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 54 "char_array.pgc"
+
+ { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "drop table strdbase", ECPGt_EOIT, ECPGt_EORT);
+#line 55 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 55 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 55 "char_array.pgc"
+
+
+ printf("\nGOOD-BYE!!\n\n");
+
+ { ECPGtrans(__LINE__, NULL, "commit work");
+#line 59 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 59 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 59 "char_array.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 61 "char_array.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 61 "char_array.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 61 "char_array.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/compat_oracle-char_array.stderr b/src/interfaces/ecpg/test/expected/compat_oracle-char_array.stderr
new file mode 100644
index 0000000..40d9f7d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_oracle-char_array.stderr
@@ -0,0 +1,139 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: query: create table strdbase ( strval varchar ( 10 ) ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 33: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: query: insert into strdbase values ( '' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 34: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: query: insert into strdbase values ( 'AB' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 35: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: insert into strdbase values ( 'ABCD' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: query: insert into strdbase values ( 'ABCDE' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 37: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: query: insert into strdbase values ( 'ABCDEF' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 38: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: query: insert into strdbase values ( 'ABCDEFGHIJ' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 39: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: query: declare C cursor for select strval , strval from strdbase; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 42: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 50: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 50: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 50: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 50: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 50: RESULT: AB offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 50: RESULT: AB offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 50: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 50: RESULT: ABCD offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 50: RESULT: ABCD offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 50: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 50: RESULT: ABCDE offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 50: RESULT: ABCDE offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+Warning: At least one column was truncated
+[NO_PID]: ecpg_execute on line 50: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 50: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 50: RESULT: ABCDEF offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 50: RESULT: ABCDEF offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+Warning: At least one column was truncated
+[NO_PID]: ecpg_execute on line 50: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 50: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 50: RESULT: ABCDEFGHIJ offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 50: RESULT: ABCDEFGHIJ offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+Warning: At least one column was truncated
+[NO_PID]: ecpg_execute on line 50: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 50: correctly got 0 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 50: no data found on line 50
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 54: query: close C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 54: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 54: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: drop table strdbase; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 59: action "commit work"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/compat_oracle-char_array.stdout b/src/interfaces/ecpg/test/expected/compat_oracle-char_array.stdout
new file mode 100644
index 0000000..d58b3c7
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/compat_oracle-char_array.stdout
@@ -0,0 +1,10 @@
+Full Str. : Short Ind.
+" ": " " -1
+"AB ": "AB " 0
+"ABCD ": "ABCD" 0
+"ABCDE ": "ABCD" 5
+"ABCDEF ": "ABCD" 6
+"ABCDEFGHIJ": "ABCD" 10
+
+GOOD-BYE!!
+
diff --git a/src/interfaces/ecpg/test/expected/connect-test1-minGW32.stderr b/src/interfaces/ecpg/test/expected/connect-test1-minGW32.stderr
new file mode 100644
index 0000000..c5b5248
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test1-minGW32.stderr
@@ -0,0 +1,73 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: query: alter user regress_ecpg_user1 encrypted password 'connectpw'; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 23: OK: ALTER ROLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on localhost port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database <DEFAULT> on localhost port <DEFAULT> for user regress_ecpg_user2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: connection to server failed: FATAL: database "regress_ecpg_user2" does not exist
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -402 on line 29: could not connect to database "<DEFAULT>" on line 29
+[NO_PID]: sqlca: code: -402, state: 08001
+[NO_PID]: raising sqlcode -220 on line 30: connection "main" does not exist on line 30
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on localhost port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg2_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database <DEFAULT> on localhost port <DEFAULT> for user regress_ecpg_user2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: connection to server failed: FATAL: database "regress_ecpg_user2" does not exist
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection (null) closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -402 on line 38: could not connect to database "<DEFAULT>" on line 38
+[NO_PID]: sqlca: code: -402, state: 08001
+[NO_PID]: raising sqlcode -220 on line 39: connection "CURRENT" does not exist on line 39
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on localhost port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg2_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg2_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> with options connect_timeout=180 for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg2_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database nonexistent on localhost port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: connection to server failed: FATAL: database "nonexistent" does not exist
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection nonexistent closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -402 on line 53: could not connect to database "nonexistent" on line 53
+[NO_PID]: sqlca: code: -402, state: 08001
+[NO_PID]: raising sqlcode -220 on line 54: connection "CURRENT" does not exist on line 54
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on localhost port <REGRESSION_PORT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: connection to server failed: Connection refused (0x0000274D/10061)
+ Is the server running on that host and accepting TCP/IP connections?
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg2_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -402 on line 57: could not connect to database "ecpg2_regression" on line 57
+[NO_PID]: sqlca: code: -402, state: 08001
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/connect-test1.c b/src/interfaces/ecpg/test/expected/connect-test1.c
new file mode 100644
index 0000000..ffd24e2
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test1.c
@@ -0,0 +1,124 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "test1.pgc"
+/*
+ * this file tests all sorts of connecting to one single database.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/* do not include regression.h */
+
+int
+main(void)
+{
+/* exec sql begin declare section */
+
+
+
+#line 16 "test1.pgc"
+ char db [ 200 ] ;
+
+#line 17 "test1.pgc"
+ char pw [ 200 ] ;
+/* exec sql end declare section */
+#line 18 "test1.pgc"
+
+
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }
+#line 22 "test1.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter user regress_ecpg_user1 encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);}
+#line 23 "test1.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 24 "test1.pgc"
+ /* <-- "main" not specified */
+
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression@localhost" , NULL, NULL , "main", 0); }
+#line 26 "test1.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 27 "test1.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "@localhost" , "regress_ecpg_user2" , NULL , "main", 0); }
+#line 29 "test1.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 30 "test1.pgc"
+
+
+ /* exec sql connect to :@TEMP_PORT@ as main user regress_ecpg_user2;
+ exec sql disconnect main; */
+
+ { ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost/ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , NULL, 0); }
+#line 35 "test1.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 36 "test1.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost/" , "regress_ecpg_user2" , NULL , NULL, 0); }
+#line 38 "test1.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 39 "test1.pgc"
+
+
+ strcpy(pw, "connectpw");
+ strcpy(db, "tcp:postgresql://localhost/ecpg2_regression");
+ { ECPGconnect(__LINE__, 0, db , "regress_ecpg_user1" , pw , NULL, 0); }
+#line 43 "test1.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 44 "test1.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , NULL, 0); }
+#line 46 "test1.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 47 "test1.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/ecpg2_regression?connect_timeout=180" , "regress_ecpg_user1" , NULL , NULL, 0); }
+#line 49 "test1.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 50 "test1.pgc"
+
+
+ /* wrong db */
+ { ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost/nonexistent" , "regress_ecpg_user1" , "connectpw" , NULL, 0); }
+#line 53 "test1.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 54 "test1.pgc"
+
+
+ /* wrong port */
+ { ECPGconnect(__LINE__, 0, "tcp:postgresql://127.0.0.1:20/ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , NULL, 0); }
+#line 57 "test1.pgc"
+
+ /* no disconnect necessary */
+
+ /* wrong password */
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/ecpg2_regression" , "regress_ecpg_user1" , "wrongpw" , NULL, 0); }
+#line 61 "test1.pgc"
+
+ /* no disconnect necessary */
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/connect-test1.stderr b/src/interfaces/ecpg/test/expected/connect-test1.stderr
new file mode 100644
index 0000000..073951c
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test1.stderr
@@ -0,0 +1,73 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: query: alter user regress_ecpg_user1 encrypted password 'connectpw'; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 23: OK: ALTER ROLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on localhost port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database <DEFAULT> on localhost port <DEFAULT> for user regress_ecpg_user2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: connection to server failed: FATAL: database "regress_ecpg_user2" does not exist
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -402 on line 29: could not connect to database "<DEFAULT>" on line 29
+[NO_PID]: sqlca: code: -402, state: 08001
+[NO_PID]: raising sqlcode -220 on line 30: connection "main" does not exist on line 30
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on localhost port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg2_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database <DEFAULT> on localhost port <DEFAULT> for user regress_ecpg_user2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: connection to server failed: FATAL: database "regress_ecpg_user2" does not exist
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection (null) closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -402 on line 38: could not connect to database "<DEFAULT>" on line 38
+[NO_PID]: sqlca: code: -402, state: 08001
+[NO_PID]: raising sqlcode -220 on line 39: connection "CURRENT" does not exist on line 39
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on localhost port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg2_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg2_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> with options connect_timeout=180 for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg2_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database nonexistent on localhost port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: connection to server failed: FATAL: database "nonexistent" does not exist
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection nonexistent closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -402 on line 53: could not connect to database "nonexistent" on line 53
+[NO_PID]: sqlca: code: -402, state: 08001
+[NO_PID]: raising sqlcode -220 on line 54: connection "CURRENT" does not exist on line 54
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on 127.0.0.1 port <REGRESSION_PORT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: connection to server failed: Connection refused
+ Is the server running on that host and accepting TCP/IP connections?
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg2_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -402 on line 57: could not connect to database "ecpg2_regression" on line 57
+[NO_PID]: sqlca: code: -402, state: 08001
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/connect-test1.stdout b/src/interfaces/ecpg/test/expected/connect-test1.stdout
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test1.stdout
diff --git a/src/interfaces/ecpg/test/expected/connect-test2.c b/src/interfaces/ecpg/test/expected/connect-test2.c
new file mode 100644
index 0000000..deb7f19
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test2.c
@@ -0,0 +1,104 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "test2.pgc"
+/*
+ * this file tests multiple connections to databases and switches
+ * between them.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 11 "test2.pgc"
+
+
+int
+main(void)
+{
+/* exec sql begin declare section */
+
+
+
+#line 17 "test2.pgc"
+ char id [ 200 ] ;
+
+#line 18 "test2.pgc"
+ char res [ 200 ] ;
+/* exec sql end declare section */
+#line 19 "test2.pgc"
+
+
+ ECPGdebug(1, stderr);
+
+ strcpy(id, "first");
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , id, 0); }
+#line 24 "test2.pgc"
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "second", 0); }
+#line 25 "test2.pgc"
+
+
+ /* this selects from "second" which was opened last */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select current_database ( )", ECPGt_EOIT,
+ ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 28 "test2.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "first", 0, ECPGst_normal, "select current_database ( )", ECPGt_EOIT,
+ ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 29 "test2.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "second", 0, ECPGst_normal, "select current_database ( )", ECPGt_EOIT,
+ ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 30 "test2.pgc"
+
+
+ { ECPGsetconn(__LINE__, "first");}
+#line 32 "test2.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select current_database ( )", ECPGt_EOIT,
+ ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 33 "test2.pgc"
+
+
+ /* this will disconnect from "first" */
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 36 "test2.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select current_database ( )", ECPGt_EOIT,
+ ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 37 "test2.pgc"
+
+
+ /* error here since "first" is already disconnected */
+ { ECPGdisconnect(__LINE__, id);}
+#line 40 "test2.pgc"
+
+
+ /* disconnect from "second" */
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 43 "test2.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/connect-test2.stderr b/src/interfaces/ecpg/test/expected/connect-test2.stderr
new file mode 100644
index 0000000..4c9c38b
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test2.stderr
@@ -0,0 +1,52 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: query: select current_database ( ); with 0 parameter(s) on connection second
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 28: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 28: RESULT: ecpg1_regression offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: query: select current_database ( ); with 0 parameter(s) on connection first
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 29: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 29: RESULT: ecpg2_regression offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: query: select current_database ( ); with 0 parameter(s) on connection second
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 30: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 30: RESULT: ecpg1_regression offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: query: select current_database ( ); with 0 parameter(s) on connection first
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 33: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 33: RESULT: ecpg2_regression offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection first closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: query: select current_database ( ); with 0 parameter(s) on connection second
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 37: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 37: RESULT: ecpg1_regression offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -220 on line 40: connection "first" does not exist on line 40
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: ecpg_finish: connection second closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/connect-test2.stdout b/src/interfaces/ecpg/test/expected/connect-test2.stdout
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test2.stdout
diff --git a/src/interfaces/ecpg/test/expected/connect-test3.c b/src/interfaces/ecpg/test/expected/connect-test3.c
new file mode 100644
index 0000000..1a74a06
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test3.c
@@ -0,0 +1,106 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "test3.pgc"
+/*
+ * this file just tests the several possibilities you have for a disconnect
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 10 "test3.pgc"
+
+
+int
+main(void)
+{
+/* exec sql begin declare section */
+
+
+
+#line 16 "test3.pgc"
+ char id [ 200 ] ;
+
+#line 17 "test3.pgc"
+ char res [ 200 ] ;
+/* exec sql end declare section */
+#line 18 "test3.pgc"
+
+
+ ECPGdebug(1, stderr);
+
+ strcpy(id, "first");
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , id, 0); }
+#line 23 "test3.pgc"
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "second", 0); }
+#line 24 "test3.pgc"
+
+
+ /* this selects from "second" which was opened last */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select current_database ( )", ECPGt_EOIT,
+ ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 27 "test3.pgc"
+
+
+ /* will close "second" */
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 30 "test3.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select current_database ( )", ECPGt_EOIT,
+ ECPGt_char,(res),(long)200,(long)1,(200)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 31 "test3.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "second", 0); }
+#line 33 "test3.pgc"
+
+ /* will close "second" */
+ { ECPGdisconnect(__LINE__, "DEFAULT");}
+#line 35 "test3.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "second", 0); }
+#line 37 "test3.pgc"
+
+ { ECPGdisconnect(__LINE__, "ALL");}
+#line 38 "test3.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 40 "test3.pgc"
+
+ { ECPGdisconnect(__LINE__, "DEFAULT");}
+#line 41 "test3.pgc"
+
+ { ECPGdisconnect(__LINE__, "ALL");}
+#line 42 "test3.pgc"
+
+
+ /*
+ * exec sql disconnect;
+ * exec sql disconnect name;
+ *
+ * are used in other tests
+ */
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/connect-test3.stderr b/src/interfaces/ecpg/test/expected/connect-test3.stderr
new file mode 100644
index 0000000..af5d051
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test3.stderr
@@ -0,0 +1,38 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 27: query: select current_database ( ); with 0 parameter(s) on connection second
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 27: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 27: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 27: RESULT: ecpg1_regression offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection second closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: query: select current_database ( ); with 0 parameter(s) on connection first
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 31: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 31: RESULT: ecpg2_regression offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -220 on line 35: connection "DEFAULT" does not exist on line 35
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: ECPGconnect: connection identifier second is already in use
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection second closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection first closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -220 on line 40: connection "CURRENT" does not exist on line 40
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: raising sqlcode -220 on line 41: connection "DEFAULT" does not exist on line 41
+[NO_PID]: sqlca: code: -220, state: 08003
diff --git a/src/interfaces/ecpg/test/expected/connect-test3.stdout b/src/interfaces/ecpg/test/expected/connect-test3.stdout
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test3.stdout
diff --git a/src/interfaces/ecpg/test/expected/connect-test4.c b/src/interfaces/ecpg/test/expected/connect-test4.c
new file mode 100644
index 0000000..ff13e4ec
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test4.c
@@ -0,0 +1,44 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "test4.pgc"
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 6 "test4.pgc"
+
+
+int
+main(void)
+{
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "main", 0); }
+#line 13 "test4.pgc"
+
+
+ { ECPGsetconn(__LINE__, "main");}
+#line 15 "test4.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "DEFAULT");}
+#line 17 "test4.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/connect-test4.stderr b/src/interfaces/ecpg/test/expected/connect-test4.stderr
new file mode 100644
index 0000000..47a9361
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test4.stderr
@@ -0,0 +1,6 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -220 on line 17: connection "DEFAULT" does not exist on line 17
+[NO_PID]: sqlca: code: -220, state: 08003
diff --git a/src/interfaces/ecpg/test/expected/connect-test4.stdout b/src/interfaces/ecpg/test/expected/connect-test4.stdout
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test4.stdout
diff --git a/src/interfaces/ecpg/test/expected/connect-test5.c b/src/interfaces/ecpg/test/expected/connect-test5.c
new file mode 100644
index 0000000..c1124c6
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test5.c
@@ -0,0 +1,158 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "test5.pgc"
+/*
+ * this file tests all sorts of connecting to one single database.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/* do not include regression.h */
+
+int
+main(void)
+{
+/* exec sql begin declare section */
+
+
+
+
+#line 16 "test5.pgc"
+ char db [ 200 ] ;
+
+#line 17 "test5.pgc"
+ char id [ 200 ] ;
+
+#line 18 "test5.pgc"
+ char * user = "regress_ecpg_user1" ;
+/* exec sql end declare section */
+#line 19 "test5.pgc"
+
+
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }
+#line 23 "test5.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter user regress_ecpg_user2 encrypted password 'insecure'", ECPGt_EOIT, ECPGt_EORT);}
+#line 24 "test5.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter user regress_ecpg_user1 encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);}
+#line 25 "test5.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");}
+#line 26 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 27 "test5.pgc"
+ /* <-- "main" not specified */
+
+ strcpy(db, "ecpg2_regression");
+ strcpy(id, "main");
+ { ECPGconnect(__LINE__, 0, db , NULL, NULL , id, 0); }
+#line 31 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, id);}
+#line 32 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }
+#line 34 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 35 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }
+#line 37 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 38 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }
+#line 40 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 41 "test5.pgc"
+
+
+ /* exec sql connect to as main user regress_ecpg_user2/insecure;
+ exec sql disconnect main; */
+
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
+#line 46 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 47 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
+#line 49 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 50 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
+#line 52 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 53 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/ecpg2_regression" , user , "connectpw" , "main", 0); }
+#line 55 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 56 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/ecpg2_regression?connect_timeout=180 & client_encoding=latin1" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
+#line 58 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 59 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://200.46.204.71/ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
+#line 61 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 62 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/?gssencmode=disable" , "regress_ecpg_user2" , "insecure" , "main", 0); }
+#line 64 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 65 "test5.pgc"
+
+
+ /* connect twice */
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }
+#line 68 "test5.pgc"
+
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }
+#line 69 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 70 "test5.pgc"
+
+
+ /* not connected */
+ { ECPGdisconnect(__LINE__, "nonexistent");}
+#line 73 "test5.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/connect-test5.stderr b/src/interfaces/ecpg/test/expected/connect-test5.stderr
new file mode 100644
index 0000000..01a6a0a
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test5.stderr
@@ -0,0 +1,80 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: query: alter user regress_ecpg_user2 encrypted password 'insecure'; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 24: OK: ALTER ROLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: query: alter user regress_ecpg_user1 encrypted password 'connectpw'; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 25: OK: ALTER ROLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 26: 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
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> with options connect_timeout=180 & client_encoding=latin1 for user regress_ecpg_user1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: non-localhost access via sockets on line 61
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -402 on line 61: could not connect to database "ecpg2_regression" on line 61
+[NO_PID]: sqlca: code: -402, state: 08001
+[NO_PID]: raising sqlcode -220 on line 62: connection "main" does not exist on line 62
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: ECPGconnect: opening database <DEFAULT> on <DEFAULT> port <DEFAULT> with options gssencmode=disable for user regress_ecpg_user2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: connection to server failed: FATAL: database "regress_ecpg_user2" does not exist
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -402 on line 64: could not connect to database "<DEFAULT>" on line 64
+[NO_PID]: sqlca: code: -402, state: 08001
+[NO_PID]: raising sqlcode -220 on line 65: connection "main" does not exist on line 65
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: connection identifier main is already in use
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection main closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -220 on line 73: connection "nonexistent" does not exist on line 73
+[NO_PID]: sqlca: code: -220, state: 08003
diff --git a/src/interfaces/ecpg/test/expected/connect-test5.stdout b/src/interfaces/ecpg/test/expected/connect-test5.stdout
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test5.stdout
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c
new file mode 100644
index 0000000..ee867b6
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c
@@ -0,0 +1,469 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "dt_test.pgc"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <pgtypes_date.h>
+#include <pgtypes_timestamp.h>
+#include <pgtypes_interval.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 8 "dt_test.pgc"
+
+
+int
+main(void)
+{
+ /* exec sql begin declare section */
+
+
+
+
+
+#line 14 "dt_test.pgc"
+ date date1 ;
+
+#line 15 "dt_test.pgc"
+ timestamp ts1 ;
+
+#line 16 "dt_test.pgc"
+ interval * iv1 , iv2 ;
+
+#line 17 "dt_test.pgc"
+ char * text ;
+/* exec sql end declare section */
+#line 18 "dt_test.pgc"
+
+ date date2;
+ int mdy[3] = { 4, 19, 1998 };
+ char *fmt, *out, *in;
+ char *d1 = "Mon Jan 17 1966";
+ char *t1 = "2000-7-12 17:34:29";
+ int i;
+
+ ECPGdebug(1, stderr);
+ /* exec sql whenever sqlerror do sqlprint ( ) ; */
+#line 27 "dt_test.pgc"
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 28 "dt_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 28 "dt_test.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table date_test ( d date , ts timestamp )", ECPGt_EOIT, ECPGt_EORT);
+#line 29 "dt_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 29 "dt_test.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+#line 30 "dt_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 30 "dt_test.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set intervalstyle to postgres_verbose", ECPGt_EOIT, ECPGt_EORT);
+#line 31 "dt_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 31 "dt_test.pgc"
+
+
+ date1 = PGTYPESdate_from_asc(d1, NULL);
+ ts1 = PGTYPEStimestamp_from_asc(t1, NULL);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into date_test ( d , ts ) values ( $1 , $2 )",
+ ECPGt_date,&(date1),(long)1,(long)1,sizeof(date),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_timestamp,&(ts1),(long)1,(long)1,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 36 "dt_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 36 "dt_test.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from date_test where d = $1 ",
+ ECPGt_date,&(date1),(long)1,(long)1,sizeof(date),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_date,&(date1),(long)1,(long)1,sizeof(date),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_timestamp,&(ts1),(long)1,(long)1,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 38 "dt_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 38 "dt_test.pgc"
+
+
+ text = PGTYPESdate_to_asc(date1);
+ printf ("Date: %s\n", text);
+ PGTYPESchar_free(text);
+
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf ("timestamp: %s\n", text);
+ PGTYPESchar_free(text);
+
+ iv1 = PGTYPESinterval_from_asc("13556 days 12 hours 34 minutes 14 seconds ", NULL);
+ PGTYPESinterval_copy(iv1, &iv2);
+ text = PGTYPESinterval_to_asc(&iv2);
+ printf ("interval: %s\n", text);
+ PGTYPESinterval_free(iv1);
+ PGTYPESchar_free(text);
+
+ PGTYPESdate_mdyjul(mdy, &date2);
+ printf("m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
+ /* reset */
+ mdy[0] = mdy[1] = mdy[2] = 0;
+
+ printf("date seems to get encoded to julian %ld\n", date2);
+
+ PGTYPESdate_julmdy(date2, mdy);
+ printf("m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
+
+ ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ fmt = "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end";
+ out = (char*) malloc(strlen(fmt) + 1);
+ date1 = PGTYPESdate_from_timestamp(ts1);
+ PGTYPESdate_fmt_asc(date1, fmt, out);
+ printf("date_day of %s is %d\n", text, PGTYPESdate_dayofweek(date1));
+ printf("Above date in format \"%s\" is \"%s\"\n", fmt, out);
+ PGTYPESchar_free(text);
+ free(out);
+
+ out = (char*) malloc(48);
+ i = PGTYPEStimestamp_fmt_asc(&ts1, out, 47, "Which is day number %j in %Y.");
+ printf("%s\n", out);
+ free(out);
+
+
+ /* rdate_defmt_asc() */
+
+ date1 = 0;
+ fmt = "yy/mm/dd";
+ in = "In the year 1995, the month of December, it is the 25th day";
+ /* 0123456789012345678901234567890123456789012345678901234567890
+ * 0 1 2 3 4 5 6
+ */
+ PGTYPESdate_defmt_asc(&date1, fmt, in);
+ text = PGTYPESdate_to_asc(date1);
+ printf("date_defmt_asc1: %s\n", text);
+ PGTYPESchar_free(text);
+
+ date1 = 0;
+ fmt = "mmmm. dd. yyyy";
+ in = "12/25/95";
+ PGTYPESdate_defmt_asc(&date1, fmt, in);
+ text = PGTYPESdate_to_asc(date1);
+ printf("date_defmt_asc2: %s\n", text);
+ PGTYPESchar_free(text);
+
+ date1 = 0;
+ fmt = "yy/mm/dd";
+ in = "95/12/25";
+ PGTYPESdate_defmt_asc(&date1, fmt, in);
+ text = PGTYPESdate_to_asc(date1);
+ printf("date_defmt_asc3: %s\n", text);
+ PGTYPESchar_free(text);
+
+ date1 = 0;
+ fmt = "yy/mm/dd";
+ in = "1995, December 25th";
+ PGTYPESdate_defmt_asc(&date1, fmt, in);
+ text = PGTYPESdate_to_asc(date1);
+ printf("date_defmt_asc4: %s\n", text);
+ PGTYPESchar_free(text);
+
+ date1 = 0;
+ fmt = "dd-mm-yy";
+ in = "This is 25th day of December, 1995";
+ PGTYPESdate_defmt_asc(&date1, fmt, in);
+ text = PGTYPESdate_to_asc(date1);
+ printf("date_defmt_asc5: %s\n", text);
+ PGTYPESchar_free(text);
+
+ date1 = 0;
+ fmt = "mmddyy";
+ in = "Dec. 25th, 1995";
+ PGTYPESdate_defmt_asc(&date1, fmt, in);
+ text = PGTYPESdate_to_asc(date1);
+ printf("date_defmt_asc6: %s\n", text);
+ PGTYPESchar_free(text);
+
+ date1 = 0;
+ fmt = "mmm. dd. yyyy";
+ in = "dec 25th 1995";
+ PGTYPESdate_defmt_asc(&date1, fmt, in);
+ text = PGTYPESdate_to_asc(date1);
+ printf("date_defmt_asc7: %s\n", text);
+ PGTYPESchar_free(text);
+
+ date1 = 0;
+ fmt = "mmm. dd. yyyy";
+ in = "DEC-25-1995";
+ PGTYPESdate_defmt_asc(&date1, fmt, in);
+ text = PGTYPESdate_to_asc(date1);
+ printf("date_defmt_asc8: %s\n", text);
+ PGTYPESchar_free(text);
+
+ date1 = 0;
+ fmt = "mm yy dd.";
+ in = "12199525";
+ PGTYPESdate_defmt_asc(&date1, fmt, in);
+ text = PGTYPESdate_to_asc(date1);
+ printf("date_defmt_asc9: %s\n", text);
+ PGTYPESchar_free(text);
+
+ date1 = 0;
+ fmt = "yyyy fierj mm dd.";
+ in = "19951225";
+ PGTYPESdate_defmt_asc(&date1, fmt, in);
+ text = PGTYPESdate_to_asc(date1);
+ printf("date_defmt_asc10: %s\n", text);
+ PGTYPESchar_free(text);
+
+ date1 = 0;
+ fmt = "mm/dd/yy";
+ in = "122595";
+ PGTYPESdate_defmt_asc(&date1, fmt, in);
+ text = PGTYPESdate_to_asc(date1);
+ printf("date_defmt_asc12: %s\n", text);
+ PGTYPESchar_free(text);
+
+ PGTYPEStimestamp_current(&ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ /* can't output this in regression mode */
+ /* printf("timestamp_current: Now: %s\n", text); */
+ PGTYPESchar_free(text);
+
+ ts1 = PGTYPEStimestamp_from_asc("96-02-29", NULL);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_to_asc1: %s\n", text);
+ PGTYPESchar_free(text);
+
+ ts1 = PGTYPEStimestamp_from_asc("1994-02-11 3:10:35", NULL);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_to_asc2: %s\n", text);
+ PGTYPESchar_free(text);
+
+ ts1 = PGTYPEStimestamp_from_asc("1994-02-11 26:10:35", NULL);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_to_asc3: %s\n", text);
+ PGTYPESchar_free(text);
+
+/* abc-03:10:35-def-02/11/94-gh */
+/* 12345678901234567890123456789 */
+
+ out = (char*) malloc(32);
+ i = PGTYPEStimestamp_fmt_asc(&ts1, out, 31, "abc-%X-def-%x-ghi%%");
+ printf("timestamp_fmt_asc: %d: %s\n", i, out);
+ free(out);
+
+ fmt = "This is a %m/%d/%y %H-%Ml%Stest";
+ in = "This is a 4/12/80 3-39l12test";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "%a %b %d %H:%M:%S %z %Y";
+ in = "Tue Jul 22 17:28:44 +0200 2003";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "%a %b %d %H:%M:%S %z %Y";
+ in = "Tue Feb 29 17:28:44 +0200 2000";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "%a %b %d %H:%M:%S %z %Y";
+ in = "Tue Feb 29 17:28:44 +0200 1900";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "%a %b %d %H:%M:%S %z %Y";
+ in = "Tue Feb 29 17:28:44 +0200 1996";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "%b %d %H:%M:%S %z %Y";
+ in = " Jul 31 17:28:44 +0200 1996";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "%b %d %H:%M:%S %z %Y";
+ in = " Jul 32 17:28:44 +0200 1996";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "%a %b %d %H:%M:%S %z %Y";
+ in = "Tue Feb 29 17:28:44 +0200 1997";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "%";
+ in = "Tue Jul 22 17:28:44 +0200 2003";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "a %";
+ in = "Tue Jul 22 17:28:44 +0200 2003";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "%b, %d %H_%M`%S %z %Y";
+ in = " Jul, 22 17_28 `44 +0200 2003 ";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "%a %b %%%d %H:%M:%S %Z %Y";
+ in = "Tue Jul %22 17:28:44 CEST 2003";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "%a %b %%%d %H:%M:%S %Z %Y";
+ in = "Tue Jul %22 17:28:44 CEST 2003";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "abc%n %C %B %%%d %H:%M:%S %Z %Y";
+ in = "abc\n 19 October %22 17:28:44 CEST 2003";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "abc%n %C %B %%%d %H:%M:%S %Z %y";
+ in = "abc\n 18 October %34 17:28:44 CEST 80";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "";
+ in = "abc\n 18 October %34 17:28:44 CEST 80";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = NULL;
+ in = "1980-04-12 3:49:44 ";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, NULL) = %s, error: %d\n", in, text, i);
+ PGTYPESchar_free(text);
+
+ fmt = "%B %d, %Y. Time: %I:%M%p";
+ in = "July 14, 1988. Time: 9:15am";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ in = "September 6 at 01:30 pm in the year 1983";
+ fmt = "%B %d at %I:%M %p in the year %Y";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ in = " 1976, July 14. Time: 9:15am";
+ fmt = "%Y, %B %d. Time: %I:%M %p";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ in = " 1976, July 14. Time: 9:15 am";
+ fmt = "%Y, %B %d. Time: %I:%M%p";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ in = " 1976, P.M. July 14. Time: 9:15";
+ fmt = "%Y, %P %B %d. Time: %I:%M";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ in = "1234567890";
+ fmt = "%s";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, text, i);
+ PGTYPESchar_free(text);
+
+ out = (char*) malloc(64);
+ fmt = "%a %b %d %H:%M:%S %Y";
+ in = "Mon Dec 30 17:28:44 2019";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ i = PGTYPEStimestamp_fmt_asc(&ts1, out, 63, fmt);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, out, i);
+ free(out);
+
+ out = (char*) malloc(64);
+ fmt = "%a %b %d %H:%M:%S %Y";
+ in = "Mon December 30 17:28:44 2019";
+ i = PGTYPEStimestamp_defmt_asc(in, fmt, &ts1);
+ i = PGTYPEStimestamp_fmt_asc(&ts1, out, 63, fmt);
+ printf("timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, out, i);
+ free(out);
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 381 "dt_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 381 "dt_test.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 382 "dt_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 382 "dt_test.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stderr b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stderr
new file mode 100644
index 0000000..6e9ed3d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stderr
@@ -0,0 +1,48 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: query: create table date_test ( d date , ts timestamp ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 29: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: query: set datestyle to iso; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 30: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: query: set intervalstyle to postgres_verbose; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 31: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: insert into date_test ( d , ts ) values ( $1 , $2 ); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 36: parameter 1 = 1966-01-17
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 36: parameter 2 = 2000-07-12 17:34:29
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: query: select * from date_test where d = $1 ; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 38: parameter 1 = 1966-01-17
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 38: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 38: RESULT: 1966-01-17 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 38: RESULT: 2000-07-12 17:34:29 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 381: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stdout b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stdout
new file mode 100644
index 0000000..4b582fd
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stdout
@@ -0,0 +1,52 @@
+Date: 1966-01-17
+timestamp: 2000-07-12 17:34:29
+interval: @ 13556 days 12 hours 34 mins 14 secs
+m: 4, d: 19, y: 1998
+date seems to get encoded to julian -622
+m: 4, d: 19, y: 1998
+date_day of 2003-12-04 17:34:29 is 4
+Above date in format "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end" is "(Thu), Dec. 04, 2003, repeat: (Thu), Dec. 04, 2003. end"
+Which is day number 338 in 2003.
+date_defmt_asc1: 1995-12-25
+date_defmt_asc2: 0095-12-25
+date_defmt_asc3: 0095-12-25
+date_defmt_asc4: 1995-12-25
+date_defmt_asc5: 1995-12-25
+date_defmt_asc6: 1995-12-25
+date_defmt_asc7: 1995-12-25
+date_defmt_asc8: 1995-12-25
+date_defmt_asc9: 1995-12-25
+date_defmt_asc10: 1995-12-25
+date_defmt_asc12: 0095-12-25
+timestamp_to_asc1: 1996-02-29 00:00:00
+timestamp_to_asc2: 1994-02-11 03:10:35
+timestamp_to_asc3: 2000-01-01 00:00:00
+timestamp_fmt_asc: 0: abc-00:00:00-def-01/01/00-ghi%
+timestamp_defmt_asc(This is a 4/12/80 3-39l12test, This is a %m/%d/%y %H-%Ml%Stest) = 1980-04-12 03:39:12, error: 0
+timestamp_defmt_asc(Tue Jul 22 17:28:44 +0200 2003, %a %b %d %H:%M:%S %z %Y) = 2003-07-22 15:28:44, error: 0
+timestamp_defmt_asc(Tue Feb 29 17:28:44 +0200 2000, %a %b %d %H:%M:%S %z %Y) = 2000-02-29 15:28:44, error: 0
+timestamp_defmt_asc(Tue Feb 29 17:28:44 +0200 1900, %a %b %d %H:%M:%S %z %Y) = 1900-02-28 15:28:44, error (should be error!): 1
+timestamp_defmt_asc(Tue Feb 29 17:28:44 +0200 1996, %a %b %d %H:%M:%S %z %Y) = 1996-02-29 15:28:44, error: 0
+timestamp_defmt_asc( Jul 31 17:28:44 +0200 1996, %b %d %H:%M:%S %z %Y) = 1996-07-31 15:28:44, error: 0
+timestamp_defmt_asc( Jul 32 17:28:44 +0200 1996, %b %d %H:%M:%S %z %Y) = 1996-07-31 15:28:44, error (should be error!): 1
+timestamp_defmt_asc(Tue Feb 29 17:28:44 +0200 1997, %a %b %d %H:%M:%S %z %Y) = 1997-02-28 15:28:44, error (should be error!): 1
+timestamp_defmt_asc(Tue Jul 22 17:28:44 +0200 2003, %) = 1997-02-28 15:28:44, error (should be error!): 1
+timestamp_defmt_asc(Tue Jul 22 17:28:44 +0200 2003, a %) = 1997-02-28 15:28:44, error (should be error!): 1
+timestamp_defmt_asc( Jul, 22 17_28 `44 +0200 2003 , %b, %d %H_%M`%S %z %Y) = 2003-07-22 15:28:44, error: 0
+timestamp_defmt_asc(Tue Jul %22 17:28:44 CEST 2003, %a %b %%%d %H:%M:%S %Z %Y) = 2003-07-22 15:28:44, error: 0
+timestamp_defmt_asc(Tue Jul %22 17:28:44 CEST 2003, %a %b %%%d %H:%M:%S %Z %Y) = 2003-07-22 15:28:44, error: 0
+timestamp_defmt_asc(abc
+ 19 October %22 17:28:44 CEST 2003, abc%n %C %B %%%d %H:%M:%S %Z %Y) = 2003-10-22 15:28:44, error: 0
+timestamp_defmt_asc(abc
+ 18 October %34 17:28:44 CEST 80, abc%n %C %B %%%d %H:%M:%S %Z %y) = 1880-10-31 15:28:44, error (should be error!): 1
+timestamp_defmt_asc(abc
+ 18 October %34 17:28:44 CEST 80, ) = 1880-10-31 15:28:44, error (should be error!): 1
+timestamp_defmt_asc(1980-04-12 3:49:44 , NULL) = 1980-04-12 03:49:44, error: 0
+timestamp_defmt_asc(July 14, 1988. Time: 9:15am, %B %d, %Y. Time: %I:%M%p) = 1988-07-14 09:15:00, error: 0
+timestamp_defmt_asc(September 6 at 01:30 pm in the year 1983, %B %d at %I:%M %p in the year %Y) = 1983-09-06 13:30:00, error: 0
+timestamp_defmt_asc( 1976, July 14. Time: 9:15am, %Y, %B %d. Time: %I:%M %p) = 1976-07-14 09:15:00, error: 0
+timestamp_defmt_asc( 1976, July 14. Time: 9:15 am, %Y, %B %d. Time: %I:%M%p) = 1976-07-14 09:15:00, error: 0
+timestamp_defmt_asc( 1976, P.M. July 14. Time: 9:15, %Y, %P %B %d. Time: %I:%M) = 1976-07-14 21:15:00, error: 0
+timestamp_defmt_asc(1234567890, %s) = 2009-02-13 23:31:30, error: 0
+timestamp_defmt_asc(Mon Dec 30 17:28:44 2019, %a %b %d %H:%M:%S %Y) = Mon Dec 30 17:28:44 2019, error: 0
+timestamp_defmt_asc(Mon December 30 17:28:44 2019, %a %b %d %H:%M:%S %Y) = Mon Dec 30 17:28:44 2019, error: 0
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
new file mode 100644
index 0000000..b3e1e75
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
@@ -0,0 +1,186 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "dt_test2.pgc"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <pgtypes_date.h>
+#include <pgtypes_timestamp.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 8 "dt_test2.pgc"
+
+
+char *dates[] = { "19990108foobar",
+ "19990108 foobar",
+ "1999-01-08 foobar",
+ "January 8, 1999",
+ "1999-01-08",
+ "1/8/1999",
+ "1/18/1999",
+ "01/02/03",
+ "1999-Jan-08",
+ "Jan-08-1999",
+ "08-Jan-1999",
+ "99-Jan-08",
+ "08-Jan-99",
+ "08-Jan-06",
+ "Jan-08-99",
+ "19990108",
+ "990108",
+ "1999.008",
+ "J2451187",
+ "January 8, 99 BC",
+ /*
+ * Maximize space usage in ParseDateTime() with 25
+ * (MAXDATEFIELDS) fields and 128 (MAXDATELEN) total length.
+ */
+ "........................Xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ /* 26 fields */
+ ".........................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ NULL };
+
+/* do not conflict with libc "times" symbol */
+static char *times[] = { "0:04",
+ "1:59 PDT",
+ "13:24:40 -8:00",
+ "13:24:40.495+3",
+ "13:24:40.123456123+3",
+ NULL };
+
+char *intervals[] = { "1 minute",
+ "1 12:59:10",
+ "2 day 12 hour 59 minute 10 second",
+ "1 days 12 hrs 59 mins 10 secs",
+ "1 days 1 hours 1 minutes 1 seconds",
+ "1 year 59 mins",
+ "1 year 59 mins foobar",
+ NULL };
+
+int
+main(void)
+{
+ /* exec sql begin declare section */
+
+
+
+
+
+
+#line 62 "dt_test2.pgc"
+ date date1 ;
+
+#line 63 "dt_test2.pgc"
+ timestamp ts1 , ts2 ;
+
+#line 64 "dt_test2.pgc"
+ char * text ;
+
+#line 65 "dt_test2.pgc"
+ interval * i1 ;
+
+#line 66 "dt_test2.pgc"
+ date * dc ;
+/* exec sql end declare section */
+#line 67 "dt_test2.pgc"
+
+
+ int i, j;
+ char *endptr;
+
+ ECPGdebug(1, stderr);
+
+ ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
+ text = PGTYPEStimestamp_to_asc(ts1);
+
+ printf("timestamp: %s\n", text);
+ PGTYPESchar_free(text);
+
+ date1 = PGTYPESdate_from_timestamp(ts1);
+ dc = PGTYPESdate_new();
+ *dc = date1;
+ text = PGTYPESdate_to_asc(*dc);
+ printf("Date of timestamp: %s\n", text);
+ PGTYPESchar_free(text);
+ PGTYPESdate_free(dc);
+
+ for (i = 0; dates[i]; i++)
+ {
+ bool err = false;
+ date1 = PGTYPESdate_from_asc(dates[i], &endptr);
+ if (date1 == INT_MIN) {
+ err = true;
+ }
+ text = PGTYPESdate_to_asc(date1);
+ printf("Date[%d]: %s (%c - %c)\n",
+ i, err ? "-" : text,
+ endptr ? 'N' : 'Y',
+ err ? 'T' : 'F');
+ PGTYPESchar_free(text);
+ if (!err)
+ {
+ for (j = 0; times[j]; j++)
+ {
+ int length = strlen(dates[i])
+ + 1
+ + strlen(times[j])
+ + 1;
+ char* t = malloc(length);
+ sprintf(t, "%s %s", dates[i], times[j]);
+ ts1 = PGTYPEStimestamp_from_asc(t, NULL);
+ text = PGTYPEStimestamp_to_asc(ts1);
+ printf("TS[%d,%d]: %s\n",
+ i, j, errno ? "-" : text);
+ PGTYPESchar_free(text);
+ free(t);
+ }
+ }
+ }
+
+ ts1 = PGTYPEStimestamp_from_asc("2004-04-04 23:23:23", NULL);
+
+ for (i = 0; intervals[i]; i++)
+ {
+ interval *ic;
+ i1 = PGTYPESinterval_from_asc(intervals[i], &endptr);
+ if (*endptr)
+ printf("endptr set to %s\n", endptr);
+ if (!i1)
+ {
+ printf("Error parsing interval %d\n", i);
+ continue;
+ }
+ j = PGTYPEStimestamp_add_interval(&ts1, i1, &ts2);
+ if (j < 0)
+ continue;
+ text = PGTYPESinterval_to_asc(i1);
+ printf("interval[%d]: %s\n", i, text ? text : "-");
+ PGTYPESchar_free(text);
+
+ ic = PGTYPESinterval_new();
+ PGTYPESinterval_copy(i1, ic);
+ text = PGTYPESinterval_to_asc(i1);
+ printf("interval_copy[%d]: %s\n", i, text ? text : "-");
+ PGTYPESchar_free(text);
+ PGTYPESinterval_free(ic);
+ PGTYPESinterval_free(i1);
+ }
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stderr b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stderr
new file mode 100644
index 0000000..1a3639d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stderr
@@ -0,0 +1,2 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout
new file mode 100644
index 0000000..0fbcce6
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout
@@ -0,0 +1,122 @@
+timestamp: 2003-12-04 17:34:29
+Date of timestamp: 2003-12-04
+Date[0]: - (N - T)
+Date[1]: - (N - T)
+Date[2]: - (N - T)
+Date[3]: 1999-01-08 (N - F)
+TS[3,0]: 1999-01-08 00:04:00
+TS[3,1]: 1999-01-08 01:59:00
+TS[3,2]: 1999-01-08 13:24:40
+TS[3,3]: 1999-01-08 13:24:40.495
+TS[3,4]: 1999-01-08 13:24:40.123456
+Date[4]: 1999-01-08 (N - F)
+TS[4,0]: 1999-01-08 00:04:00
+TS[4,1]: 1999-01-08 01:59:00
+TS[4,2]: 1999-01-08 13:24:40
+TS[4,3]: 1999-01-08 13:24:40.495
+TS[4,4]: 1999-01-08 13:24:40.123456
+Date[5]: 1999-01-08 (N - F)
+TS[5,0]: 1999-01-08 00:04:00
+TS[5,1]: 1999-01-08 01:59:00
+TS[5,2]: 1999-01-08 13:24:40
+TS[5,3]: 1999-01-08 13:24:40.495
+TS[5,4]: 1999-01-08 13:24:40.123456
+Date[6]: 1999-01-18 (N - F)
+TS[6,0]: 1999-01-18 00:04:00
+TS[6,1]: 1999-01-18 01:59:00
+TS[6,2]: 1999-01-18 13:24:40
+TS[6,3]: 1999-01-18 13:24:40.495
+TS[6,4]: 1999-01-18 13:24:40.123456
+Date[7]: 2003-01-02 (N - F)
+TS[7,0]: 2003-01-02 00:04:00
+TS[7,1]: 2003-01-02 01:59:00
+TS[7,2]: 2003-01-02 13:24:40
+TS[7,3]: 2003-01-02 13:24:40.495
+TS[7,4]: 2003-01-02 13:24:40.123456
+Date[8]: 1999-01-08 (N - F)
+TS[8,0]: 1999-01-08 00:04:00
+TS[8,1]: 1999-01-08 01:59:00
+TS[8,2]: 1999-01-08 13:24:40
+TS[8,3]: 1999-01-08 13:24:40.495
+TS[8,4]: 1999-01-08 13:24:40.123456
+Date[9]: 1999-01-08 (N - F)
+TS[9,0]: 1999-01-08 00:04:00
+TS[9,1]: 1999-01-08 01:59:00
+TS[9,2]: 1999-01-08 13:24:40
+TS[9,3]: 1999-01-08 13:24:40.495
+TS[9,4]: 1999-01-08 13:24:40.123456
+Date[10]: 1999-01-08 (N - F)
+TS[10,0]: 1999-01-08 00:04:00
+TS[10,1]: 1999-01-08 01:59:00
+TS[10,2]: 1999-01-08 13:24:40
+TS[10,3]: 1999-01-08 13:24:40.495
+TS[10,4]: 1999-01-08 13:24:40.123456
+Date[11]: 1999-01-08 (N - F)
+TS[11,0]: 1999-01-08 00:04:00
+TS[11,1]: 1999-01-08 01:59:00
+TS[11,2]: 1999-01-08 13:24:40
+TS[11,3]: 1999-01-08 13:24:40.495
+TS[11,4]: 1999-01-08 13:24:40.123456
+Date[12]: 1999-01-08 (N - F)
+TS[12,0]: 1999-01-08 00:04:00
+TS[12,1]: 1999-01-08 01:59:00
+TS[12,2]: 1999-01-08 13:24:40
+TS[12,3]: 1999-01-08 13:24:40.495
+TS[12,4]: 1999-01-08 13:24:40.123456
+Date[13]: 2006-01-08 (N - F)
+TS[13,0]: 2006-01-08 00:04:00
+TS[13,1]: 2006-01-08 01:59:00
+TS[13,2]: 2006-01-08 13:24:40
+TS[13,3]: 2006-01-08 13:24:40.495
+TS[13,4]: 2006-01-08 13:24:40.123456
+Date[14]: 1999-01-08 (N - F)
+TS[14,0]: 1999-01-08 00:04:00
+TS[14,1]: 1999-01-08 01:59:00
+TS[14,2]: 1999-01-08 13:24:40
+TS[14,3]: 1999-01-08 13:24:40.495
+TS[14,4]: 1999-01-08 13:24:40.123456
+Date[15]: 1999-01-08 (N - F)
+TS[15,0]: 1999-01-08 00:04:00
+TS[15,1]: 1999-01-08 01:59:00
+TS[15,2]: 1999-01-08 13:24:40
+TS[15,3]: 1999-01-08 13:24:40.495
+TS[15,4]: 1999-01-08 13:24:40.123456
+Date[16]: 1999-01-08 (N - F)
+TS[16,0]: 1999-01-08 00:04:00
+TS[16,1]: 1999-01-08 01:59:00
+TS[16,2]: 1999-01-08 13:24:40
+TS[16,3]: 1999-01-08 13:24:40.495
+TS[16,4]: 1999-01-08 13:24:40.123456
+Date[17]: 1999-01-08 (N - F)
+TS[17,0]: 1999-01-08 00:04:00
+TS[17,1]: 1999-01-08 01:59:00
+TS[17,2]: 1999-01-08 13:24:40
+TS[17,3]: 1999-01-08 13:24:40.495
+TS[17,4]: 1999-01-08 13:24:40.123456
+Date[18]: 1999-01-08 (N - F)
+TS[18,0]: 1999-01-08 00:04:00
+TS[18,1]: 1999-01-08 01:59:00
+TS[18,2]: 1999-01-08 13:24:40
+TS[18,3]: 1999-01-08 13:24:40.495
+TS[18,4]: 1999-01-08 13:24:40.123456
+Date[19]: 0099-01-08 BC (N - F)
+TS[19,0]: 0099-01-08 00:04:00 BC
+TS[19,1]: 0099-01-08 01:59:00 BC
+TS[19,2]: 0099-01-08 13:24:40 BC
+TS[19,3]: 0099-01-08 13:24:40.495 BC
+TS[19,4]: 0099-01-08 13:24:40.123456 BC
+Date[20]: - (N - T)
+Date[21]: - (N - T)
+interval[0]: @ 1 min
+interval_copy[0]: @ 1 min
+interval[1]: @ 1 day 12 hours 59 mins 10 secs
+interval_copy[1]: @ 1 day 12 hours 59 mins 10 secs
+interval[2]: @ 2 days 12 hours 59 mins 10 secs
+interval_copy[2]: @ 2 days 12 hours 59 mins 10 secs
+interval[3]: @ 1 day 12 hours 59 mins 10 secs
+interval_copy[3]: @ 1 day 12 hours 59 mins 10 secs
+interval[4]: @ 1 day 1 hour 1 min 1 sec
+interval_copy[4]: @ 1 day 1 hour 1 min 1 sec
+interval[5]: @ 1 year 59 mins
+interval_copy[5]: @ 1 year 59 mins
+Error parsing interval 6
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c b/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
new file mode 100644
index 0000000..586094c
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
@@ -0,0 +1,266 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "nan_test.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+#include <math.h>
+#include <pgtypes_numeric.h>
+#include <decimal.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 8 "nan_test.pgc"
+
+
+int
+main(void)
+{
+ /* exec sql begin declare section */
+
+
+
+
+
+#line 14 "nan_test.pgc"
+ int id , loopcount ;
+
+#line 15 "nan_test.pgc"
+ double d ;
+
+#line 16 "nan_test.pgc"
+ numeric * num ;
+
+#line 17 "nan_test.pgc"
+ char val [ 16 ] ;
+/* exec sql end declare section */
+#line 18 "nan_test.pgc"
+
+
+ ECPGdebug(1, stderr);
+ /* exec sql whenever sqlerror do sqlprint ( ) ; */
+#line 21 "nan_test.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 23 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 23 "nan_test.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table nantest1 ( id int4 , d float8 )", ECPGt_EOIT, ECPGt_EORT);
+#line 25 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 25 "nan_test.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest1 ( id , d ) values ( 1 , 'nan' :: float8 ) , ( 2 , 'infinity' :: float8 ) , ( 3 , '-infinity' :: float8 )", ECPGt_EOIT, ECPGt_EORT);
+#line 26 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 26 "nan_test.pgc"
+
+
+ /* declare cur cursor for select id , d , d from nantest1 */
+#line 28 "nan_test.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur cursor for select id , d , d from nantest1", ECPGt_EOIT, ECPGt_EORT);
+#line 29 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 29 "nan_test.pgc"
+
+ for (loopcount = 0; loopcount < 100; loopcount++)
+ {
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch from cur", ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_double,&(d),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 32 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 32 "nan_test.pgc"
+
+ if (sqlca.sqlcode)
+ break;
+ if (isnan(d))
+ printf("%d NaN '%s'\n", id, val);
+ else if (isinf(d))
+ printf("%d %sInf '%s'\n", id, (d < 0 ? "-" : "+"), val);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest1 ( id , d ) values ( $1 + 3 , $2 )",
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_double,&(d),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 40 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 40 "nan_test.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest1 ( id , d ) values ( $1 + 6 , $2 )",
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 41 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 41 "nan_test.pgc"
+
+ }
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur", ECPGt_EOIT, ECPGt_EORT);
+#line 43 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 43 "nan_test.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur cursor for select id , d , d from nantest1", ECPGt_EOIT, ECPGt_EORT);
+#line 45 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 45 "nan_test.pgc"
+
+ for (loopcount = 0; loopcount < 100; loopcount++)
+ {
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch from cur", ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_double,&(d),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 48 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 48 "nan_test.pgc"
+
+ if (sqlca.sqlcode)
+ break;
+ if (isinf(d))
+ printf("%d %sInf '%s'\n", id, (d < 0 ? "-" : "+"), val);
+ if (isnan(d))
+ printf("%d NaN '%s'\n", id, val);
+ }
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur", ECPGt_EOIT, ECPGt_EORT);
+#line 56 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 56 "nan_test.pgc"
+
+
+ num = PGTYPESnumeric_new();
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table nantest2 ( id int4 , d numeric )", ECPGt_EOIT, ECPGt_EORT);
+#line 60 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 60 "nan_test.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest2 ( id , d ) values ( 4 , 'nan' :: numeric )", ECPGt_EOIT, ECPGt_EORT);
+#line 61 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 61 "nan_test.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select id , d , d from nantest2 where id = 4", ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_numeric,&(num),(long)1,(long)0,sizeof(numeric),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 63 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 63 "nan_test.pgc"
+
+
+ printf("%d %s '%s'\n", id, (num->sign == NUMERIC_NAN ? "NaN" : "not NaN"), val);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest2 ( id , d ) values ( 5 , $1 )",
+ ECPGt_numeric,&(num),(long)1,(long)0,sizeof(numeric),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 67 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 67 "nan_test.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest2 ( id , d ) values ( 6 , $1 )",
+ ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 68 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 68 "nan_test.pgc"
+
+
+ /* declare cur1 cursor for select id , d , d from nantest2 */
+#line 70 "nan_test.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur1 cursor for select id , d , d from nantest2", ECPGt_EOIT, ECPGt_EORT);
+#line 71 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 71 "nan_test.pgc"
+
+ for (loopcount = 0; loopcount < 100; loopcount++)
+ {
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch from cur1", ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_numeric,&(num),(long)1,(long)0,sizeof(numeric),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 74 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 74 "nan_test.pgc"
+
+ if (sqlca.sqlcode)
+ break;
+ printf("%d %s '%s'\n", id, (num->sign == NUMERIC_NAN ? "NaN" : "not NaN"), val);
+ }
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur1", ECPGt_EOIT, ECPGt_EORT);
+#line 79 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 79 "nan_test.pgc"
+
+
+ PGTYPESnumeric_free(num);
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 83 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 83 "nan_test.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 84 "nan_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 84 "nan_test.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.stderr b/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.stderr
new file mode 100644
index 0000000..55471e9
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.stderr
@@ -0,0 +1,360 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: query: create table nantest1 ( id int4 , d float8 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 25: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into nantest1 ( id , d ) values ( 1 , 'nan' :: float8 ) , ( 2 , 'infinity' :: float8 ) , ( 3 , '-infinity' :: float8 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: query: declare cur cursor for select id , d , d from nantest1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 29: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: query: insert into nantest1 ( id , d ) values ( $1 + 3 , $2 ); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 40: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 40: parameter 2 = NaN
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 40: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: query: insert into nantest1 ( id , d ) values ( $1 + 6 , $2 ); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 41: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 41: parameter 2 = NaN
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 41: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: query: insert into nantest1 ( id , d ) values ( $1 + 3 , $2 ); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 40: parameter 1 = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 40: parameter 2 = Infinity
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 40: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: query: insert into nantest1 ( id , d ) values ( $1 + 6 , $2 ); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 41: parameter 1 = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 41: parameter 2 = Infinity
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 41: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: -Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: -Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: query: insert into nantest1 ( id , d ) values ( $1 + 3 , $2 ); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 40: parameter 1 = 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 40: parameter 2 = -Infinity
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 40: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: query: insert into nantest1 ( id , d ) values ( $1 + 6 , $2 ); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 41: parameter 1 = 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 41: parameter 2 = -Infinity
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 41: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: correctly got 0 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 32: no data found on line 32
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 43: query: close cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 43: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 43: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 45: query: declare cur cursor for select id , d , d from nantest1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 45: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 45: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 48: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 48: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 48: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: -Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: -Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 48: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 48: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: 7 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 48: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: 5 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 48: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: 8 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 48: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: 6 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: -Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: -Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 48: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: 9 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: -Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: -Infinity offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: query: fetch from cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 48: correctly got 0 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 48: no data found on line 48
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 56: query: close cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 56: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 56: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 60: query: create table nantest2 ( id int4 , d numeric ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 60: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 60: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 61: query: insert into nantest2 ( id , d ) values ( 4 , 'nan' :: numeric ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 61: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 61: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 63: query: select id , d , d from nantest2 where id = 4; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 63: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 63: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 63: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 63: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 63: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 67: query: insert into nantest2 ( id , d ) values ( 5 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 67: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 67: parameter 1 = NaN
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 67: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 68: query: insert into nantest2 ( id , d ) values ( 6 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 68: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 68: parameter 1 = NaN
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 68: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 71: query: declare cur1 cursor for select id , d , d from nantest2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 71: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 71: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: query: fetch from cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 74: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 74: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 74: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 74: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: query: fetch from cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 74: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 74: RESULT: 5 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 74: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 74: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: query: fetch from cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 74: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 74: RESULT: 6 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 74: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 74: RESULT: NaN offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: query: fetch from cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 74: correctly got 0 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 74: no data found on line 74
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 79: query: close cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 79: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 79: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 83: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.stdout b/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.stdout
new file mode 100644
index 0000000..635ab23
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.stdout
@@ -0,0 +1,16 @@
+1 NaN 'NaN'
+2 +Inf 'Infinity'
+3 -Inf '-Infinity'
+1 NaN 'NaN'
+2 +Inf 'Infinity'
+3 -Inf '-Infinity'
+4 NaN 'NaN'
+7 NaN 'NaN'
+5 +Inf 'Infinity'
+8 +Inf 'Infinity'
+6 -Inf '-Infinity'
+9 -Inf '-Infinity'
+4 NaN 'NaN'
+4 NaN 'NaN'
+5 NaN 'NaN'
+6 NaN 'NaN'
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
new file mode 100644
index 0000000..ddb7860
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
@@ -0,0 +1,202 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "num_test.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <pgtypes_numeric.h>
+#include <decimal.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 6 "num_test.pgc"
+
+
+
+#line 1 "printf_hack.h"
+/*
+ * print_double(x) has the same effect as printf("%g", x), but is intended
+ * to produce the same formatting across all platforms.
+ */
+static void
+print_double(double x)
+{
+#ifdef WIN32
+ /* Change Windows' 3-digit exponents to look like everyone else's */
+ char convert[128];
+ int vallen;
+
+ sprintf(convert, "%g", x);
+ vallen = strlen(convert);
+
+ if (vallen >= 6 &&
+ convert[vallen - 5] == 'e' &&
+ convert[vallen - 3] == '0')
+ {
+ convert[vallen - 3] = convert[vallen - 2];
+ convert[vallen - 2] = convert[vallen - 1];
+ convert[vallen - 1] = '\0';
+ }
+
+ printf("%s", convert);
+#else
+ printf("%g", x);
+#endif
+}
+
+#line 8 "num_test.pgc"
+
+
+
+int
+main(void)
+{
+ char *text="error\n";
+ numeric *value1, *value2, *res;
+ /* exec sql begin declare section */
+
+ /* = {0, 0, 0, 0, 0, NULL, NULL} ; */
+
+#line 17 "num_test.pgc"
+ numeric * des ;
+/* exec sql end declare section */
+#line 19 "num_test.pgc"
+
+ double d;
+ long l1, l2;
+ int i, min, max;
+
+ ECPGdebug(1, stderr);
+ /* exec sql whenever sqlerror do sqlprint ( ) ; */
+#line 25 "num_test.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 27 "num_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 27 "num_test.pgc"
+
+
+ { ECPGsetcommit(__LINE__, "off", NULL);
+#line 29 "num_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 29 "num_test.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) )", ECPGt_EOIT, ECPGt_EORT);
+#line 30 "num_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 30 "num_test.pgc"
+
+
+ value1 = PGTYPESnumeric_new();
+ PGTYPESnumeric_from_int(1407, value1);
+ text = PGTYPESnumeric_to_asc(value1, -1);
+ printf("from int = %s\n", text);
+ PGTYPESchar_free(text);
+ PGTYPESnumeric_free(value1);
+
+ value1 = PGTYPESnumeric_from_asc("2369.7", NULL);
+ value2 = PGTYPESnumeric_from_asc("10.0", NULL);
+ res = PGTYPESnumeric_new();
+ PGTYPESnumeric_add(value1, value2, res);
+ text = PGTYPESnumeric_to_asc(res, -1);
+ printf("add = %s\n", text);
+ PGTYPESchar_free(text);
+
+ PGTYPESnumeric_sub(res, value2, res);
+ text = PGTYPESnumeric_to_asc(res, -1);
+ printf("sub = %s\n", text);
+ PGTYPESchar_free(text);
+ PGTYPESnumeric_free(value2);
+
+ des = PGTYPESnumeric_new();
+ PGTYPESnumeric_copy(res, des);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test ( text , num ) values ( 'test' , $1 )",
+ ECPGt_numeric,&(des),(long)1,(long)0,sizeof(numeric),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 55 "num_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 55 "num_test.pgc"
+
+
+ value2 = PGTYPESnumeric_from_asc("2369.7", NULL);
+ PGTYPESnumeric_mul(value1, value2, res);
+ PGTYPESnumeric_free(value2);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select num from test where text = 'test'", ECPGt_EOIT,
+ ECPGt_numeric,&(des),(long)1,(long)0,sizeof(numeric),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 61 "num_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 61 "num_test.pgc"
+
+
+ PGTYPESnumeric_mul(res, des, res);
+ text = PGTYPESnumeric_to_asc(res, -1);
+ printf("mul = %s\n", text);
+ PGTYPESchar_free(text);
+ PGTYPESnumeric_free(des);
+
+ value2 = PGTYPESnumeric_from_asc("10000", NULL);
+ PGTYPESnumeric_div(res, value2, res);
+ text = PGTYPESnumeric_to_asc(res, -1);
+ PGTYPESnumeric_to_double(res, &d);
+ printf("div = %s ", text);
+ print_double(d);
+ printf("\n");
+
+ PGTYPESnumeric_free(value1);
+ PGTYPESnumeric_free(value2);
+
+ value1 = PGTYPESnumeric_from_asc("2E7", NULL);
+ value2 = PGTYPESnumeric_from_asc("14", NULL);
+ i = PGTYPESnumeric_to_long(value1, &l1) | PGTYPESnumeric_to_long(value2, &l2);
+ printf("to long(%d) = %ld %ld\n", i, l1, l2);
+
+ PGTYPESchar_free(text);
+ PGTYPESnumeric_free(value1);
+ PGTYPESnumeric_free(value2);
+ PGTYPESnumeric_free(res);
+
+ /* check conversion of numeric to int */
+ value1 = PGTYPESnumeric_from_asc("-2147483648", NULL);
+ PGTYPESnumeric_to_int(value1, &min);
+ printf("min int = %d\n", min);
+ PGTYPESnumeric_free(value1);
+
+ value2 = PGTYPESnumeric_from_asc("2147483647", NULL);
+ PGTYPESnumeric_to_int(value2, &max);
+ printf("max int = %d\n", max);
+ PGTYPESnumeric_free(value2);
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 101 "num_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 101 "num_test.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 102 "num_test.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 102 "num_test.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr
new file mode 100644
index 0000000..10cfd91
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr
@@ -0,0 +1,32 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGsetcommit on line 29: action "off"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: query: create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 30: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: insert into test ( text , num ) values ( 'test' , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 55: parameter 1 = 2369.7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 61: query: select num from test where text = 'test'; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 61: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 61: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 61: RESULT: 2369.7000000 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 101: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stdout b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stdout
new file mode 100644
index 0000000..a47a044
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stdout
@@ -0,0 +1,8 @@
+from int = 1407.0
+add = 2379.7
+sub = 2369.7
+mul = 13306998429.873000000
+div = 1330699.84298730000 1.3307e+06
+to long(0) = 20000000 14
+min int = -2147483648
+max int = 2147483647
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c
new file mode 100644
index 0000000..9debc34
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c
@@ -0,0 +1,290 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "num_test2.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <pgtypes_numeric.h>
+#include <pgtypes_error.h>
+#include <decimal.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 7 "num_test2.pgc"
+
+
+
+#line 1 "printf_hack.h"
+/*
+ * print_double(x) has the same effect as printf("%g", x), but is intended
+ * to produce the same formatting across all platforms.
+ */
+static void
+print_double(double x)
+{
+#ifdef WIN32
+ /* Change Windows' 3-digit exponents to look like everyone else's */
+ char convert[128];
+ int vallen;
+
+ sprintf(convert, "%g", x);
+ vallen = strlen(convert);
+
+ if (vallen >= 6 &&
+ convert[vallen - 5] == 'e' &&
+ convert[vallen - 3] == '0')
+ {
+ convert[vallen - 3] = convert[vallen - 2];
+ convert[vallen - 2] = convert[vallen - 1];
+ convert[vallen - 1] = '\0';
+ }
+
+ printf("%s", convert);
+#else
+ printf("%g", x);
+#endif
+}
+
+#line 9 "num_test2.pgc"
+
+
+
+char* nums[] = { "2E394", "-2", ".794", "3.44", "592.49E21", "-32.84e4",
+ "2E-394", ".1E-2", "+.0", "-592.49E-07", "+32.84e-4",
+ ".500001", "-.5000001",
+ "1234567890123456789012345678.91", /* 30 digits should fit
+ into decimal */
+ "1234567890123456789012345678.921", /* 31 digits should NOT
+ fit into decimal */
+ "not a number",
+ NULL};
+
+
+static void
+check_errno(void);
+
+int
+main(void)
+{
+ char *text="error\n";
+ char *endptr;
+ numeric *num, *nin;
+ decimal *dec;
+ long l;
+ int i, j, k, q, r, count = 0;
+ double d;
+ numeric **numarr = (numeric **) calloc(1, sizeof(numeric));
+
+ ECPGdebug(1, stderr);
+
+ for (i = 0; nums[i]; i++)
+ {
+ num = PGTYPESnumeric_from_asc(nums[i], &endptr);
+ if (!num) check_errno();
+ if (endptr != NULL)
+ {
+ printf("endptr of %d is not NULL\n", i);
+ if (*endptr != '\0')
+ printf("*endptr of %d is not \\0\n", i);
+ }
+ if (!num) continue;
+
+ numarr = realloc(numarr, sizeof(numeric *) * (count + 1));
+ numarr[count++] = num;
+
+ text = PGTYPESnumeric_to_asc(num, -1);
+ if (!text) check_errno();
+ printf("num[%d,1]: %s\n", i, text); PGTYPESchar_free(text);
+ text = PGTYPESnumeric_to_asc(num, 0);
+ if (!text) check_errno();
+ printf("num[%d,2]: %s\n", i, text); PGTYPESchar_free(text);
+ text = PGTYPESnumeric_to_asc(num, 1);
+ if (!text) check_errno();
+ printf("num[%d,3]: %s\n", i, text); PGTYPESchar_free(text);
+ text = PGTYPESnumeric_to_asc(num, 2);
+ if (!text) check_errno();
+ printf("num[%d,4]: %s\n", i, text); PGTYPESchar_free(text);
+
+ nin = PGTYPESnumeric_new();
+ text = PGTYPESnumeric_to_asc(nin, 2);
+ if (!text) check_errno();
+ printf("num[%d,5]: %s\n", i, text); PGTYPESchar_free(text);
+
+ r = PGTYPESnumeric_to_long(num, &l);
+ if (r) check_errno();
+ printf("num[%d,6]: %ld (r: %d)\n", i, r?0L:l, r);
+ if (r == 0)
+ {
+ r = PGTYPESnumeric_from_long(l, nin);
+ if (r) check_errno();
+ text = PGTYPESnumeric_to_asc(nin, 2);
+ q = PGTYPESnumeric_cmp(num, nin);
+ printf("num[%d,7]: %s (r: %d - cmp: %d)\n", i, text, r, q);
+ PGTYPESchar_free(text);
+ }
+
+ r = PGTYPESnumeric_to_int(num, &k);
+ if (r) check_errno();
+ printf("num[%d,8]: %d (r: %d)\n", i, r?0:k, r);
+ if (r == 0)
+ {
+ r = PGTYPESnumeric_from_int(k, nin);
+ if (r) check_errno();
+ text = PGTYPESnumeric_to_asc(nin, 2);
+ q = PGTYPESnumeric_cmp(num, nin);
+ printf("num[%d,9]: %s (r: %d - cmp: %d)\n", i, text, r, q);
+ PGTYPESchar_free(text);
+ }
+
+ if (i != 6)
+ {
+ /* underflow does not work reliable on several archs, so not testing it here */
+ /* this is a libc problem since we only call strtod() */
+
+ r = PGTYPESnumeric_to_double(num, &d);
+ if (r) check_errno();
+ printf("num[%d,10]: ", i);
+ print_double(r ? 0.0 : d);
+ printf(" (r: %d)\n", r);
+ }
+
+ /* do not test double to numeric because
+ * - extra digits are different on different architectures
+ * - PGTYPESnumeric_from_double internally calls PGTYPESnumeric_from_asc anyway
+ */
+
+ dec = PGTYPESdecimal_new();
+ r = PGTYPESnumeric_to_decimal(num, dec);
+ if (r) check_errno();
+ /* we have no special routine for outputting decimal, it would
+ * convert to a numeric anyway */
+ printf("num[%d,11]: - (r: %d)\n", i, r);
+ if (r == 0)
+ {
+ r = PGTYPESnumeric_from_decimal(dec, nin);
+ if (r) check_errno();
+ text = PGTYPESnumeric_to_asc(nin, 2);
+ q = PGTYPESnumeric_cmp(num, nin);
+ printf("num[%d,12]: %s (r: %d - cmp: %d)\n", i, text, r, q);
+ PGTYPESchar_free(text);
+ }
+
+ PGTYPESdecimal_free(dec);
+ PGTYPESnumeric_free(nin);
+ printf("\n");
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ for (j = 0; j < count; j++)
+ {
+ numeric* a = PGTYPESnumeric_new();
+ numeric* s = PGTYPESnumeric_new();
+ numeric* m = PGTYPESnumeric_new();
+ numeric* d = PGTYPESnumeric_new();
+ r = PGTYPESnumeric_add(numarr[i], numarr[j], a);
+ if (r)
+ {
+ check_errno();
+ printf("r: %d\n", r);
+ }
+ else
+ {
+ text = PGTYPESnumeric_to_asc(a, 10);
+ printf("num[a,%d,%d]: %s\n", i, j, text);
+ PGTYPESchar_free(text);
+ }
+ r = PGTYPESnumeric_sub(numarr[i], numarr[j], s);
+ if (r)
+ {
+ check_errno();
+ printf("r: %d\n", r);
+ }
+ else
+ {
+ text = PGTYPESnumeric_to_asc(s, 10);
+ printf("num[s,%d,%d]: %s\n", i, j, text);
+ PGTYPESchar_free(text);
+ }
+ r = PGTYPESnumeric_mul(numarr[i], numarr[j], m);
+ if (r)
+ {
+ check_errno();
+ printf("r: %d\n", r);
+ }
+ else
+ {
+ text = PGTYPESnumeric_to_asc(m, 10);
+ printf("num[m,%d,%d]: %s\n", i, j, text);
+ PGTYPESchar_free(text);
+ }
+ r = PGTYPESnumeric_div(numarr[i], numarr[j], d);
+ if (r)
+ {
+ check_errno();
+ printf("r: %d\n", r);
+ }
+ else
+ {
+ text = PGTYPESnumeric_to_asc(d, 10);
+ printf("num[d,%d,%d]: %s\n", i, j, text);
+ PGTYPESchar_free(text);
+ }
+
+ PGTYPESnumeric_free(a);
+ PGTYPESnumeric_free(s);
+ PGTYPESnumeric_free(m);
+ PGTYPESnumeric_free(d);
+ }
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ text = PGTYPESnumeric_to_asc(numarr[i], -1);
+ printf("%d: %s\n", i, text);
+ PGTYPESchar_free(text);
+ PGTYPESnumeric_free(numarr[i]);
+ }
+ free(numarr);
+
+ return 0;
+}
+
+static void
+check_errno(void)
+{
+ switch(errno)
+ {
+ case 0:
+ printf("(no errno set) - ");
+ break;
+ case PGTYPES_NUM_OVERFLOW:
+ printf("(errno == PGTYPES_NUM_OVERFLOW) - ");
+ break;
+ case PGTYPES_NUM_UNDERFLOW:
+ printf("(errno == PGTYPES_NUM_UNDERFLOW) - ");
+ break;
+ case PGTYPES_NUM_BAD_NUMERIC:
+ printf("(errno == PGTYPES_NUM_BAD_NUMERIC) - ");
+ break;
+ case PGTYPES_NUM_DIVIDE_ZERO:
+ printf("(errno == PGTYPES_NUM_DIVIDE_ZERO) - ");
+ break;
+ default:
+ printf("(unknown errno (%d))\n", errno);
+ printf("(libc: (%s)) ", strerror(errno));
+ break;
+ }
+
+}
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stderr b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stderr
new file mode 100644
index 0000000..1a3639d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stderr
@@ -0,0 +1,2 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stdout b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stdout
new file mode 100644
index 0000000..51a7459
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stdout
@@ -0,0 +1,1117 @@
+endptr of 0 is not NULL
+num[0,1]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+num[0,2]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+num[0,3]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0
+num[0,4]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00
+num[0,5]: 0.00
+(errno == PGTYPES_NUM_OVERFLOW) - num[0,6]: 0 (r: -1)
+(errno == PGTYPES_NUM_OVERFLOW) - num[0,8]: 0 (r: -1)
+(errno == PGTYPES_NUM_OVERFLOW) - num[0,10]: 0 (r: -1)
+num[0,11]: - (r: 0)
+num[0,12]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00 (r: 0 - cmp: 0)
+
+endptr of 1 is not NULL
+num[1,1]: -2
+num[1,2]: -2
+num[1,3]: -2.0
+num[1,4]: -2.00
+num[1,5]: 0.00
+num[1,6]: -2 (r: 0)
+num[1,7]: -2.00 (r: 0 - cmp: 0)
+num[1,8]: -2 (r: 0)
+num[1,9]: -2.00 (r: 0 - cmp: 0)
+num[1,10]: -2 (r: 0)
+num[1,11]: - (r: 0)
+num[1,12]: -2.00 (r: 0 - cmp: 0)
+
+endptr of 2 is not NULL
+num[2,1]: 0.794
+num[2,2]: 1
+num[2,3]: 0.8
+num[2,4]: 0.79
+num[2,5]: 0.00
+num[2,6]: 1 (r: 0)
+num[2,7]: 1.00 (r: 0 - cmp: -1)
+num[2,8]: 1 (r: 0)
+num[2,9]: 1.00 (r: 0 - cmp: -1)
+num[2,10]: 0.794 (r: 0)
+num[2,11]: - (r: 0)
+num[2,12]: 0.79 (r: 0 - cmp: 0)
+
+endptr of 3 is not NULL
+num[3,1]: 3.44
+num[3,2]: 3
+num[3,3]: 3.4
+num[3,4]: 3.44
+num[3,5]: 0.00
+num[3,6]: 3 (r: 0)
+num[3,7]: 3.00 (r: 0 - cmp: 1)
+num[3,8]: 3 (r: 0)
+num[3,9]: 3.00 (r: 0 - cmp: 1)
+num[3,10]: 3.44 (r: 0)
+num[3,11]: - (r: 0)
+num[3,12]: 3.44 (r: 0 - cmp: 0)
+
+endptr of 4 is not NULL
+num[4,1]: 592490000000000000000000
+num[4,2]: 592490000000000000000000
+num[4,3]: 592490000000000000000000.0
+num[4,4]: 592490000000000000000000.00
+num[4,5]: 0.00
+(errno == PGTYPES_NUM_OVERFLOW) - num[4,6]: 0 (r: -1)
+(errno == PGTYPES_NUM_OVERFLOW) - num[4,8]: 0 (r: -1)
+num[4,10]: 5.9249e+23 (r: 0)
+num[4,11]: - (r: 0)
+num[4,12]: 592490000000000000000000.00 (r: 0 - cmp: 0)
+
+endptr of 5 is not NULL
+num[5,1]: -328400
+num[5,2]: -328400
+num[5,3]: -328400.0
+num[5,4]: -328400.00
+num[5,5]: 0.00
+num[5,6]: -328400 (r: 0)
+num[5,7]: -328400.00 (r: 0 - cmp: 0)
+num[5,8]: -328400 (r: 0)
+num[5,9]: -328400.00 (r: 0 - cmp: 0)
+num[5,10]: -328400 (r: 0)
+num[5,11]: - (r: 0)
+num[5,12]: -328400.00 (r: 0 - cmp: 0)
+
+endptr of 6 is not NULL
+num[6,1]: 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
+num[6,2]: 0
+num[6,3]: 0.0
+num[6,4]: 0.00
+num[6,5]: 0.00
+num[6,6]: 0 (r: 0)
+num[6,7]: 0.00 (r: 0 - cmp: 1)
+num[6,8]: 0 (r: 0)
+num[6,9]: 0.00 (r: 0 - cmp: 1)
+num[6,11]: - (r: 0)
+num[6,12]: 0.00 (r: 0 - cmp: 0)
+
+endptr of 7 is not NULL
+num[7,1]: 0.001
+num[7,2]: 0
+num[7,3]: 0.0
+num[7,4]: 0.00
+num[7,5]: 0.00
+num[7,6]: 0 (r: 0)
+num[7,7]: 0.00 (r: 0 - cmp: 1)
+num[7,8]: 0 (r: 0)
+num[7,9]: 0.00 (r: 0 - cmp: 1)
+num[7,10]: 0.001 (r: 0)
+num[7,11]: - (r: 0)
+num[7,12]: 0.00 (r: 0 - cmp: 0)
+
+endptr of 8 is not NULL
+num[8,1]: 0.0
+num[8,2]: 0
+num[8,3]: 0.0
+num[8,4]: 0.00
+num[8,5]: 0.00
+num[8,6]: 0 (r: 0)
+num[8,7]: 0.00 (r: 0 - cmp: 0)
+num[8,8]: 0 (r: 0)
+num[8,9]: 0.00 (r: 0 - cmp: 0)
+num[8,10]: 0 (r: 0)
+num[8,11]: - (r: 0)
+num[8,12]: 0.00 (r: 0 - cmp: 0)
+
+endptr of 9 is not NULL
+num[9,1]: -0.000059249
+num[9,2]: -0
+num[9,3]: -0.0
+num[9,4]: -0.00
+num[9,5]: 0.00
+num[9,6]: 0 (r: 0)
+num[9,7]: 0.00 (r: 0 - cmp: -1)
+num[9,8]: 0 (r: 0)
+num[9,9]: 0.00 (r: 0 - cmp: -1)
+num[9,10]: -5.9249e-05 (r: 0)
+num[9,11]: - (r: 0)
+num[9,12]: -0.00 (r: 0 - cmp: 0)
+
+endptr of 10 is not NULL
+num[10,1]: 0.003284
+num[10,2]: 0
+num[10,3]: 0.0
+num[10,4]: 0.00
+num[10,5]: 0.00
+num[10,6]: 0 (r: 0)
+num[10,7]: 0.00 (r: 0 - cmp: 1)
+num[10,8]: 0 (r: 0)
+num[10,9]: 0.00 (r: 0 - cmp: 1)
+num[10,10]: 0.003284 (r: 0)
+num[10,11]: - (r: 0)
+num[10,12]: 0.00 (r: 0 - cmp: 0)
+
+endptr of 11 is not NULL
+num[11,1]: 0.500001
+num[11,2]: 1
+num[11,3]: 0.5
+num[11,4]: 0.50
+num[11,5]: 0.00
+num[11,6]: 1 (r: 0)
+num[11,7]: 1.00 (r: 0 - cmp: -1)
+num[11,8]: 1 (r: 0)
+num[11,9]: 1.00 (r: 0 - cmp: -1)
+num[11,10]: 0.500001 (r: 0)
+num[11,11]: - (r: 0)
+num[11,12]: 0.50 (r: 0 - cmp: 0)
+
+endptr of 12 is not NULL
+num[12,1]: -0.5000001
+num[12,2]: -1
+num[12,3]: -0.5
+num[12,4]: -0.50
+num[12,5]: 0.00
+num[12,6]: -1 (r: 0)
+num[12,7]: -1.00 (r: 0 - cmp: 1)
+num[12,8]: -1 (r: 0)
+num[12,9]: -1.00 (r: 0 - cmp: 1)
+num[12,10]: -0.5 (r: 0)
+num[12,11]: - (r: 0)
+num[12,12]: -0.50 (r: 0 - cmp: 0)
+
+endptr of 13 is not NULL
+num[13,1]: 1234567890123456789012345678.91
+num[13,2]: 1234567890123456789012345679
+num[13,3]: 1234567890123456789012345678.9
+num[13,4]: 1234567890123456789012345678.91
+num[13,5]: 0.00
+(errno == PGTYPES_NUM_OVERFLOW) - num[13,6]: 0 (r: -1)
+(errno == PGTYPES_NUM_OVERFLOW) - num[13,8]: 0 (r: -1)
+num[13,10]: 1.23457e+27 (r: 0)
+num[13,11]: - (r: 0)
+num[13,12]: 1234567890123456789012345678.91 (r: 0 - cmp: 0)
+
+endptr of 14 is not NULL
+num[14,1]: 1234567890123456789012345678.921
+num[14,2]: 1234567890123456789012345679
+num[14,3]: 1234567890123456789012345678.9
+num[14,4]: 1234567890123456789012345678.92
+num[14,5]: 0.00
+(errno == PGTYPES_NUM_OVERFLOW) - num[14,6]: 0 (r: -1)
+(errno == PGTYPES_NUM_OVERFLOW) - num[14,8]: 0 (r: -1)
+num[14,10]: 1.23457e+27 (r: 0)
+(errno == PGTYPES_NUM_OVERFLOW) - num[14,11]: - (r: -1)
+
+(errno == PGTYPES_NUM_BAD_NUMERIC) - endptr of 15 is not NULL
+*endptr of 15 is not \0
+num[a,0,0]: 40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[s,0,0]: 0.0000000000
+num[m,0,0]: 400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,0]: 1.0000000000
+num[a,0,1]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998.0000000000
+num[s,0,1]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002.0000000000
+num[m,0,1]: -40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,1]: -10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,0,2]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.7940000000
+num[s,0,2]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.2060000000
+num[m,0,2]: 15880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,2]: 25188916876574307304785894206549118387909319899244332493702770780856423173803526448362720403022670025188916876574307304785894206549118387909319899244332493702770780856423173803526448362720403022670025188916876574307304785894206549118387909319899244332493702770780856423173803526448362720403022670025188916876574307304785894206549118387909319899244332493702770780856423173803526448362720403022670.0251889000
+num[a,0,3]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003.4400000000
+num[s,0,3]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999996.5600000000
+num[m,0,3]: 68800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,3]: 5813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093.0232560000
+num[a,0,4]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000592490000000000000000000.0000000000
+num[s,0,4]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999407510000000000000000000.0000000000
+num[m,0,4]: 11849800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,4]: 33755843980489122179277287380377727894141673277186112845786426775135445323971712602744350115613765633175243464024709277793718037435230974362436496818511704838900234603115664399399145977147293625208864284629276443484278215666087191345001603402589073233303515671150567942074971729480666340360174855271818933652888656348630356630491653867575824064541173690695201606778173471.2822000000
+num[a,0,5]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999671600.0000000000
+num[s,0,5]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000328400.0000000000
+num[m,0,5]: -6568000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,5]: -60901339829476248477466504263093788063337393422655298416565164433617539585870889159561510353227771010962241169305724725943970767356881851400730816077953714981729598051157125456760048721071863580998781973203410475030450669914738124238733252131546894031668696711327649208282582216808769792935444579780755176613885505481120584652862362971985383678440925700365408038976857490864799025578562728.3800000000
+num[a,0,6]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[s,0,6]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[m,0,6]: 4.0000000000
+num[d,0,6]: 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,0,7]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0010000000
+num[s,0,7]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.9990000000
+num[m,0,7]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,7]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,0,8]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[s,0,8]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[m,0,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,0,9]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.9999407510
+num[s,0,9]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000592490
+num[m,0,9]: -1184980000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,9]: -337558439804891221792772873803777278941416732771861128457864267751354453239717126027443501156137656331752434640247092777937180374352309743624364968185117048389002346031156643993991459771472936252088642846292764434842782156660871913450016034025890732333035156711505679420749717294806663403601748552718189336528886563486303566304916538675758240645411736906952016067781734712822157335988793059798477611.4364799406
+num[a,0,10]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0032840000
+num[s,0,10]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.9967160000
+num[m,0,10]: 65680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,10]: 6090133982947624847746650426309378806333739342265529841656516443361753958587088915956151035322777101096224116930572472594397076735688185140073081607795371498172959805115712545676004872107186358099878197320341047503045066991473812423873325213154689403166869671132764920828258221680876979293544457978075517661388550548112058465286236297198538367844092570036540803897685749086479902557856272838002436.0535931790
+num[a,0,11]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.5000010000
+num[s,0,11]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.4999990000
+num[m,0,11]: 10000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,11]: 39999920000159999680000639998720002559994880010239979520040959918080163839672320655358689282621434757130485739028521942956114087771824456351087297825404349191301617396765206469587060825878348243303513392973214053571892856214287571424857150285699428601142797714404571190857618284763430473139053721892556214887570224859550280899438201123597752804494391011217977564044871910256179487641024717950564.0988718023
+num[a,0,12]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.4999999000
+num[s,0,12]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.5000001000
+num[m,0,12]: -10000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,12]: -39999992000001599999680000063999987200002559999488000102399979520004095999180800163839967232006553598689280262143947571210485757902848419430316113936777212644557471088505782298843540231291953741609251678149664370067125986574802685039462992107401578519684296063140787371842525631494873701025259794948041010391797921640415671916865616626876674624665075066984986603002679399464120107175978564804287.0391425922
+num[a,0,13]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567890123456789012345678.9100000000
+num[s,0,13]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998765432109876543210987654321.0900000000
+num[m,0,13]: 24691357802469135780246913578200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,13]: 16200000145800001326780012073583089868436639792144602011794432069173427871944627216535488452104037734402488812766825268543092076559937753306592463425498481952238394402210698594884666469792189859469175471551488967831431174229215285702844063565115973562205366453218447154498968406694142978268167639546201917272112583939026078314516169317627127550253962230423465305471042.6305370000
+num[a,0,14]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567890123456789012345678.9210000000
+num[s,0,14]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998765432109876543210987654321.0790000000
+num[m,0,14]: 24691357802469135780246913578420000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,0,14]: 16200000145800001326780012073438747865838483756809679983855488190421495112429743605252505619668606245113387993074870449075163411519793685453399903975484793505772589916586682299621591493014451434717743879521702761509433606809200816287108380036339147553262638409152127519194255768451119299228069799803818551847328103399274511743550433402484767562070619244777160576307850.4589877000
+num[a,1,0]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998.0000000000
+num[s,1,0]: -20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002.0000000000
+num[m,1,0]: -40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,1,0]: -0.0000000000
+num[a,1,1]: -4.0000000000
+num[s,1,1]: 0.0000000000
+num[m,1,1]: 4.0000000000
+num[d,1,1]: 1.0000000000
+num[a,1,2]: -1.2060000000
+num[s,1,2]: -2.7940000000
+num[m,1,2]: -1.5880000000
+num[d,1,2]: -2.5188916877
+num[a,1,3]: 1.4400000000
+num[s,1,3]: -5.4400000000
+num[m,1,3]: -6.8800000000
+num[d,1,3]: -0.5813953488
+num[a,1,4]: 592489999999999999999998.0000000000
+num[s,1,4]: -592490000000000000000002.0000000000
+num[m,1,4]: -1184980000000000000000000.0000000000
+num[d,1,4]: -0.0000000000
+num[a,1,5]: -328402.0000000000
+num[s,1,5]: 328398.0000000000
+num[m,1,5]: 656800.0000000000
+num[d,1,5]: 0.0000060901
+num[a,1,6]: -2.0000000000
+num[s,1,6]: -2.0000000000
+num[m,1,6]: -0.0000000000
+num[d,1,6]: -10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,1,7]: -1.9990000000
+num[s,1,7]: -2.0010000000
+num[m,1,7]: -0.0020000000
+num[d,1,7]: -2000.0000000000
+num[a,1,8]: -2.0000000000
+num[s,1,8]: -2.0000000000
+num[m,1,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,1,9]: -2.0000592490
+num[s,1,9]: -1.9999407510
+num[m,1,9]: 0.0001184980
+num[d,1,9]: 33755.8439804891
+num[a,1,10]: -1.9967160000
+num[s,1,10]: -2.0032840000
+num[m,1,10]: -0.0065680000
+num[d,1,10]: -609.0133982948
+num[a,1,11]: -1.4999990000
+num[s,1,11]: -2.5000010000
+num[m,1,11]: -1.0000020000
+num[d,1,11]: -3.9999920000
+num[a,1,12]: -2.5000001000
+num[s,1,12]: -1.4999999000
+num[m,1,12]: 1.0000002000
+num[d,1,12]: 3.9999992000
+num[a,1,13]: 1234567890123456789012345676.9100000000
+num[s,1,13]: -1234567890123456789012345680.9100000000
+num[m,1,13]: -2469135780246913578024691357.8200000000
+num[d,1,13]: -0.0000000000
+num[a,1,14]: 1234567890123456789012345676.9210000000
+num[s,1,14]: -1234567890123456789012345680.9210000000
+num[m,1,14]: -2469135780246913578024691357.8420000000
+num[d,1,14]: -0.0000000000
+num[a,2,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.7940000000
+num[s,2,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.2060000000
+num[m,2,0]: 15880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,2,0]: 0.0000000000
+num[a,2,1]: -1.2060000000
+num[s,2,1]: 2.7940000000
+num[m,2,1]: -1.5880000000
+num[d,2,1]: -0.3970000000
+num[a,2,2]: 1.5880000000
+num[s,2,2]: 0.0000000000
+num[m,2,2]: 0.6304360000
+num[d,2,2]: 1.0000000000
+num[a,2,3]: 4.2340000000
+num[s,2,3]: -2.6460000000
+num[m,2,3]: 2.7313600000
+num[d,2,3]: 0.2308139535
+num[a,2,4]: 592490000000000000000000.7940000000
+num[s,2,4]: -592489999999999999999999.2060000000
+num[m,2,4]: 470437060000000000000000.0000000000
+num[d,2,4]: 0.0000000000
+num[a,2,5]: -328399.2060000000
+num[s,2,5]: 328400.7940000000
+num[m,2,5]: -260749.6000000000
+num[d,2,5]: -0.0000024178
+num[a,2,6]: 0.7940000000
+num[s,2,6]: 0.7940000000
+num[m,2,6]: 0.0000000000
+num[d,2,6]: 3970000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,2,7]: 0.7950000000
+num[s,2,7]: 0.7930000000
+num[m,2,7]: 0.0007940000
+num[d,2,7]: 794.0000000000
+num[a,2,8]: 0.7940000000
+num[s,2,8]: 0.7940000000
+num[m,2,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,2,9]: 0.7939407510
+num[s,2,9]: 0.7940592490
+num[m,2,9]: -0.0000470437
+num[d,2,9]: -13401.0700602542
+num[a,2,10]: 0.7972840000
+num[s,2,10]: 0.7907160000
+num[m,2,10]: 0.0026074960
+num[d,2,10]: 241.7783191230
+num[a,2,11]: 1.2940010000
+num[s,2,11]: 0.2939990000
+num[m,2,11]: 0.3970007940
+num[d,2,11]: 1.5879968240
+num[a,2,12]: 0.2939999000
+num[s,2,12]: 1.2940001000
+num[m,2,12]: -0.3970000794
+num[d,2,12]: -1.5879996824
+num[a,2,13]: 1234567890123456789012345679.7040000000
+num[s,2,13]: -1234567890123456789012345678.1160000000
+num[m,2,13]: 980246904758024690475802469.0545400000
+num[d,2,13]: 0.0000000000
+num[a,2,14]: 1234567890123456789012345679.7150000000
+num[s,2,14]: -1234567890123456789012345678.1270000000
+num[m,2,14]: 980246904758024690475802469.0632740000
+num[d,2,14]: 0.0000000000
+num[a,3,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003.4400000000
+num[s,3,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999996.5600000000
+num[m,3,0]: 68800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,3,0]: 0.0000000000
+num[a,3,1]: 1.4400000000
+num[s,3,1]: 5.4400000000
+num[m,3,1]: -6.8800000000
+num[d,3,1]: -1.7200000000
+num[a,3,2]: 4.2340000000
+num[s,3,2]: 2.6460000000
+num[m,3,2]: 2.7313600000
+num[d,3,2]: 4.3324937028
+num[a,3,3]: 6.8800000000
+num[s,3,3]: 0.0000000000
+num[m,3,3]: 11.8336000000
+num[d,3,3]: 1.0000000000
+num[a,3,4]: 592490000000000000000003.4400000000
+num[s,3,4]: -592489999999999999999996.5600000000
+num[m,3,4]: 2038165600000000000000000.0000000000
+num[d,3,4]: 0.0000000000
+num[a,3,5]: -328396.5600000000
+num[s,3,5]: 328403.4400000000
+num[m,3,5]: -1129696.0000000000
+num[d,3,5]: -0.0000104750
+num[a,3,6]: 3.4400000000
+num[s,3,6]: 3.4400000000
+num[m,3,6]: 0.0000000000
+num[d,3,6]: 17200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,3,7]: 3.4410000000
+num[s,3,7]: 3.4390000000
+num[m,3,7]: 0.0034400000
+num[d,3,7]: 3440.0000000000
+num[a,3,8]: 3.4400000000
+num[s,3,8]: 3.4400000000
+num[m,3,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,3,9]: 3.4399407510
+num[s,3,9]: 3.4400592490
+num[m,3,9]: -0.0002038166
+num[d,3,9]: -58060.0516464413
+num[a,3,10]: 3.4432840000
+num[s,3,10]: 3.4367160000
+num[m,3,10]: 0.0112969600
+num[d,3,10]: 1047.5030450670
+num[a,3,11]: 3.9400010000
+num[s,3,11]: 2.9399990000
+num[m,3,11]: 1.7200034400
+num[d,3,11]: 6.8799862400
+num[a,3,12]: 2.9399999000
+num[s,3,12]: 3.9400001000
+num[m,3,12]: -1.7200003440
+num[d,3,12]: -6.8799986240
+num[a,3,13]: 1234567890123456789012345682.3500000000
+num[s,3,13]: -1234567890123456789012345675.4700000000
+num[m,3,13]: 4246913542024691354202469135.4504000000
+num[d,3,13]: 0.0000000000
+num[a,3,14]: 1234567890123456789012345682.3610000000
+num[s,3,14]: -1234567890123456789012345675.4810000000
+num[m,3,14]: 4246913542024691354202469135.4882400000
+num[d,3,14]: 0.0000000000
+num[a,4,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000592490000000000000000000.0000000000
+num[s,4,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999407510000000000000000000.0000000000
+num[m,4,0]: 11849800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,4,0]: 0.0000000000
+num[a,4,1]: 592489999999999999999998.0000000000
+num[s,4,1]: 592490000000000000000002.0000000000
+num[m,4,1]: -1184980000000000000000000.0000000000
+num[d,4,1]: -296245000000000000000000.0000000000
+num[a,4,2]: 592490000000000000000000.7940000000
+num[s,4,2]: 592489999999999999999999.2060000000
+num[m,4,2]: 470437060000000000000000.0000000000
+num[d,4,2]: 746209068010075566750629.7229219000
+num[a,4,3]: 592490000000000000000003.4400000000
+num[s,4,3]: 592489999999999999999996.5600000000
+num[m,4,3]: 2038165600000000000000000.0000000000
+num[d,4,3]: 172235465116279069767441.8604650000
+num[a,4,4]: 1184980000000000000000000.0000000000
+num[s,4,4]: 0.0000000000
+num[m,4,4]: 351044400100000000000000000000000000000000000000.0000000000
+num[d,4,4]: 1.0000000000
+num[a,4,5]: 592489999999999999671600.0000000000
+num[s,4,5]: 592490000000000000328400.0000000000
+num[m,4,5]: -194573716000000000000000000000.0000000000
+num[d,4,5]: -1804171741778319123.0207000000
+num[a,4,6]: 592490000000000000000000.0000000000
+num[s,4,6]: 592490000000000000000000.0000000000
+num[m,4,6]: 0.0000000000
+num[d,4,6]: 2962450000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,4,7]: 592490000000000000000000.0010000000
+num[s,4,7]: 592489999999999999999999.9990000000
+num[m,4,7]: 592490000000000000000.0000000000
+num[d,4,7]: 592490000000000000000000000.0000000000
+num[a,4,8]: 592490000000000000000000.0000000000
+num[s,4,8]: 592490000000000000000000.0000000000
+num[m,4,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,4,9]: 592489999999999999999999.9999407510
+num[s,4,9]: 592490000000000000000000.0000592490
+num[m,4,9]: -35104440010000000000.0000000000
+num[d,4,9]: -10000000000000000000000000000.0000000000
+num[a,4,10]: 592490000000000000000000.0032840000
+num[s,4,10]: 592489999999999999999999.9967160000
+num[m,4,10]: 1945737160000000000000.0000000000
+num[d,4,10]: 180417174177831912302070645.5542021924
+num[a,4,11]: 592490000000000000000000.5000010000
+num[s,4,11]: 592489999999999999999999.4999990000
+num[m,4,11]: 296245592490000000000000.0000000000
+num[d,4,11]: 1184977630044739910520178.9596420807
+num[a,4,12]: 592489999999999999999999.4999999000
+num[s,4,12]: 592490000000000000000000.5000001000
+num[m,4,12]: -296245059249000000000000.0000000000
+num[d,4,12]: -1184979763004047399190520.1618959676
+num[a,4,13]: 1235160380123456789012345678.9100000000
+num[s,4,13]: -1233975400123456789012345678.9100000000
+num[m,4,13]: 731469129219246912921924691297385900000000000000000.0000000000
+num[d,4,13]: 0.0004799169
+num[a,4,14]: 1235160380123456789012345678.9210000000
+num[s,4,14]: -1233975400123456789012345678.9210000000
+num[m,4,14]: 731469129219246912921924691303903290000000000000000.0000000000
+num[d,4,14]: 0.0004799169
+num[a,5,0]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999671600.0000000000
+num[s,5,0]: -20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000328400.0000000000
+num[m,5,0]: -6568000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,5,0]: -0.0000000000
+num[a,5,1]: -328402.0000000000
+num[s,5,1]: -328398.0000000000
+num[m,5,1]: 656800.0000000000
+num[d,5,1]: 164200.0000000000
+num[a,5,2]: -328399.2060000000
+num[s,5,2]: -328400.7940000000
+num[m,5,2]: -260749.6000000000
+num[d,5,2]: -413602.0151133501
+num[a,5,3]: -328396.5600000000
+num[s,5,3]: -328403.4400000000
+num[m,5,3]: -1129696.0000000000
+num[d,5,3]: -95465.1162790698
+num[a,5,4]: 592489999999999999671600.0000000000
+num[s,5,4]: -592490000000000000328400.0000000000
+num[m,5,4]: -194573716000000000000000000000.0000000000
+num[d,5,4]: -0.0000000000
+num[a,5,5]: -656800.0000000000
+num[s,5,5]: 0.0000000000
+num[m,5,5]: 107846560000.0000000000
+num[d,5,5]: 1.0000000000
+num[a,5,6]: -328400.0000000000
+num[s,5,6]: -328400.0000000000
+num[m,5,6]: -0.0000000000
+num[d,5,6]: -1642000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,5,7]: -328399.9990000000
+num[s,5,7]: -328400.0010000000
+num[m,5,7]: -328.4000000000
+num[d,5,7]: -328400000.0000000000
+num[a,5,8]: -328400.0000000000
+num[s,5,8]: -328400.0000000000
+num[m,5,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,5,9]: -328400.0000592490
+num[s,5,9]: -328399.9999407510
+num[m,5,9]: 19.4573716000
+num[d,5,9]: 5542709581.5963138618
+num[a,5,10]: -328399.9967160000
+num[s,5,10]: -328400.0032840000
+num[m,5,10]: -1078.4656000000
+num[d,5,10]: -100000000.0000000000
+num[a,5,11]: -328399.4999990000
+num[s,5,11]: -328400.5000010000
+num[m,5,11]: -164200.3284000000
+num[d,5,11]: -656798.6864026272
+num[a,5,12]: -328400.5000001000
+num[s,5,12]: -328399.4999999000
+num[m,5,12]: 164200.0328400000
+num[d,5,12]: 656799.8686400263
+num[a,5,13]: 1234567890123456789012017278.9100000000
+num[s,5,13]: -1234567890123456789012674078.9100000000
+num[m,5,13]: -405432095116543209511654320954044.0000000000
+num[d,5,13]: -0.0000000000
+num[a,5,14]: 1234567890123456789012017278.9210000000
+num[s,5,14]: -1234567890123456789012674078.9210000000
+num[m,5,14]: -405432095116543209511654320957656.4000000000
+num[d,5,14]: -0.0000000000
+num[a,6,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[s,6,0]: -20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[m,6,0]: 4.0000000000
+num[d,6,0]: 0.0000000000
+num[a,6,1]: -2.0000000000
+num[s,6,1]: 2.0000000000
+num[m,6,1]: -0.0000000000
+num[d,6,1]: -0.0000000000
+num[a,6,2]: 0.7940000000
+num[s,6,2]: -0.7940000000
+num[m,6,2]: 0.0000000000
+num[d,6,2]: 0.0000000000
+num[a,6,3]: 3.4400000000
+num[s,6,3]: -3.4400000000
+num[m,6,3]: 0.0000000000
+num[d,6,3]: 0.0000000000
+num[a,6,4]: 592490000000000000000000.0000000000
+num[s,6,4]: -592490000000000000000000.0000000000
+num[m,6,4]: 0.0000000000
+num[d,6,4]: 0.0000000000
+num[a,6,5]: -328400.0000000000
+num[s,6,5]: 328400.0000000000
+num[m,6,5]: -0.0000000000
+num[d,6,5]: -0.0000000000
+num[a,6,6]: 0.0000000000
+num[s,6,6]: 0.0000000000
+num[m,6,6]: 0.0000000000
+num[d,6,6]: 1.0000000000
+num[a,6,7]: 0.0010000000
+num[s,6,7]: -0.0010000000
+num[m,6,7]: 0.0000000000
+num[d,6,7]: 0.0000000000
+num[a,6,8]: 0.0000000000
+num[s,6,8]: 0.0000000000
+num[m,6,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,6,9]: -0.0000592490
+num[s,6,9]: 0.0000592490
+num[m,6,9]: -0.0000000000
+num[d,6,9]: -0.0000000000
+num[a,6,10]: 0.0032840000
+num[s,6,10]: -0.0032840000
+num[m,6,10]: 0.0000000000
+num[d,6,10]: 0.0000000000
+num[a,6,11]: 0.5000010000
+num[s,6,11]: -0.5000010000
+num[m,6,11]: 0.0000000000
+num[d,6,11]: 0.0000000000
+num[a,6,12]: -0.5000001000
+num[s,6,12]: 0.5000001000
+num[m,6,12]: -0.0000000000
+num[d,6,12]: -0.0000000000
+num[a,6,13]: 1234567890123456789012345678.9100000000
+num[s,6,13]: -1234567890123456789012345678.9100000000
+num[m,6,13]: 0.0000000000
+num[d,6,13]: 0.0000000000
+num[a,6,14]: 1234567890123456789012345678.9210000000
+num[s,6,14]: -1234567890123456789012345678.9210000000
+num[m,6,14]: 0.0000000000
+num[d,6,14]: 0.0000000000
+num[a,7,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0010000000
+num[s,7,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.9990000000
+num[m,7,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,7,0]: 0.0000000000
+num[a,7,1]: -1.9990000000
+num[s,7,1]: 2.0010000000
+num[m,7,1]: -0.0020000000
+num[d,7,1]: -0.0005000000
+num[a,7,2]: 0.7950000000
+num[s,7,2]: -0.7930000000
+num[m,7,2]: 0.0007940000
+num[d,7,2]: 0.0012594458
+num[a,7,3]: 3.4410000000
+num[s,7,3]: -3.4390000000
+num[m,7,3]: 0.0034400000
+num[d,7,3]: 0.0002906977
+num[a,7,4]: 592490000000000000000000.0010000000
+num[s,7,4]: -592489999999999999999999.9990000000
+num[m,7,4]: 592490000000000000000.0000000000
+num[d,7,4]: 0.0000000000
+num[a,7,5]: -328399.9990000000
+num[s,7,5]: 328400.0010000000
+num[m,7,5]: -328.4000000000
+num[d,7,5]: -0.0000000030
+num[a,7,6]: 0.0010000000
+num[s,7,6]: 0.0010000000
+num[m,7,6]: 0.0000000000
+num[d,7,6]: 5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,7,7]: 0.0020000000
+num[s,7,7]: 0.0000000000
+num[m,7,7]: 0.0000010000
+num[d,7,7]: 1.0000000000
+num[a,7,8]: 0.0010000000
+num[s,7,8]: 0.0010000000
+num[m,7,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,7,9]: 0.0009407510
+num[s,7,9]: 0.0010592490
+num[m,7,9]: -0.0000000592
+num[d,7,9]: -16.8779219902
+num[a,7,10]: 0.0042840000
+num[s,7,10]: -0.0022840000
+num[m,7,10]: 0.0000032840
+num[d,7,10]: 0.3045066991
+num[a,7,11]: 0.5010010000
+num[s,7,11]: -0.4990010000
+num[m,7,11]: 0.0005000010
+num[d,7,11]: 0.0019999960
+num[a,7,12]: -0.4990001000
+num[s,7,12]: 0.5010001000
+num[m,7,12]: -0.0005000001
+num[d,7,12]: -0.0019999996
+num[a,7,13]: 1234567890123456789012345678.9110000000
+num[s,7,13]: -1234567890123456789012345678.9090000000
+num[m,7,13]: 1234567890123456789012345.6789100000
+num[d,7,13]: 0.0000000000
+num[a,7,14]: 1234567890123456789012345678.9220000000
+num[s,7,14]: -1234567890123456789012345678.9200000000
+num[m,7,14]: 1234567890123456789012345.6789210000
+num[d,7,14]: 0.0000000000
+num[a,8,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[s,8,0]: -20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[m,8,0]: 0.0000000000
+num[d,8,0]: 0.0000000000
+num[a,8,1]: -2.0000000000
+num[s,8,1]: 2.0000000000
+num[m,8,1]: 0.0000000000
+num[d,8,1]: 0.0000000000
+num[a,8,2]: 0.7940000000
+num[s,8,2]: -0.7940000000
+num[m,8,2]: 0.0000000000
+num[d,8,2]: 0.0000000000
+num[a,8,3]: 3.4400000000
+num[s,8,3]: -3.4400000000
+num[m,8,3]: 0.0000000000
+num[d,8,3]: 0.0000000000
+num[a,8,4]: 592490000000000000000000.0000000000
+num[s,8,4]: -592490000000000000000000.0000000000
+num[m,8,4]: 0.0000000000
+num[d,8,4]: 0.0000000000
+num[a,8,5]: -328400.0000000000
+num[s,8,5]: 328400.0000000000
+num[m,8,5]: 0.0000000000
+num[d,8,5]: 0.0000000000
+num[a,8,6]: 0.0000000000
+num[s,8,6]: -0.0000000000
+num[m,8,6]: 0.0000000000
+num[d,8,6]: 0.0000000000
+num[a,8,7]: 0.0010000000
+num[s,8,7]: -0.0010000000
+num[m,8,7]: 0.0000000000
+num[d,8,7]: 0.0000000000
+num[a,8,8]: 0.0000000000
+num[s,8,8]: 0.0000000000
+num[m,8,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,8,9]: -0.0000592490
+num[s,8,9]: 0.0000592490
+num[m,8,9]: 0.0000000000
+num[d,8,9]: 0.0000000000
+num[a,8,10]: 0.0032840000
+num[s,8,10]: -0.0032840000
+num[m,8,10]: 0.0000000000
+num[d,8,10]: 0.0000000000
+num[a,8,11]: 0.5000010000
+num[s,8,11]: -0.5000010000
+num[m,8,11]: 0.0000000000
+num[d,8,11]: 0.0000000000
+num[a,8,12]: -0.5000001000
+num[s,8,12]: 0.5000001000
+num[m,8,12]: 0.0000000000
+num[d,8,12]: 0.0000000000
+num[a,8,13]: 1234567890123456789012345678.9100000000
+num[s,8,13]: -1234567890123456789012345678.9100000000
+num[m,8,13]: 0.0000000000
+num[d,8,13]: 0.0000000000
+num[a,8,14]: 1234567890123456789012345678.9210000000
+num[s,8,14]: -1234567890123456789012345678.9210000000
+num[m,8,14]: 0.0000000000
+num[d,8,14]: 0.0000000000
+num[a,9,0]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.9999407510
+num[s,9,0]: -20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000592490
+num[m,9,0]: -1184980000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,9,0]: -0.0000000000
+num[a,9,1]: -2.0000592490
+num[s,9,1]: 1.9999407510
+num[m,9,1]: 0.0001184980
+num[d,9,1]: 0.0000296245
+num[a,9,2]: 0.7939407510
+num[s,9,2]: -0.7940592490
+num[m,9,2]: -0.0000470437
+num[d,9,2]: -0.0000746209
+num[a,9,3]: 3.4399407510
+num[s,9,3]: -3.4400592490
+num[m,9,3]: -0.0002038166
+num[d,9,3]: -0.0000172235
+num[a,9,4]: 592489999999999999999999.9999407510
+num[s,9,4]: -592490000000000000000000.0000592490
+num[m,9,4]: -35104440010000000000.0000000000
+num[d,9,4]: -0.0000000000
+num[a,9,5]: -328400.0000592490
+num[s,9,5]: 328399.9999407510
+num[m,9,5]: 19.4573716000
+num[d,9,5]: 0.0000000002
+num[a,9,6]: -0.0000592490
+num[s,9,6]: -0.0000592490
+num[m,9,6]: -0.0000000000
+num[d,9,6]: -296245000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,9,7]: 0.0009407510
+num[s,9,7]: -0.0010592490
+num[m,9,7]: -0.0000000592
+num[d,9,7]: -0.0592490000
+num[a,9,8]: -0.0000592490
+num[s,9,8]: -0.0000592490
+num[m,9,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,9,9]: -0.0001184980
+num[s,9,9]: 0.0000000000
+num[m,9,9]: 0.0000000035
+num[d,9,9]: 1.0000000000
+num[a,9,10]: 0.0032247510
+num[s,9,10]: -0.0033432490
+num[m,9,10]: -0.0000001946
+num[d,9,10]: -0.0180417174
+num[a,9,11]: 0.4999417510
+num[s,9,11]: -0.5000602490
+num[m,9,11]: -0.0000296246
+num[d,9,11]: -0.0001184978
+num[a,9,12]: -0.5000593490
+num[s,9,12]: 0.4999408510
+num[m,9,12]: 0.0000296245
+num[d,9,12]: 0.0001184980
+num[a,9,13]: 1234567890123456789012345678.9099407510
+num[s,9,13]: -1234567890123456789012345678.9100592490
+num[m,9,13]: -73146912921924691292192.4691297386
+num[d,9,13]: -0.0000000000
+num[a,9,14]: 1234567890123456789012345678.9209407510
+num[s,9,14]: -1234567890123456789012345678.9210592490
+num[m,9,14]: -73146912921924691292192.4691303903
+num[d,9,14]: -0.0000000000
+num[a,10,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0032840000
+num[s,10,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.9967160000
+num[m,10,0]: 65680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,10,0]: 0.0000000000
+num[a,10,1]: -1.9967160000
+num[s,10,1]: 2.0032840000
+num[m,10,1]: -0.0065680000
+num[d,10,1]: -0.0016420000
+num[a,10,2]: 0.7972840000
+num[s,10,2]: -0.7907160000
+num[m,10,2]: 0.0026074960
+num[d,10,2]: 0.0041360202
+num[a,10,3]: 3.4432840000
+num[s,10,3]: -3.4367160000
+num[m,10,3]: 0.0112969600
+num[d,10,3]: 0.0009546512
+num[a,10,4]: 592490000000000000000000.0032840000
+num[s,10,4]: -592489999999999999999999.9967160000
+num[m,10,4]: 1945737160000000000000.0000000000
+num[d,10,4]: 0.0000000000
+num[a,10,5]: -328399.9967160000
+num[s,10,5]: 328400.0032840000
+num[m,10,5]: -1078.4656000000
+num[d,10,5]: -0.0000000100
+num[a,10,6]: 0.0032840000
+num[s,10,6]: 0.0032840000
+num[m,10,6]: 0.0000000000
+num[d,10,6]: 16420000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,10,7]: 0.0042840000
+num[s,10,7]: 0.0022840000
+num[m,10,7]: 0.0000032840
+num[d,10,7]: 3.2840000000
+num[a,10,8]: 0.0032840000
+num[s,10,8]: 0.0032840000
+num[m,10,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,10,9]: 0.0032247510
+num[s,10,9]: 0.0033432490
+num[m,10,9]: -0.0000001946
+num[d,10,9]: -55.4270958160
+num[a,10,10]: 0.0065680000
+num[s,10,10]: 0.0000000000
+num[m,10,10]: 0.0000107847
+num[d,10,10]: 1.0000000000
+num[a,10,11]: 0.5032850000
+num[s,10,11]: -0.4967170000
+num[m,10,11]: 0.0016420033
+num[d,10,11]: 0.0065679869
+num[a,10,12]: -0.4967161000
+num[s,10,12]: 0.5032841000
+num[m,10,12]: -0.0016420003
+num[d,10,12]: -0.0065679987
+num[a,10,13]: 1234567890123456789012345678.9132840000
+num[s,10,13]: -1234567890123456789012345678.9067160000
+num[m,10,13]: 4054320951165432095116543.2095404400
+num[d,10,13]: 0.0000000000
+num[a,10,14]: 1234567890123456789012345678.9242840000
+num[s,10,14]: -1234567890123456789012345678.9177160000
+num[m,10,14]: 4054320951165432095116543.2095765640
+num[d,10,14]: 0.0000000000
+num[a,11,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.5000010000
+num[s,11,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.4999990000
+num[m,11,0]: 10000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,11,0]: 0.0000000000
+num[a,11,1]: -1.4999990000
+num[s,11,1]: 2.5000010000
+num[m,11,1]: -1.0000020000
+num[d,11,1]: -0.2500005000
+num[a,11,2]: 1.2940010000
+num[s,11,2]: -0.2939990000
+num[m,11,2]: 0.3970007940
+num[d,11,2]: 0.6297241814
+num[a,11,3]: 3.9400010000
+num[s,11,3]: -2.9399990000
+num[m,11,3]: 1.7200034400
+num[d,11,3]: 0.1453491279
+num[a,11,4]: 592490000000000000000000.5000010000
+num[s,11,4]: -592489999999999999999999.4999990000
+num[m,11,4]: 296245592490000000000000.0000000000
+num[d,11,4]: 0.0000000000
+num[a,11,5]: -328399.4999990000
+num[s,11,5]: 328400.5000010000
+num[m,11,5]: -164200.3284000000
+num[d,11,5]: -0.0000015225
+num[a,11,6]: 0.5000010000
+num[s,11,6]: 0.5000010000
+num[m,11,6]: 0.0000000000
+num[d,11,6]: 2500005000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,11,7]: 0.5010010000
+num[s,11,7]: 0.4990010000
+num[m,11,7]: 0.0005000010
+num[d,11,7]: 500.0010000000
+num[a,11,8]: 0.5000010000
+num[s,11,8]: 0.5000010000
+num[m,11,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,11,9]: 0.4999417510
+num[s,11,9]: 0.5000602490
+num[m,11,9]: -0.0000296246
+num[d,11,9]: -8438.9778730443
+num[a,11,10]: 0.5032850000
+num[s,11,10]: 0.4967170000
+num[m,11,10]: 0.0016420033
+num[d,11,10]: 152.2536540804
+num[a,11,11]: 1.0000020000
+num[s,11,11]: 0.0000000000
+num[m,11,11]: 0.2500010000
+num[d,11,11]: 1.0000000000
+num[a,11,12]: 0.0000009000
+num[s,11,12]: 1.0000011000
+num[m,11,12]: -0.2500005500
+num[d,11,12]: -1.0000018000
+num[a,11,13]: 1234567890123456789012345679.4100010000
+num[s,11,13]: -1234567890123456789012345678.4099990000
+num[m,11,13]: 617285179629618517962961851.8006789100
+num[d,11,13]: 0.0000000000
+num[a,11,14]: 1234567890123456789012345679.4210010000
+num[s,11,14]: -1234567890123456789012345678.4209990000
+num[m,11,14]: 617285179629618517962961851.8061789210
+num[d,11,14]: 0.0000000000
+num[a,12,0]: 19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.4999999000
+num[s,12,0]: -20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.5000001000
+num[m,12,0]: -10000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,12,0]: -0.0000000000
+num[a,12,1]: -2.5000001000
+num[s,12,1]: 1.4999999000
+num[m,12,1]: 1.0000002000
+num[d,12,1]: 0.2500000500
+num[a,12,2]: 0.2939999000
+num[s,12,2]: -1.2940001000
+num[m,12,2]: -0.3970000794
+num[d,12,2]: -0.6297230479
+num[a,12,3]: 2.9399999000
+num[s,12,3]: -3.9400001000
+num[m,12,3]: -1.7200003440
+num[d,12,3]: -0.1453488663
+num[a,12,4]: 592489999999999999999999.4999999000
+num[s,12,4]: -592490000000000000000000.5000001000
+num[m,12,4]: -296245059249000000000000.0000000000
+num[d,12,4]: -0.0000000000
+num[a,12,5]: -328400.5000001000
+num[s,12,5]: 328399.4999999000
+num[m,12,5]: 164200.0328400000
+num[d,12,5]: 0.0000015225
+num[a,12,6]: -0.5000001000
+num[s,12,6]: -0.5000001000
+num[m,12,6]: -0.0000000000
+num[d,12,6]: -2500000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,12,7]: -0.4990001000
+num[s,12,7]: -0.5010001000
+num[m,12,7]: -0.0005000001
+num[d,12,7]: -500.0001000000
+num[a,12,8]: -0.5000001000
+num[s,12,8]: -0.5000001000
+num[m,12,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,12,9]: -0.5000593490
+num[s,12,9]: -0.4999408510
+num[m,12,9]: 0.0000296245
+num[d,12,9]: 8438.9626829145
+num[a,12,10]: -0.4967161000
+num[s,12,10]: -0.5032841000
+num[m,12,10]: -0.0016420003
+num[d,12,10]: -152.2533800244
+num[a,12,11]: 0.0000009000
+num[s,12,11]: -1.0000011000
+num[m,12,11]: -0.2500005500
+num[d,12,11]: -0.9999982000
+num[a,12,12]: -1.0000002000
+num[s,12,12]: 0.0000000000
+num[m,12,12]: 0.2500001000
+num[d,12,12]: 1.0000000000
+num[a,12,13]: 1234567890123456789012345678.4099999000
+num[s,12,13]: -1234567890123456789012345679.4100001000
+num[m,12,13]: -617284068518517406851851740.6895678910
+num[d,12,13]: -0.0000000000
+num[a,12,14]: 1234567890123456789012345678.4209999000
+num[s,12,14]: -1234567890123456789012345679.4210001000
+num[m,12,14]: -617284068518517406851851740.6950678921
+num[d,12,14]: -0.0000000000
+num[a,13,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567890123456789012345678.9100000000
+num[s,13,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998765432109876543210987654321.0900000000
+num[m,13,0]: 24691357802469135780246913578200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,13,0]: 0.0000000000
+num[a,13,1]: 1234567890123456789012345676.9100000000
+num[s,13,1]: 1234567890123456789012345680.9100000000
+num[m,13,1]: -2469135780246913578024691357.8200000000
+num[d,13,1]: -617283945061728394506172839.4550000000
+num[a,13,2]: 1234567890123456789012345679.7040000000
+num[s,13,2]: 1234567890123456789012345678.1160000000
+num[m,13,2]: 980246904758024690475802469.0545400000
+num[d,13,2]: 1554871398140373789688092794.5969773000
+num[a,13,3]: 1234567890123456789012345682.3500000000
+num[s,13,3]: 1234567890123456789012345675.4700000000
+num[m,13,3]: 4246913542024691354202469135.4504000000
+num[d,13,3]: 358886014570772322387309790.3808140000
+num[a,13,4]: 1235160380123456789012345678.9100000000
+num[s,13,4]: 1233975400123456789012345678.9100000000
+num[m,13,4]: 731469129219246912921924691297385900000000000000000.0000000000
+num[d,13,4]: 2083.6940541165
+num[a,13,5]: 1234567890123456789012017278.9100000000
+num[s,13,5]: 1234567890123456789012674078.9100000000
+num[m,13,5]: -405432095116543209511654320954044.0000000000
+num[d,13,5]: -3759341930948406787491.9174140000
+num[a,13,6]: 1234567890123456789012345678.9100000000
+num[s,13,6]: 1234567890123456789012345678.9100000000
+num[m,13,6]: 0.0000000000
+num[d,13,6]: 6172839450617283945061728394550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,13,7]: 1234567890123456789012345678.9110000000
+num[s,13,7]: 1234567890123456789012345678.9090000000
+num[m,13,7]: 1234567890123456789012345.6789100000
+num[d,13,7]: 1234567890123456789012345678910.0000000000
+num[a,13,8]: 1234567890123456789012345678.9100000000
+num[s,13,8]: 1234567890123456789012345678.9100000000
+num[m,13,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,13,9]: 1234567890123456789012345678.9099407510
+num[s,13,9]: 1234567890123456789012345678.9100592490
+num[m,13,9]: -73146912921924691292192.4691297386
+num[d,13,9]: -20836940541164522422527733445458.9950885247
+num[a,13,10]: 1234567890123456789012345678.9132840000
+num[s,13,10]: 1234567890123456789012345678.9067160000
+num[m,13,10]: 4054320951165432095116543.2095404400
+num[d,13,10]: 375934193094840678749191741446.4068209501
+num[a,13,11]: 1234567890123456789012345679.4100010000
+num[s,13,11]: 1234567890123456789012345678.4099990000
+num[m,13,11]: 617285179629618517962961851.8006789100
+num[d,13,11]: 2469130841985229607565476226.8675462649
+num[a,13,12]: 1234567890123456789012345678.4099999000
+num[s,13,12]: 1234567890123456789012345679.4100001000
+num[m,13,12]: -617284068518517406851851740.6895678910
+num[d,13,12]: -2469135286419856294053432547.1334905733
+num[a,13,13]: 2469135780246913578024691357.8200000000
+num[s,13,13]: 0.0000000000
+num[m,13,13]: 1524157875323883675049535156278311236552659655767748818.7881000000
+num[d,13,13]: 1.0000000000
+num[a,13,14]: 2469135780246913578024691357.8310000000
+num[s,13,14]: -0.0110000000
+num[m,13,14]: 1524157875323883675049535156291891483344017680446884621.2561100000
+num[d,13,14]: 1.0000000000
+num[a,14,0]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567890123456789012345678.9210000000
+num[s,14,0]: -19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998765432109876543210987654321.0790000000
+num[m,14,0]: 24691357802469135780246913578420000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[d,14,0]: 0.0000000000
+num[a,14,1]: 1234567890123456789012345676.9210000000
+num[s,14,1]: 1234567890123456789012345680.9210000000
+num[m,14,1]: -2469135780246913578024691357.8420000000
+num[d,14,1]: -617283945061728394506172839.4605000000
+num[a,14,2]: 1234567890123456789012345679.7150000000
+num[s,14,2]: 1234567890123456789012345678.1270000000
+num[m,14,2]: 980246904758024690475802469.0632740000
+num[d,14,2]: 1554871398140373789688092794.6108312000
+num[a,14,3]: 1234567890123456789012345682.3610000000
+num[s,14,3]: 1234567890123456789012345675.4810000000
+num[m,14,3]: 4246913542024691354202469135.4882400000
+num[d,14,3]: 358886014570772322387309790.3840116000
+num[a,14,4]: 1235160380123456789012345678.9210000000
+num[s,14,4]: 1233975400123456789012345678.9210000000
+num[m,14,4]: 731469129219246912921924691303903290000000000000000.0000000000
+num[d,14,4]: 2083.6940541165
+num[a,14,5]: 1234567890123456789012017278.9210000000
+num[s,14,5]: 1234567890123456789012674078.9210000000
+num[m,14,5]: -405432095116543209511654320957656.4000000000
+num[d,14,5]: -3759341930948406787491.9174145000
+num[a,14,6]: 1234567890123456789012345678.9210000000
+num[s,14,6]: 1234567890123456789012345678.9210000000
+num[m,14,6]: 0.0000000000
+num[d,14,6]: 6172839450617283945061728394605000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000
+num[a,14,7]: 1234567890123456789012345678.9220000000
+num[s,14,7]: 1234567890123456789012345678.9200000000
+num[m,14,7]: 1234567890123456789012345.6789210000
+num[d,14,7]: 1234567890123456789012345678921.0000000000
+num[a,14,8]: 1234567890123456789012345678.9210000000
+num[s,14,8]: 1234567890123456789012345678.9210000000
+num[m,14,8]: 0.0000000000
+(errno == PGTYPES_NUM_DIVIDE_ZERO) - r: -1
+num[a,14,9]: 1234567890123456789012345678.9209407510
+num[s,14,9]: 1234567890123456789012345678.9210592490
+num[m,14,9]: -73146912921924691292192.4691303903
+num[d,14,9]: -20836940541164522422527733445644.6522304174
+num[a,14,10]: 1234567890123456789012345678.9242840000
+num[s,14,10]: 1234567890123456789012345678.9177160000
+num[m,14,10]: 4054320951165432095116543.2095765640
+num[d,14,10]: 375934193094840678749191741449.7563946407
+num[a,14,11]: 1234567890123456789012345679.4210010000
+num[s,14,11]: 1234567890123456789012345678.4209990000
+num[m,14,11]: 617285179629618517962961851.8061789210
+num[d,14,11]: 2469130841985229607565476226.8895462209
+num[a,14,12]: 1234567890123456789012345678.4209999000
+num[s,14,12]: 1234567890123456789012345679.4210001000
+num[m,14,12]: -617284068518517406851851740.6950678921
+num[d,14,12]: -2469135286419856294053432547.1554905689
+num[a,14,13]: 2469135780246913578024691357.8310000000
+num[s,14,13]: 0.0110000000
+num[m,14,13]: 1524157875323883675049535156291891483344017680446884621.2561100000
+num[d,14,13]: 1.0000000000
+num[a,14,14]: 2469135780246913578024691357.8420000000
+num[s,14,14]: 0.0000000000
+num[m,14,14]: 1524157875323883675049535156305471730135375705126020423.7242410000
+num[d,14,14]: 1.0000000000
+0: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+1: -2
+2: 0.794
+3: 3.44
+4: 592490000000000000000000
+5: -328400
+6: 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
+7: 0.001
+8: 0.0
+9: -0.000059249
+10: 0.003284
+11: 0.500001
+12: -0.5000001
+13: 1234567890123456789012345678.91
+14: 1234567890123456789012345678.921
diff --git a/src/interfaces/ecpg/test/expected/preproc-array_of_struct.c b/src/interfaces/ecpg/test/expected/preproc-array_of_struct.c
new file mode 100644
index 0000000..1cf3710
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-array_of_struct.c
@@ -0,0 +1,288 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "array_of_struct.pgc"
+#include <stdio.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 3 "array_of_struct.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 5 "array_of_struct.pgc"
+
+/* exec sql whenever sql_warning sqlprint ; */
+#line 6 "array_of_struct.pgc"
+
+/* exec sql whenever not found sqlprint ; */
+#line 7 "array_of_struct.pgc"
+
+
+typedef struct {
+#line 12 "array_of_struct.pgc"
+ struct varchar_1 { int len; char arr[ 50 ]; } name ;
+
+#line 13 "array_of_struct.pgc"
+ int phone ;
+ } customer ;
+#line 14 "array_of_struct.pgc"
+
+
+typedef struct ind {
+#line 19 "array_of_struct.pgc"
+ short name_ind ;
+
+#line 20 "array_of_struct.pgc"
+ short phone_ind ;
+ } cust_ind ;
+#line 21 "array_of_struct.pgc"
+
+
+int main()
+{
+ /* exec sql begin declare section */
+
+
+
+
+
+
+ typedef struct {
+#line 30 "array_of_struct.pgc"
+ struct varchar_2 { int len; char arr[ 50 ]; } name ;
+
+#line 31 "array_of_struct.pgc"
+ int phone ;
+ } customer2 ;
+
+#line 32 "array_of_struct.pgc"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#line 26 "array_of_struct.pgc"
+ customer custs1 [ 10 ] ;
+
+#line 27 "array_of_struct.pgc"
+ cust_ind inds [ 10 ] ;
+
+#line 33 "array_of_struct.pgc"
+ customer2 custs2 [ 10 ] ;
+
+#line 38 "array_of_struct.pgc"
+ struct customer3 {
+#line 36 "array_of_struct.pgc"
+ struct varchar_3 { int len; char arr[ 50 ]; } name ;
+
+#line 37 "array_of_struct.pgc"
+ int phone ;
+ } custs3 [ 10 ] ;
+
+#line 43 "array_of_struct.pgc"
+ struct customer4 {
+#line 41 "array_of_struct.pgc"
+ struct varchar_4 { int len; char arr[ 50 ]; } name ;
+
+#line 42 "array_of_struct.pgc"
+ int phone ;
+ } custs4 ;
+
+#line 44 "array_of_struct.pgc"
+ int r ;
+
+#line 45 "array_of_struct.pgc"
+ struct varchar_5 { int len; char arr[ 50 ]; } onlyname [ 2 ] ;
+/* exec sql end declare section */
+#line 46 "array_of_struct.pgc"
+
+
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 50 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 50 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 50 "array_of_struct.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table customers ( c varchar ( 50 ) , p int )", ECPGt_EOIT, ECPGt_EORT);
+#line 52 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 52 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 52 "array_of_struct.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into customers values ( 'John Doe' , '12345' )", ECPGt_EOIT, ECPGt_EORT);
+#line 53 "array_of_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 53 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 53 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 53 "array_of_struct.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into customers values ( 'Jane Doe' , '67890' )", ECPGt_EOIT, ECPGt_EORT);
+#line 54 "array_of_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 54 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 54 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 54 "array_of_struct.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 2", ECPGt_EOIT,
+ ECPGt_varchar,&(custs1->name),(long)50,(long)10,sizeof( customer ),
+ ECPGt_short,&(inds->name_ind),(long)1,(long)10,sizeof( struct ind ),
+ ECPGt_int,&(custs1->phone),(long)1,(long)10,sizeof( customer ),
+ ECPGt_short,&(inds->phone_ind),(long)1,(long)10,sizeof( struct ind ), ECPGt_EORT);
+#line 56 "array_of_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 56 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 56 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 56 "array_of_struct.pgc"
+
+ printf("custs1:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", custs1[r].name.arr );
+ printf( "phone - %d\n", custs1[r].phone );
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 2", ECPGt_EOIT,
+ ECPGt_varchar,&(custs2->name),(long)50,(long)10,sizeof( customer2 ),
+ ECPGt_short,&(inds->name_ind),(long)1,(long)10,sizeof( struct ind ),
+ ECPGt_int,&(custs2->phone),(long)1,(long)10,sizeof( customer2 ),
+ ECPGt_short,&(inds->phone_ind),(long)1,(long)10,sizeof( struct ind ), ECPGt_EORT);
+#line 64 "array_of_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 64 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 64 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 64 "array_of_struct.pgc"
+
+ printf("\ncusts2:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", custs2[r].name.arr );
+ printf( "phone - %d\n", custs2[r].phone );
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 2", ECPGt_EOIT,
+ ECPGt_varchar,&(custs3->name),(long)50,(long)10,sizeof( struct customer3 ),
+ ECPGt_short,&(inds->name_ind),(long)1,(long)10,sizeof( struct ind ),
+ ECPGt_int,&(custs3->phone),(long)1,(long)10,sizeof( struct customer3 ),
+ ECPGt_short,&(inds->phone_ind),(long)1,(long)10,sizeof( struct ind ), ECPGt_EORT);
+#line 72 "array_of_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 72 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 72 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 72 "array_of_struct.pgc"
+
+ printf("\ncusts3:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", custs3[r].name.arr );
+ printf( "phone - %d\n", custs3[r].phone );
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 1", ECPGt_EOIT,
+ ECPGt_varchar,&(custs4.name),(long)50,(long)1,sizeof( struct customer4 ),
+ ECPGt_short,&(inds[0].name_ind),(long)1,(long)1,sizeof( struct ind ),
+ ECPGt_int,&(custs4.phone),(long)1,(long)1,sizeof( struct customer4 ),
+ ECPGt_short,&(inds[0].phone_ind),(long)1,(long)1,sizeof( struct ind ), ECPGt_EORT);
+#line 80 "array_of_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 80 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 80 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 80 "array_of_struct.pgc"
+
+ printf("\ncusts4:\n");
+ printf( "name - %s\n", custs4.name.arr );
+ printf( "phone - %d\n", custs4.phone );
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select c from customers limit 2", ECPGt_EOIT,
+ ECPGt_varchar,(onlyname),(long)50,(long)2,sizeof(struct varchar_5),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 85 "array_of_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 85 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 85 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 85 "array_of_struct.pgc"
+
+ printf("\nname:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", onlyname[r].arr );
+ }
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 92 "array_of_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 92 "array_of_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 92 "array_of_struct.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-array_of_struct.stderr b/src/interfaces/ecpg/test/expected/preproc-array_of_struct.stderr
new file mode 100644
index 0000000..64aa462
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-array_of_struct.stderr
@@ -0,0 +1,86 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 52: query: create table customers ( c varchar ( 50 ) , p int ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 52: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 52: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: query: insert into customers values ( 'John Doe' , '12345' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 53: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 54: query: insert into customers values ( 'Jane Doe' , '67890' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 54: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 54: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 56: query: select * from customers limit 2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 56: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 56: correctly got 2 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 56: RESULT: John Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 56: RESULT: Jane Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 56: RESULT: 12345 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 56: RESULT: 67890 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 64: query: select * from customers limit 2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 64: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 64: correctly got 2 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 64: RESULT: John Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 64: RESULT: Jane Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 64: RESULT: 12345 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 64: RESULT: 67890 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: query: select * from customers limit 2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 72: correctly got 2 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: John Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: Jane Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: 12345 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: 67890 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 80: query: select * from customers limit 1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 80: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 80: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 80: RESULT: John Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 80: RESULT: 12345 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 85: query: select c from customers limit 2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 85: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 85: correctly got 2 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 85: RESULT: John Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 85: RESULT: Jane Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/preproc-array_of_struct.stdout b/src/interfaces/ecpg/test/expected/preproc-array_of_struct.stdout
new file mode 100644
index 0000000..23f41ff
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-array_of_struct.stdout
@@ -0,0 +1,25 @@
+custs1:
+name - John Doe
+phone - 12345
+name - Jane Doe
+phone - 67890
+
+custs2:
+name - John Doe
+phone - 12345
+name - Jane Doe
+phone - 67890
+
+custs3:
+name - John Doe
+phone - 12345
+name - Jane Doe
+phone - 67890
+
+custs4:
+name - John Doe
+phone - 12345
+
+name:
+name - John Doe
+name - Jane Doe
diff --git a/src/interfaces/ecpg/test/expected/preproc-autoprep.c b/src/interfaces/ecpg/test/expected/preproc-autoprep.c
new file mode 100644
index 0000000..8ed5a2c
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-autoprep.c
@@ -0,0 +1,256 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "autoprep.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* test automatic prepare for all statements */
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 6 "autoprep.pgc"
+
+
+static void test(void) {
+ /* exec sql begin declare section */
+
+
+
+
+#line 10 "autoprep.pgc"
+ int item [ 4 ] , ind [ 4 ] , i = 1 ;
+
+#line 11 "autoprep.pgc"
+ int item1 , ind1 ;
+
+#line 12 "autoprep.pgc"
+ char sqlstr [ 64 ] = "SELECT item2 FROM T ORDER BY item2 NULLS LAST" ;
+/* exec sql end declare section */
+#line 13 "autoprep.pgc"
+
+
+ ECPGdebug(1, stderr);
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 16 "autoprep.pgc"
+
+
+ /* exec sql whenever sql_warning sqlprint ; */
+#line 18 "autoprep.pgc"
+
+ /* exec sql whenever sqlerror sqlprint ; */
+#line 19 "autoprep.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table T ( Item1 int , Item2 int )", ECPGt_EOIT, ECPGt_EORT);
+#line 21 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 21 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 21 "autoprep.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepnormal, "insert into T values ( 1 , null )", ECPGt_EOIT, ECPGt_EORT);
+#line 23 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 23 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 23 "autoprep.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepnormal, "insert into T values ( 1 , $1 )",
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 24 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 24 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 24 "autoprep.pgc"
+
+ i++;
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepnormal, "insert into T values ( 1 , $1 )",
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 26 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 26 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 26 "autoprep.pgc"
+
+ { ECPGprepare(__LINE__, NULL, 0, "i", " insert into T values ( 1 , 2 ) ");
+#line 27 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 27 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 27 "autoprep.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "i", ECPGt_EOIT, ECPGt_EORT);
+#line 28 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 28 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 28 "autoprep.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepnormal, "select Item2 from T order by Item2 nulls last", ECPGt_EOIT,
+ ECPGt_int,(item),(long)1,(long)4,sizeof(int),
+ ECPGt_int,(ind),(long)1,(long)4,sizeof(int), ECPGt_EORT);
+#line 30 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 30 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 30 "autoprep.pgc"
+
+
+ for (i=0; i<4; i++)
+ printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]);
+
+ /* declare C cursor for select Item1 from T */
+#line 35 "autoprep.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare C cursor for select Item1 from T", ECPGt_EOIT, ECPGt_EORT);
+#line 37 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 37 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 37 "autoprep.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in C", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 39 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 39 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 39 "autoprep.pgc"
+
+ printf("i = %d\n", i);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close C", ECPGt_EOIT, ECPGt_EORT);
+#line 42 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 42 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 42 "autoprep.pgc"
+
+
+ { ECPGprepare(__LINE__, NULL, 0, "stmt1", sqlstr);
+#line 44 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 44 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 44 "autoprep.pgc"
+
+
+ /* declare cur1 cursor for $1 */
+#line 46 "autoprep.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur1 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "stmt1", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 48 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 48 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 48 "autoprep.pgc"
+
+
+ /* exec sql whenever not found break ; */
+#line 50 "autoprep.pgc"
+
+
+ i = 0;
+ while (i < 100)
+ {
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur1", ECPGt_EOIT,
+ ECPGt_int,&(item1),(long)1,(long)1,sizeof(int),
+ ECPGt_int,&(ind1),(long)1,(long)1,sizeof(int), ECPGt_EORT);
+#line 55 "autoprep.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+#line 55 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 55 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 55 "autoprep.pgc"
+
+ printf("item[%d] = %d\n", i, ind1 ? -1 : item1);
+ i++;
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur1", ECPGt_EOIT, ECPGt_EORT);
+#line 60 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 60 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 60 "autoprep.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table T", ECPGt_EOIT, ECPGt_EORT);
+#line 62 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 62 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 62 "autoprep.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 64 "autoprep.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 64 "autoprep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 64 "autoprep.pgc"
+
+}
+
+int main() {
+ test();
+ test(); /* retry */
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-autoprep.stderr b/src/interfaces/ecpg/test/expected/preproc-autoprep.stderr
new file mode 100644
index 0000000..bfeea59
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-autoprep.stderr
@@ -0,0 +1,320 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 21: query: create table T ( Item1 int , Item2 int ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 21: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 21: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_auto_prepare on line 23: statement not in cache; inserting
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 23: name ecpg1; query: "insert into T values ( 1 , null )"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: query: insert into T values ( 1 , null ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: using PQexecPrepared for "insert into T values ( 1 , null )"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 23: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_auto_prepare on line 24: statement not in cache; inserting
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 24: name ecpg2; query: "insert into T values ( 1 , $1 )"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: query: insert into T values ( 1 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: using PQexecPrepared for "insert into T values ( 1 , $1 )"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 24: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 24: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_auto_prepare on line 26: statement found in cache; entry 1633
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into T values ( 1 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexecPrepared for "insert into T values ( 1 , $1 )"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 26: parameter 1 = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 27: name i; query: " insert into T values ( 1 , 2 ) "
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: query: insert into T values ( 1 , 2 ) ; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: using PQexecPrepared for " insert into T values ( 1 , 2 ) "
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 28: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_auto_prepare on line 30: statement not in cache; inserting
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 30: name ecpg3; query: "select Item2 from T order by Item2 nulls last"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: query: select Item2 from T order by Item2 nulls last; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: using PQexecPrepared for "select Item2 from T order by Item2 nulls last"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 30: correctly got 4 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 30: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 30: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 30: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 30: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: query: declare C cursor for select Item1 from T; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 37: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: query: fetch 1 in C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 39: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 39: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: query: close C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 42: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 44: name stmt1; query: "SELECT item2 FROM T ORDER BY item2 NULLS LAST"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: query: declare cur1 cursor for SELECT item2 FROM T ORDER BY item2 NULLS LAST; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 48: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 55: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 55: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 55: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 55: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: correctly got 0 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 55: no data found on line 55
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 60: query: close cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 60: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 60: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 62: query: drop table T; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 62: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 62: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name stmt1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name ecpg3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name i
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name ecpg2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name ecpg1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 21: query: create table T ( Item1 int , Item2 int ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 21: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 21: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_auto_prepare on line 23: statement found in cache; entry 15321
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 23: name ecpg1; query: "insert into T values ( 1 , null )"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: query: insert into T values ( 1 , null ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: using PQexecPrepared for "insert into T values ( 1 , null )"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 23: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_auto_prepare on line 24: statement found in cache; entry 1633
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 24: name ecpg2; query: "insert into T values ( 1 , $1 )"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: query: insert into T values ( 1 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: using PQexecPrepared for "insert into T values ( 1 , $1 )"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 24: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 24: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_auto_prepare on line 26: statement found in cache; entry 1633
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into T values ( 1 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexecPrepared for "insert into T values ( 1 , $1 )"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 26: parameter 1 = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 27: name i; query: " insert into T values ( 1 , 2 ) "
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: query: insert into T values ( 1 , 2 ) ; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: using PQexecPrepared for " insert into T values ( 1 , 2 ) "
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 28: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_auto_prepare on line 30: statement found in cache; entry 13049
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 30: name ecpg3; query: "select Item2 from T order by Item2 nulls last"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: query: select Item2 from T order by Item2 nulls last; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: using PQexecPrepared for "select Item2 from T order by Item2 nulls last"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 30: correctly got 4 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 30: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 30: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 30: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 30: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: query: declare C cursor for select Item1 from T; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 37: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: query: fetch 1 in C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 39: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 39: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: query: close C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 42: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 44: name stmt1; query: "SELECT item2 FROM T ORDER BY item2 NULLS LAST"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: query: declare cur1 cursor for SELECT item2 FROM T ORDER BY item2 NULLS LAST; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 48: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 55: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 55: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 55: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 55: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: fetch cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: correctly got 0 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 55: no data found on line 55
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 60: query: close cur1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 60: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 60: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 62: query: drop table T; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 62: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 62: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name stmt1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name ecpg3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name i
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name ecpg2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name ecpg1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/preproc-autoprep.stdout b/src/interfaces/ecpg/test/expected/preproc-autoprep.stdout
new file mode 100644
index 0000000..16a3263
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-autoprep.stdout
@@ -0,0 +1,18 @@
+item[0] = 1
+item[1] = 2
+item[2] = 2
+item[3] = -1
+i = 1
+item[0] = 1
+item[1] = 2
+item[2] = 2
+item[3] = -1
+item[0] = 1
+item[1] = 2
+item[2] = 2
+item[3] = -1
+i = 1
+item[0] = 1
+item[1] = 2
+item[2] = 2
+item[3] = -1
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 0000000..9e00ec2
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-comment.c
@@ -0,0 +1,42 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#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 */
+/*--------------------------------------------------------------------------*/
+
+int main(void)
+{
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 17 "comment.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 19 "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 0000000..a85d73c
--- /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 ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression 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 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-comment.stdout
diff --git a/src/interfaces/ecpg/test/expected/preproc-cursor.c b/src/interfaces/ecpg/test/expected/preproc-cursor.c
new file mode 100644
index 0000000..a4e7b12
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-cursor.c
@@ -0,0 +1,859 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "cursor.pgc"
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "cursor.pgc"
+
+
+/* exec sql whenever sqlerror stop ; */
+#line 6 "cursor.pgc"
+
+
+/* exec sql type c is char reference */
+#line 8 "cursor.pgc"
+
+typedef char* c;
+
+/* exec sql type ind is union {
+#line 11 "cursor.pgc"
+ int integer ;
+
+#line 11 "cursor.pgc"
+ short smallint ;
+ } */
+#line 11 "cursor.pgc"
+
+typedef union { int integer; short smallint; } ind;
+
+#define BUFFERSIZ 8
+/* exec sql type str is [ BUFFERSIZ ] */
+#line 15 "cursor.pgc"
+
+
+#define CURNAME "mycur"
+
+int
+main (void)
+{
+/* exec sql begin declare section */
+
+
+
+
+
+
+
+
+
+
+#line 23 "cursor.pgc"
+ char * stmt1 = "SELECT id, t FROM t1" ;
+
+#line 24 "cursor.pgc"
+ char * curname1 = CURNAME ;
+
+#line 25 "cursor.pgc"
+ char * curname2 = CURNAME ;
+
+#line 26 "cursor.pgc"
+ char * curname3 = CURNAME ;
+
+#line 27 "cursor.pgc"
+ struct varchar_1 { int len; char arr[ 50 ]; } curname4 ;
+
+#line 28 "cursor.pgc"
+ char * curname5 = CURNAME ;
+
+#line 29 "cursor.pgc"
+ int count ;
+
+#line 30 "cursor.pgc"
+ int id ;
+
+#line 31 "cursor.pgc"
+ char t [ 64 ] ;
+/* exec sql end declare section */
+#line 32 "cursor.pgc"
+
+
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "test1", 0);
+#line 39 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 39 "cursor.pgc"
+
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "test2", 0);
+#line 40 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 40 "cursor.pgc"
+
+
+ strcpy(msg, "set");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+#line 43 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 43 "cursor.pgc"
+
+
+ strcpy(msg, "create");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "create table t1 ( id serial primary key , t text )", ECPGt_EOIT, ECPGt_EORT);
+#line 46 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 46 "cursor.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "test2", 0, ECPGst_normal, "create table t1 ( id serial primary key , t text )", ECPGt_EOIT, ECPGt_EORT);
+#line 47 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 47 "cursor.pgc"
+
+
+ strcpy(msg, "insert");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'a' )", ECPGt_EOIT, ECPGt_EORT);
+#line 50 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 50 "cursor.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'b' )", ECPGt_EOIT, ECPGt_EORT);
+#line 51 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 51 "cursor.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'c' )", ECPGt_EOIT, ECPGt_EORT);
+#line 52 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 52 "cursor.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'd' )", ECPGt_EOIT, ECPGt_EORT);
+#line 53 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 53 "cursor.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "test2", 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'e' )", ECPGt_EOIT, ECPGt_EORT);
+#line 54 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 54 "cursor.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, "test1", "commit");
+#line 57 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 57 "cursor.pgc"
+
+ { ECPGtrans(__LINE__, "test2", "commit");
+#line 58 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 58 "cursor.pgc"
+
+
+ /* Dynamic cursorname test with INTO list in FETCH stmts */
+
+ strcpy(msg, "declare");
+ ECPGset_var( 0, &( curname1 ), __LINE__);\
+ /* declare $0 cursor for select id , t from t1 */
+#line 64 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 64 "cursor.pgc"
+
+#line 64 "cursor.pgc"
+
+
+ strcpy(msg, "open");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "declare $0 cursor for select id , t from t1",
+ ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 67 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 67 "cursor.pgc"
+
+
+ strcpy(msg, "fetch from");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch forward from $0",
+ ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 70 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 70 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch forward $0",
+ ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 74 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 74 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch 1 from");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 from $0",
+ ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 78 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 78 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch :count from");
+ count = 1;
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 from $0",
+ ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 83 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 83 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "move in");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "move absolute 0 in $0",
+ ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 87 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 87 "cursor.pgc"
+
+
+ strcpy(msg, "fetch 1");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 $0",
+ ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 90 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 90 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch :count");
+ count = 1;
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 $0",
+ ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 95 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 95 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "close");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "close $0",
+ ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 99 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 99 "cursor.pgc"
+
+
+ /* Dynamic cursorname test with INTO list in DECLARE stmt */
+
+ strcpy(msg, "declare");
+ ECPGset_var( 1, &( curname2 ), __LINE__);\
+ ECPGset_var( 2, ( t ), __LINE__);\
+ ECPGset_var( 3, &( id ), __LINE__);\
+ /* declare $0 cursor for select id , t from t1 */
+#line 105 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 105 "cursor.pgc"
+
+#line 105 "cursor.pgc"
+
+
+ strcpy(msg, "open");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "declare $0 cursor for select id , t from t1",
+ ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 108 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 108 "cursor.pgc"
+
+
+ strcpy(msg, "fetch from");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch from $0",
+ ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 111 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 111 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0",
+ ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 115 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 115 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch 1 from");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 from $0",
+ ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 119 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 119 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch :count from");
+ count = 1;
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 from $0",
+ ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 124 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 124 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "move");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "move absolute 0 $0",
+ ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 128 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 128 "cursor.pgc"
+
+
+ strcpy(msg, "fetch 1");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 $0",
+ ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 131 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 131 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch :count");
+ count = 1;
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 $0",
+ ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 136 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 136 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "close");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "close $0",
+ ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 140 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 140 "cursor.pgc"
+
+
+ /* Dynamic cursorname test with PREPARED stmt */
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, "test1", 0, "st_id1", stmt1);
+#line 145 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 145 "cursor.pgc"
+
+ { ECPGprepare(__LINE__, "test2", 0, "st_id1", stmt1);
+#line 146 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 146 "cursor.pgc"
+
+
+ strcpy(msg, "declare");
+ ECPGset_var( 4, &( curname3 ), __LINE__);\
+ /* declare $0 cursor for $1 */
+#line 149 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 149 "cursor.pgc"
+
+#line 149 "cursor.pgc"
+
+ ECPGset_var( 5, &( curname5 ), __LINE__);\
+ /* declare $0 cursor for $1 */
+#line 150 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 150 "cursor.pgc"
+
+#line 150 "cursor.pgc"
+
+
+ strcpy(msg, "open");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "declare $0 cursor for $1",
+ ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char_variable,(ECPGprepared_statement("test1", "st_id1", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 153 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 153 "cursor.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "test2", 0, ECPGst_normal, "declare $0 cursor for $1",
+ ECPGt_char,&(curname5),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char_variable,(ECPGprepared_statement("test2", "st_id1", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 154 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 154 "cursor.pgc"
+
+
+ strcpy(msg, "fetch");
+ { ECPGdo(__LINE__, 0, 1, "test2", 0, ECPGst_normal, "fetch $0",
+ ECPGt_char,&(curname5),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 157 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 157 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch from");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch from $0",
+ ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 161 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 161 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch 1 from");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 from $0",
+ ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 165 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 165 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch :count from");
+ count = 1;
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 from $0",
+ ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 170 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 170 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "move");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "move absolute 0 $0",
+ ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 174 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 174 "cursor.pgc"
+
+
+ strcpy(msg, "fetch 1");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 $0",
+ ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 177 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 177 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch :count");
+ count = 1;
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 $0",
+ ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 182 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 182 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "close");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "close $0",
+ ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 186 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 186 "cursor.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "test2", 0, ECPGst_normal, "close $0",
+ ECPGt_char,&(curname5),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 187 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 187 "cursor.pgc"
+
+
+ strcpy(msg, "deallocate prepare");
+ { ECPGdeallocate(__LINE__, 0, "test1", "st_id1");
+#line 190 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 190 "cursor.pgc"
+
+ { ECPGdeallocate(__LINE__, 0, "test2", "st_id1");
+#line 191 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 191 "cursor.pgc"
+
+
+ /* Dynamic cursorname test with PREPARED stmt,
+ cursor name in varchar */
+
+ curname4.len = strlen(CURNAME);
+ strcpy(curname4.arr, CURNAME);
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, "test1", 0, "st_id2", stmt1);
+#line 200 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 200 "cursor.pgc"
+
+
+ strcpy(msg, "declare");
+ ECPGset_var( 6, &( curname4 ), __LINE__);\
+ /* declare $0 cursor for $1 */
+#line 203 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 203 "cursor.pgc"
+
+#line 203 "cursor.pgc"
+
+
+ strcpy(msg, "open");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "declare $0 cursor for $1",
+ ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char_variable,(ECPGprepared_statement("test1", "st_id2", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 206 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 206 "cursor.pgc"
+
+
+ strcpy(msg, "fetch from");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch from $0",
+ ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 209 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 209 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0",
+ ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 213 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 213 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch 1 from");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 from $0",
+ ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 217 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 217 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch :count from");
+ count = 1;
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 from $0",
+ ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 222 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 222 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "move");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "move absolute 0 $0",
+ ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 226 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 226 "cursor.pgc"
+
+
+ strcpy(msg, "fetch 1");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch 1 $0",
+ ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 229 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 229 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "fetch :count");
+ count = 1;
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "fetch $0 $0",
+ ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 234 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 234 "cursor.pgc"
+
+ printf("%d %s\n", id, t);
+
+ strcpy(msg, "close");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "close $0",
+ ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 238 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 238 "cursor.pgc"
+
+
+ strcpy(msg, "deallocate prepare");
+ { ECPGdeallocate(__LINE__, 0, "test1", "st_id2");
+#line 241 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 241 "cursor.pgc"
+
+
+ /* End test */
+
+ strcpy(msg, "drop");
+ { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT);
+#line 246 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 246 "cursor.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "test2", 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT);
+#line 247 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 247 "cursor.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, "test1", "commit");
+#line 250 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 250 "cursor.pgc"
+
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 253 "cursor.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 253 "cursor.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-cursor.stderr b/src/interfaces/ecpg/test/expected/preproc-cursor.stderr
new file mode 100644
index 0000000..5a9bc39
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-cursor.stderr
@@ -0,0 +1,412 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 43: query: set datestyle to iso; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 43: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 43: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: query: create table t1 ( id serial primary key , t text ); with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 47: query: create table t1 ( id serial primary key , t text ); with 0 parameter(s) on connection test2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 47: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 47: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: query: insert into t1 ( id , t ) values ( default , 'a' ); with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 50: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: query: insert into t1 ( id , t ) values ( default , 'b' ); with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 51: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 52: query: insert into t1 ( id , t ) values ( default , 'c' ); with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 52: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 52: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: query: insert into t1 ( id , t ) values ( default , 'd' ); with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 53: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 54: query: insert into t1 ( id , t ) values ( default , 'e' ); with 0 parameter(s) on connection test2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 54: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 54: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 57: action "commit"; connection "test1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 58: action "commit"; connection "test2"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 67: query: declare mycur cursor for select id , t from t1; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 67: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 67: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 70: query: fetch forward from mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 70: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 70: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 70: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 70: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: query: fetch forward mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 74: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 74: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 74: RESULT: b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 78: query: fetch 1 from mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 78: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 78: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 78: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 78: RESULT: c offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 83: query: fetch 1 from mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 83: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 83: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 83: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 83: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 87: query: move absolute 0 in mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 87: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 87: OK: MOVE 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 90: query: fetch 1 mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 90: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 90: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 90: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 90: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 95: query: fetch 1 mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 95: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 95: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 95: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 95: RESULT: b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 99: query: close mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 99: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 99: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 108: query: declare mycur cursor for select id , t from t1; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 108: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 108: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 111: query: fetch from mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 111: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 111: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 111: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 111: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 115: query: fetch mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 115: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 115: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 115: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 115: RESULT: b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 119: query: fetch 1 from mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 119: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 119: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 119: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 119: RESULT: c offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 124: query: fetch 1 from mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 124: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 124: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 124: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 124: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 128: query: move absolute 0 mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 128: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 128: OK: MOVE 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 131: query: fetch 1 mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 131: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 131: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 131: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 131: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 136: query: fetch 1 mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 136: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 136: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 136: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 136: RESULT: b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 140: query: close mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 140: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 140: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 145: name st_id1; query: "SELECT id, t FROM t1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 146: name st_id1; query: "SELECT id, t FROM t1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 153: query: declare mycur cursor for SELECT id, t FROM t1; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 153: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 153: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 154: query: declare mycur cursor for SELECT id, t FROM t1; with 0 parameter(s) on connection test2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 154: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 154: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 157: query: fetch mycur; with 0 parameter(s) on connection test2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 157: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 157: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: e offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 161: query: fetch from mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 161: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 161: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 161: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 161: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 165: query: fetch 1 from mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 165: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 165: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 165: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 165: RESULT: b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 170: query: fetch 1 from mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 170: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 170: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 170: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 170: RESULT: c offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 174: query: move absolute 0 mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 174: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 174: OK: MOVE 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 177: query: fetch 1 mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 177: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 177: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 177: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 177: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 182: query: fetch 1 mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 182: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 182: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 182: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 182: RESULT: b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 186: query: close mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 186: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 186: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 187: query: close mycur; with 0 parameter(s) on connection test2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 187: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 187: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 190: name st_id1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 191: name st_id1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 200: name st_id2; query: "SELECT id, t FROM t1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 206: query: declare mycur cursor for SELECT id, t FROM t1; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 206: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 206: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 209: query: fetch from mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 209: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 209: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 209: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 209: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 213: query: fetch mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 213: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 213: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 213: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 213: RESULT: b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 217: query: fetch 1 from mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 217: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 217: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 217: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 217: RESULT: c offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 222: query: fetch 1 from mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 222: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 222: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 222: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 222: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 226: query: move absolute 0 mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 226: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 226: OK: MOVE 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 229: query: fetch 1 mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 229: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 229: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 229: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 229: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 234: query: fetch 1 mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 234: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 234: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 234: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 234: RESULT: b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 238: query: close mycur; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 238: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 238: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 241: name st_id2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 246: query: drop table t1; with 0 parameter(s) on connection test1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 246: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 246: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 247: query: drop table t1; with 0 parameter(s) on connection test2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 247: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 247: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 250: action "commit"; connection "test1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection test2 closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection test1 closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/preproc-cursor.stdout b/src/interfaces/ecpg/test/expected/preproc-cursor.stdout
new file mode 100644
index 0000000..233dc03
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-cursor.stdout
@@ -0,0 +1,24 @@
+1 a
+2 b
+3 c
+4 d
+1 a
+2 b
+1 a
+2 b
+3 c
+4 d
+1 a
+2 b
+1 e
+1 a
+2 b
+3 c
+1 a
+2 b
+1 a
+2 b
+3 c
+4 d
+1 a
+2 b
diff --git a/src/interfaces/ecpg/test/expected/preproc-define.c b/src/interfaces/ecpg/test/expected/preproc-define.c
new file mode 100644
index 0000000..455e96a
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-define.c
@@ -0,0 +1,184 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "define.pgc"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 5 "define.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 7 "define.pgc"
+
+
+
+
+
+/* exec sql type intarray is int [ 6 ] */
+#line 12 "define.pgc"
+
+typedef int intarray[ 6];
+
+int
+main(void)
+{
+/* exec sql begin declare section */
+
+
+ typedef char string [ 8 ];
+
+#line 21 "define.pgc"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#line 22 "define.pgc"
+ intarray amount ;
+
+#line 23 "define.pgc"
+ char name [ 6 ] [ 8 ] ;
+
+#line 36 "define.pgc"
+ char letter [ 6 ] [ 1 ] ;
+
+#if 0
+
+#line 38 "define.pgc"
+ int not_used ;
+
+#endif
+/* exec sql end declare section */
+#line 45 "define.pgc"
+
+ int i,j;
+
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 50 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 50 "define.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) )", ECPGt_EOIT, ECPGt_EORT);
+#line 52 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 52 "define.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 53 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 53 "define.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into Test ( name , amount , letter ) values ( 'false' , 1 , 'f' )", ECPGt_EOIT, ECPGt_EORT);
+#line 55 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 55 "define.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test ( name , amount , letter ) values ( 'true' , 2 , 't' )", ECPGt_EOIT, ECPGt_EORT);
+#line 56 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 56 "define.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 57 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 57 "define.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "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 59 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 59 "define.pgc"
+
+
+ for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
+ {
+ /* exec sql begin declare section */
+
+
+
+
+#line 64 "define.pgc"
+ string n ;
+
+#line 65 "define.pgc"
+ char l = letter [ i ] [ 0 ] ;
+
+#line 66 "define.pgc"
+ int a = amount [ i ] ;
+/* exec sql end declare section */
+#line 67 "define.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, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
+#line 73 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 73 "define.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 74 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 74 "define.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 75 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 75 "define.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-define.stderr b/src/interfaces/ecpg/test/expected/preproc-define.stderr
new file mode 100644
index 0000000..3f05277
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-define.stderr
@@ -0,0 +1,54 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 52: query: create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 52: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 52: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 53: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: insert into Test ( name , amount , letter ) values ( 'false' , 1 , 'f' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 56: query: insert into test ( name , amount , letter ) values ( 'true' , 2 , 't' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 56: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 56: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 57: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 59: query: select * from test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 59: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 59: correctly got 2 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: false offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: true offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: f offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 59: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 73: query: drop table test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 73: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 73: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 74: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/preproc-define.stdout b/src/interfaces/ecpg/test/expected/preproc-define.stdout
new file mode 100644
index 0000000..8526a5c
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-define.stdout
@@ -0,0 +1,2 @@
+name[0]=false amount[0]=1 letter[0]=f
+name[1]=true amount[1]=2 letter[1]=t
diff --git a/src/interfaces/ecpg/test/expected/preproc-describe.c b/src/interfaces/ecpg/test/expected/preproc-describe.c
new file mode 100644
index 0000000..143e966
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-describe.c
@@ -0,0 +1,481 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "describe.pgc"
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "describe.pgc"
+
+
+/* exec sql whenever sqlerror stop ; */
+#line 6 "describe.pgc"
+
+
+int
+main (void)
+{
+/* exec sql begin declare section */
+
+
+
+
+
+
+
+
+#line 12 "describe.pgc"
+ char * stmt1 = "SELECT id, t FROM t1" ;
+
+#line 13 "describe.pgc"
+ char * stmt2 = "SELECT id, t FROM t1 WHERE id = -1" ;
+
+#line 14 "describe.pgc"
+ int i , count1 , count2 , count3 , count4 ;
+
+#line 15 "describe.pgc"
+ char field_name1 [ 30 ] = "not set" ;
+
+#line 16 "describe.pgc"
+ char field_name2 [ 30 ] = "not set" ;
+
+#line 17 "describe.pgc"
+ char field_name3 [ 30 ] = "not set" ;
+
+#line 18 "describe.pgc"
+ char field_name4 [ 30 ] = "not set" ;
+/* exec sql end declare section */
+#line 19 "describe.pgc"
+
+
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 26 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 26 "describe.pgc"
+
+
+ strcpy(msg, "set");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+#line 29 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 29 "describe.pgc"
+
+
+ strcpy(msg, "create");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table t1 ( id serial primary key , t text )", ECPGt_EOIT, ECPGt_EORT);
+#line 32 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 32 "describe.pgc"
+
+
+ strcpy(msg, "insert");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'a' )", ECPGt_EOIT, ECPGt_EORT);
+#line 35 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 35 "describe.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'b' )", ECPGt_EOIT, ECPGt_EORT);
+#line 36 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 36 "describe.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'c' )", ECPGt_EOIT, ECPGt_EORT);
+#line 37 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 37 "describe.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'd' )", ECPGt_EOIT, ECPGt_EORT);
+#line 38 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 38 "describe.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 41 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 41 "describe.pgc"
+
+
+ /*
+ * Test DESCRIBE with a query producing tuples.
+ * DESCRIPTOR and SQL DESCRIPTOR are the same in native mode.
+ */
+
+ strcpy(msg, "allocate");
+ ECPGallocate_desc(__LINE__, "desc1");
+#line 49 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 49 "describe.pgc"
+
+ ECPGallocate_desc(__LINE__, "desc2");
+#line 50 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 50 "describe.pgc"
+
+ ECPGallocate_desc(__LINE__, "desc3");
+#line 51 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 51 "describe.pgc"
+
+ ECPGallocate_desc(__LINE__, "desc4");
+#line 52 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 52 "describe.pgc"
+
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, NULL, 0, "st_id1", stmt1);
+#line 55 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 55 "describe.pgc"
+
+
+ strcpy(msg, "describe");
+ { ECPGdescribe(__LINE__, 0, NULL, "st_id1",
+ ECPGt_descriptor, "desc1", 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 58 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 0, NULL, "st_id1",
+ ECPGt_descriptor, "desc2", 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 59 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 0, NULL, "st_id1",
+ ECPGt_descriptor, "desc3", 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 60 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 0, NULL, "st_id1",
+ ECPGt_descriptor, "desc4", 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 61 "describe.pgc"
+
+
+ strcpy(msg, "get descriptor");
+ { ECPGget_desc_header(__LINE__, "desc1", &(count1));
+
+#line 64 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 64 "describe.pgc"
+
+ { ECPGget_desc_header(__LINE__, "desc2", &(count2));
+
+#line 65 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 65 "describe.pgc"
+
+ { ECPGget_desc_header(__LINE__, "desc3", &(count3));
+
+#line 66 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 66 "describe.pgc"
+
+ { ECPGget_desc_header(__LINE__, "desc4", &(count4));
+
+#line 67 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 67 "describe.pgc"
+
+
+ if (!(count1 == count2 && count1 == count3 && count1 == count4))
+ exit(1);
+
+ for (i = 1; i <= count1; i++)
+ {
+ { ECPGget_desc(__LINE__, "desc1", i,ECPGd_name,
+ ECPGt_char,(field_name1),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 74 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 74 "describe.pgc"
+
+ { ECPGget_desc(__LINE__, "desc2", i,ECPGd_name,
+ ECPGt_char,(field_name2),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 75 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 75 "describe.pgc"
+
+ { ECPGget_desc(__LINE__, "desc3", i,ECPGd_name,
+ ECPGt_char,(field_name3),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 76 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 76 "describe.pgc"
+
+ { ECPGget_desc(__LINE__, "desc4", i,ECPGd_name,
+ ECPGt_char,(field_name4),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 77 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 77 "describe.pgc"
+
+ printf("field_name 1 '%s' 2 '%s' 3 '%s' 4 '%s'\n",
+ field_name1, field_name2, field_name3, field_name4);
+ }
+
+ strcpy(msg, "deallocate");
+ ECPGdeallocate_desc(__LINE__, "desc1");
+#line 83 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 83 "describe.pgc"
+
+ ECPGdeallocate_desc(__LINE__, "desc2");
+#line 84 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 84 "describe.pgc"
+
+ ECPGdeallocate_desc(__LINE__, "desc3");
+#line 85 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 85 "describe.pgc"
+
+ ECPGdeallocate_desc(__LINE__, "desc4");
+#line 86 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 86 "describe.pgc"
+
+
+ { ECPGdeallocate(__LINE__, 0, NULL, "st_id1");
+#line 88 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 88 "describe.pgc"
+
+
+ /* Test DESCRIBE with a query not producing tuples */
+
+ strcpy(msg, "allocate");
+ ECPGallocate_desc(__LINE__, "desc1");
+#line 93 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 93 "describe.pgc"
+
+ ECPGallocate_desc(__LINE__, "desc2");
+#line 94 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 94 "describe.pgc"
+
+ ECPGallocate_desc(__LINE__, "desc3");
+#line 95 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 95 "describe.pgc"
+
+ ECPGallocate_desc(__LINE__, "desc4");
+#line 96 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 96 "describe.pgc"
+
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, NULL, 0, "st_id2", stmt2);
+#line 99 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 99 "describe.pgc"
+
+
+ strcpy(msg, "describe");
+ { ECPGdescribe(__LINE__, 0, NULL, "st_id2",
+ ECPGt_descriptor, "desc1", 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 102 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 0, NULL, "st_id2",
+ ECPGt_descriptor, "desc2", 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 103 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 0, NULL, "st_id2",
+ ECPGt_descriptor, "desc3", 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 104 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 0, NULL, "st_id2",
+ ECPGt_descriptor, "desc4", 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 105 "describe.pgc"
+
+
+ strcpy(msg, "get descriptor");
+ { ECPGget_desc_header(__LINE__, "desc1", &(count1));
+
+#line 108 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 108 "describe.pgc"
+
+ { ECPGget_desc_header(__LINE__, "desc2", &(count2));
+
+#line 109 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 109 "describe.pgc"
+
+ { ECPGget_desc_header(__LINE__, "desc3", &(count3));
+
+#line 110 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 110 "describe.pgc"
+
+ { ECPGget_desc_header(__LINE__, "desc4", &(count4));
+
+#line 111 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 111 "describe.pgc"
+
+
+ if (!(count1 == count2 && count1 == count3 && count1 == count4))
+ exit(1);
+
+ for (i = 1; i <= count1; i++)
+ {
+ { ECPGget_desc(__LINE__, "desc1", i,ECPGd_name,
+ ECPGt_char,(field_name1),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 118 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 118 "describe.pgc"
+
+ { ECPGget_desc(__LINE__, "desc2", i,ECPGd_name,
+ ECPGt_char,(field_name2),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 119 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 119 "describe.pgc"
+
+ { ECPGget_desc(__LINE__, "desc3", i,ECPGd_name,
+ ECPGt_char,(field_name3),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 120 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 120 "describe.pgc"
+
+ { ECPGget_desc(__LINE__, "desc4", i,ECPGd_name,
+ ECPGt_char,(field_name4),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 121 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 121 "describe.pgc"
+
+ printf("field_name 1 '%s' 2 '%s' 3 '%s' 4 '%s'\n",
+ field_name1, field_name2, field_name3, field_name4);
+ }
+
+ strcpy(msg, "deallocate");
+ ECPGdeallocate_desc(__LINE__, "desc1");
+#line 127 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 127 "describe.pgc"
+
+ ECPGdeallocate_desc(__LINE__, "desc2");
+#line 128 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 128 "describe.pgc"
+
+ ECPGdeallocate_desc(__LINE__, "desc3");
+#line 129 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 129 "describe.pgc"
+
+ ECPGdeallocate_desc(__LINE__, "desc4");
+#line 130 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 130 "describe.pgc"
+
+
+ { ECPGdeallocate(__LINE__, 0, NULL, "st_id2");
+#line 132 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 132 "describe.pgc"
+
+
+
+ /* End test */
+
+ strcpy(msg, "drop");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT);
+#line 138 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 138 "describe.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 141 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 141 "describe.pgc"
+
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 144 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 144 "describe.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-describe.stderr b/src/interfaces/ecpg/test/expected/preproc-describe.stderr
new file mode 100644
index 0000000..0537a0f
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-describe.stderr
@@ -0,0 +1,140 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: query: set datestyle to iso; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: create table t1 ( id serial primary key , t text ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: query: insert into t1 ( id , t ) values ( default , 'a' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: insert into t1 ( id , t ) values ( default , 'b' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: query: insert into t1 ( id , t ) values ( default , 'c' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: query: insert into t1 ( id , t ) values ( default , 'd' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 41: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare on line 55: name st_id1; query: "SELECT id, t FROM t1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGdeallocate on line 88: name st_id1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare on line 99: name st_id2; query: "SELECT id, t FROM t1 WHERE id = -1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGdeallocate on line 132: name st_id2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 138: query: drop table t1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 138: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 138: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 141: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/preproc-describe.stdout b/src/interfaces/ecpg/test/expected/preproc-describe.stdout
new file mode 100644
index 0000000..d27324e
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-describe.stdout
@@ -0,0 +1,4 @@
+field_name 1 'id' 2 'id' 3 'id' 4 'id'
+field_name 1 't' 2 't' 3 't' 4 't'
+field_name 1 'id' 2 'id' 3 'id' 4 'id'
+field_name 1 't' 2 't' 3 't' 4 't'
diff --git a/src/interfaces/ecpg/test/expected/preproc-init.c b/src/interfaces/ecpg/test/expected/preproc-init.c
new file mode 100644
index 0000000..b0e0473
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-init.c
@@ -0,0 +1,261 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "init.pgc"
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 1 "init.pgc"
+
+
+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(const char *notice, short trans)
+{
+ if (!notice)
+ notice = "-empty-";
+ printf("in sqlnotice (%s, %d)\n", notice, trans);
+}
+
+
+
+#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 */
+
+
+
+
+
+
+
+
+
+
+
+ /* = 1L */
+
+#line 60 "init.pgc"
+ int a = ( int ) 2 ;
+
+#line 61 "init.pgc"
+ int b = 2 + 2 ;
+
+#line 62 "init.pgc"
+ int b2 = ( 14 * 7 ) ;
+
+#line 63 "init.pgc"
+ int d = x . member ;
+
+#line 64 "init.pgc"
+ int g = fb ( 2 ) ;
+
+#line 65 "init.pgc"
+ int i = 3 ^ 1 ;
+
+#line 66 "init.pgc"
+ int j = 1 ? 1 : 2 ;
+
+#line 68 "init.pgc"
+ int e = y -> member ;
+
+#line 69 "init.pgc"
+ int c = 10 >> 2 ;
+
+#line 70 "init.pgc"
+ bool h = 2 || 1 ;
+
+#line 71 "init.pgc"
+ long iay ;
+/* exec sql end declare section */
+#line 72 "init.pgc"
+
+
+ int f=fa();
+
+#ifdef _cplusplus
+ /* exec sql begin declare section */
+ /* compile error */
+
+#line 78 "init.pgc"
+ int k = N : : i ;
+/* exec sql end declare section */
+#line 79 "init.pgc"
+
+#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 ( ) ; */
+#line 87 "init.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
+#line 88 "init.pgc"
+
+if (sqlca.sqlcode < 0) fa ( );}
+#line 88 "init.pgc"
+
+ /* exec sql whenever sqlerror do fb ( 20 ) ; */
+#line 89 "init.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
+#line 90 "init.pgc"
+
+if (sqlca.sqlcode < 0) fb ( 20 );}
+#line 90 "init.pgc"
+
+ /* exec sql whenever sqlerror do fc ( \"50\" ) ; */
+#line 91 "init.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
+#line 92 "init.pgc"
+
+if (sqlca.sqlcode < 0) fc ( "50" );}
+#line 92 "init.pgc"
+
+ /* exec sql whenever sqlerror do fd ( \"50\" , 1 ) ; */
+#line 93 "init.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
+#line 94 "init.pgc"
+
+if (sqlca.sqlcode < 0) fd ( "50" , 1 );}
+#line 94 "init.pgc"
+
+ /* exec sql whenever sqlerror do fe ( ENUM0 ) ; */
+#line 95 "init.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
+#line 96 "init.pgc"
+
+if (sqlca.sqlcode < 0) fe ( ENUM0 );}
+#line 96 "init.pgc"
+
+ /* exec sql whenever sqlerror do sqlnotice ( NULL , 0 ) ; */
+#line 97 "init.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
+#line 98 "init.pgc"
+
+if (sqlca.sqlcode < 0) sqlnotice ( NULL , 0 );}
+#line 98 "init.pgc"
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-init.stderr b/src/interfaces/ecpg/test/expected/preproc-init.stderr
new file mode 100644
index 0000000..1b6fa18
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-init.stderr
@@ -0,0 +1,14 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -220 on line 88: connection "NULL" does not exist on line 88
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: raising sqlcode -220 on line 90: connection "NULL" does not exist on line 90
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: raising sqlcode -220 on line 92: connection "NULL" does not exist on line 92
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: raising sqlcode -220 on line 94: connection "NULL" does not exist on line 94
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: raising sqlcode -220 on line 96: connection "NULL" does not exist on line 96
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: raising sqlcode -220 on line 98: connection "NULL" does not exist on line 98
+[NO_PID]: sqlca: code: -220, state: 08003
diff --git a/src/interfaces/ecpg/test/expected/preproc-init.stdout b/src/interfaces/ecpg/test/expected/preproc-init.stdout
new file mode 100644
index 0000000..4738d79
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-init.stdout
@@ -0,0 +1,10 @@
+in fb (2)
+in fa
+2 4 98 2 14 14 2 2 1 2 1
+0
+in fa
+in fb (20)
+in fc (50)
+in fd (50, 1)
+in fe (0)
+in sqlnotice (-empty-, 0)
diff --git a/src/interfaces/ecpg/test/expected/preproc-outofscope.c b/src/interfaces/ecpg/test/expected/preproc-outofscope.c
new file mode 100644
index 0000000..3a27c53
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-outofscope.c
@@ -0,0 +1,372 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "outofscope.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 6 "outofscope.pgc"
+
+
+
+#line 1 "pgtypes_numeric.h"
+#ifndef PGTYPES_NUMERIC
+#define PGTYPES_NUMERIC
+
+#include <pgtypes.h>
+
+#define NUMERIC_POS 0x0000
+#define NUMERIC_NEG 0x4000
+#define NUMERIC_NAN 0xC000
+#define NUMERIC_NULL 0xF000
+#define NUMERIC_MAX_PRECISION 1000
+#define NUMERIC_MAX_DISPLAY_SCALE NUMERIC_MAX_PRECISION
+#define NUMERIC_MIN_DISPLAY_SCALE 0
+#define NUMERIC_MIN_SIG_DIGITS 16
+
+#define DECSIZE 30
+
+typedef unsigned char NumericDigit;
+typedef struct
+{
+ int ndigits; /* number of digits in digits[] - can be 0! */
+ int weight; /* weight of first digit */
+ int rscale; /* result scale */
+ int dscale; /* display scale */
+ int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */
+ NumericDigit *buf; /* start of alloc'd space for digits[] */
+ NumericDigit *digits; /* decimal digits */
+} numeric;
+
+typedef struct
+{
+ int ndigits; /* number of digits in digits[] - can be 0! */
+ int weight; /* weight of first digit */
+ int rscale; /* result scale */
+ int dscale; /* display scale */
+ int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */
+ NumericDigit digits[DECSIZE]; /* decimal digits */
+} decimal;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+numeric *PGTYPESnumeric_new(void);
+decimal *PGTYPESdecimal_new(void);
+void PGTYPESnumeric_free(numeric *);
+void PGTYPESdecimal_free(decimal *);
+numeric *PGTYPESnumeric_from_asc(char *, char **);
+char *PGTYPESnumeric_to_asc(numeric *, int);
+int PGTYPESnumeric_add(numeric *, numeric *, numeric *);
+int PGTYPESnumeric_sub(numeric *, numeric *, numeric *);
+int PGTYPESnumeric_mul(numeric *, numeric *, numeric *);
+int PGTYPESnumeric_div(numeric *, numeric *, numeric *);
+int PGTYPESnumeric_cmp(numeric *, numeric *);
+int PGTYPESnumeric_from_int(signed int, numeric *);
+int PGTYPESnumeric_from_long(signed long int, numeric *);
+int PGTYPESnumeric_copy(numeric *, numeric *);
+int PGTYPESnumeric_from_double(double, numeric *);
+int PGTYPESnumeric_to_double(numeric *, double *);
+int PGTYPESnumeric_to_int(numeric *, int *);
+int PGTYPESnumeric_to_long(numeric *, long *);
+int PGTYPESnumeric_to_decimal(numeric *, decimal *);
+int PGTYPESnumeric_from_decimal(decimal *, numeric *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PGTYPES_NUMERIC */
+
+#line 8 "outofscope.pgc"
+
+
+/* exec sql begin declare section */
+
+#line 1 "struct.h"
+
+
+
+
+ /* dec_t */
+
+
+
+ typedef struct mytype MYTYPE ;
+
+#line 9 "struct.h"
+
+
+
+
+
+
+
+
+
+
+ typedef struct mynulltype MYNULLTYPE ;
+
+#line 19 "struct.h"
+
+
+#line 11 "outofscope.pgc"
+
+struct mytype {
+#line 3 "struct.h"
+ int id ;
+
+#line 4 "struct.h"
+ char t [ 64 ] ;
+
+#line 5 "struct.h"
+ double d1 ;
+
+#line 6 "struct.h"
+ double d2 ;
+
+#line 7 "struct.h"
+ char c [ 30 ] ;
+ } ; struct mynulltype {
+#line 13 "struct.h"
+ int id ;
+
+#line 14 "struct.h"
+ int t ;
+
+#line 15 "struct.h"
+ int d1 ;
+
+#line 16 "struct.h"
+ int d2 ;
+
+#line 17 "struct.h"
+ int c ;
+ } ;/* exec sql end declare section */
+#line 12 "outofscope.pgc"
+
+
+/* exec sql whenever sqlerror stop ; */
+#line 14 "outofscope.pgc"
+
+
+/* Functions for test 1 */
+
+static void
+get_var1(MYTYPE **myvar0, MYNULLTYPE **mynullvar0)
+{
+ /* exec sql begin declare section */
+
+
+
+#line 22 "outofscope.pgc"
+ MYTYPE * myvar = malloc ( sizeof ( MYTYPE ) ) ;
+
+#line 23 "outofscope.pgc"
+ MYNULLTYPE * mynullvar = malloc ( sizeof ( MYNULLTYPE ) ) ;
+/* exec sql end declare section */
+#line 24 "outofscope.pgc"
+
+
+ /* Test DECLARE ... SELECT ... INTO with pointers */
+
+ ECPGset_var( 0, ( myvar ), __LINE__);\
+ ECPGset_var( 1, ( mynullvar ), __LINE__);\
+ /* declare mycur cursor for select * from a1 */
+#line 28 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 28 "outofscope.pgc"
+
+#line 28 "outofscope.pgc"
+
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+
+ *myvar0 = myvar;
+ *mynullvar0 = mynullvar;
+}
+
+static void
+open_cur1(void)
+{
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare mycur cursor for select * from a1", ECPGt_EOIT,
+ ECPGt_int,&((*( MYTYPE *)(ECPGget_var( 0)) ).id),(long)1,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).id),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).t),(long)64,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).t),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d1),(long)1,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d1),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d2),(long)1,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d2),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).c),(long)30,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).c),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_EORT);
+#line 40 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 40 "outofscope.pgc"
+
+}
+
+static void
+get_record1(void)
+{
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch mycur", ECPGt_EOIT,
+ ECPGt_int,&((*( MYTYPE *)(ECPGget_var( 0)) ).id),(long)1,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).id),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).t),(long)64,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).t),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d1),(long)1,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d1),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d2),(long)1,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d2),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).c),(long)30,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).c),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_EORT);
+#line 46 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 46 "outofscope.pgc"
+
+}
+
+static void
+close_cur1(void)
+{
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close mycur", ECPGt_EOIT, ECPGt_EORT);
+#line 52 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 52 "outofscope.pgc"
+
+}
+
+int
+main (void)
+{
+ MYTYPE *myvar;
+ MYNULLTYPE *mynullvar;
+ int loopcount;
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 66 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 66 "outofscope.pgc"
+
+
+ strcpy(msg, "set");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+#line 69 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 69 "outofscope.pgc"
+
+
+ strcpy(msg, "create");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table a1 ( id serial primary key , t text , d1 numeric , d2 float8 , c character ( 10 ) )", ECPGt_EOIT, ECPGt_EORT);
+#line 72 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 72 "outofscope.pgc"
+
+
+ strcpy(msg, "insert");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'a' , 1.0 , 2 , 'a' )", ECPGt_EOIT, ECPGt_EORT);
+#line 75 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 75 "outofscope.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , null , null , null , null )", ECPGt_EOIT, ECPGt_EORT);
+#line 76 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 76 "outofscope.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'b' , 2.0 , 3 , 'b' )", ECPGt_EOIT, ECPGt_EORT);
+#line 77 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 77 "outofscope.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 80 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 80 "outofscope.pgc"
+
+
+ /* Test out-of-scope DECLARE/OPEN/FETCH/CLOSE */
+
+ get_var1(&myvar, &mynullvar);
+ open_cur1();
+
+ for (loopcount = 0; loopcount < 100; loopcount++)
+ {
+ memset(myvar, 0, sizeof(MYTYPE));
+ get_record1();
+ if (sqlca.sqlcode == ECPG_NOT_FOUND)
+ break;
+ printf("id=%d%s t='%s'%s d1=%f%s d2=%f%s c = '%s'%s\n",
+ myvar->id, mynullvar->id ? " (NULL)" : "",
+ myvar->t, mynullvar->t ? " (NULL)" : "",
+ myvar->d1, mynullvar->d1 ? " (NULL)" : "",
+ myvar->d2, mynullvar->d2 ? " (NULL)" : "",
+ myvar->c, mynullvar->c ? " (NULL)" : "");
+ }
+
+ close_cur1();
+
+ free(myvar);
+ free(mynullvar);
+
+ strcpy(msg, "drop");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table a1", ECPGt_EOIT, ECPGt_EORT);
+#line 107 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 107 "outofscope.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 110 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 110 "outofscope.pgc"
+
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 113 "outofscope.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 113 "outofscope.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-outofscope.stderr b/src/interfaces/ecpg/test/expected/preproc-outofscope.stderr
new file mode 100644
index 0000000..2c97799
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-outofscope.stderr
@@ -0,0 +1,114 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 69: query: set datestyle to iso; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 69: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 69: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: query: create table a1 ( id serial primary key , t text , d1 numeric , d2 float8 , c character ( 10 ) ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 72: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 75: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'a' , 1.0 , 2 , 'a' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 75: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 75: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 76: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , null , null , null , null ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 76: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 76: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 77: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'b' , 2.0 , 3 , 'b' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 77: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 77: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 80: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: query: declare mycur cursor for select * from a1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 40: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: query: fetch mycur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: 1.0 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: query: fetch mycur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: query: fetch mycur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: 2.0 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: query: fetch mycur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: correctly got 0 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 46: no data found on line 46
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 52: query: close mycur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 52: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 52: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 107: query: drop table a1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 107: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 107: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 110: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/preproc-outofscope.stdout b/src/interfaces/ecpg/test/expected/preproc-outofscope.stdout
new file mode 100644
index 0000000..8c53ad7
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-outofscope.stdout
@@ -0,0 +1,3 @@
+id=1 t='a' d1=1.000000 d2=2.000000 c = 'a '
+id=2 t='' (NULL) d1=0.000000 (NULL) d2=0.000000 (NULL) c = '' (NULL)
+id=3 t='b' d1=2.000000 d2=3.000000 c = 'b '
diff --git a/src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.c b/src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.c
new file mode 100644
index 0000000..7b1f58e
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.c
@@ -0,0 +1,293 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "pointer_to_struct.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "pointer_to_struct.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 6 "pointer_to_struct.pgc"
+
+/* exec sql whenever sql_warning sqlprint ; */
+#line 7 "pointer_to_struct.pgc"
+
+/* exec sql whenever not found sqlprint ; */
+#line 8 "pointer_to_struct.pgc"
+
+
+typedef struct {
+#line 13 "pointer_to_struct.pgc"
+ struct varchar_1 { int len; char arr[ 50 ]; } name ;
+
+#line 14 "pointer_to_struct.pgc"
+ int phone ;
+ } customer ;
+#line 15 "pointer_to_struct.pgc"
+
+
+typedef struct ind {
+#line 20 "pointer_to_struct.pgc"
+ short name_ind ;
+
+#line 21 "pointer_to_struct.pgc"
+ short phone_ind ;
+ } cust_ind ;
+#line 22 "pointer_to_struct.pgc"
+
+
+int main()
+{
+ /* exec sql begin declare section */
+
+
+
+
+
+
+ typedef struct {
+#line 31 "pointer_to_struct.pgc"
+ struct varchar_2 { int len; char arr[ 50 ]; } name ;
+
+#line 32 "pointer_to_struct.pgc"
+ int phone ;
+ } customer2 ;
+
+#line 33 "pointer_to_struct.pgc"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#line 27 "pointer_to_struct.pgc"
+ customer * custs1 = ( customer * ) malloc ( sizeof ( customer ) * 10 ) ;
+
+#line 28 "pointer_to_struct.pgc"
+ cust_ind * inds = ( cust_ind * ) malloc ( sizeof ( cust_ind ) * 10 ) ;
+
+#line 34 "pointer_to_struct.pgc"
+ customer2 * custs2 = ( customer2 * ) malloc ( sizeof ( customer2 ) * 10 ) ;
+
+#line 40 "pointer_to_struct.pgc"
+ struct customer3 {
+#line 38 "pointer_to_struct.pgc"
+ char name [ 50 ] ;
+
+#line 39 "pointer_to_struct.pgc"
+ int phone ;
+ } * custs3 = ( struct customer3 * ) malloc ( sizeof ( struct customer3 ) * 10 ) ;
+
+#line 46 "pointer_to_struct.pgc"
+ struct customer4 {
+#line 44 "pointer_to_struct.pgc"
+ struct varchar_3 { int len; char arr[ 50 ]; } name ;
+
+#line 45 "pointer_to_struct.pgc"
+ int phone ;
+ } * custs4 = ( struct customer4 * ) malloc ( sizeof ( struct customer4 ) ) ;
+
+#line 48 "pointer_to_struct.pgc"
+ int r ;
+
+#line 49 "pointer_to_struct.pgc"
+ struct varchar_4 { int len; char arr[ 50 ]; } onlyname [ 2 ] ;
+/* exec sql end declare section */
+#line 50 "pointer_to_struct.pgc"
+
+
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 54 "pointer_to_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 54 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 54 "pointer_to_struct.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table customers ( c varchar ( 50 ) , p int )", ECPGt_EOIT, ECPGt_EORT);
+#line 56 "pointer_to_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 56 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 56 "pointer_to_struct.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into customers values ( 'John Doe' , '12345' )", ECPGt_EOIT, ECPGt_EORT);
+#line 57 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 57 "pointer_to_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 57 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 57 "pointer_to_struct.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into customers values ( 'Jane Doe' , '67890' )", ECPGt_EOIT, ECPGt_EORT);
+#line 58 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 58 "pointer_to_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 58 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 58 "pointer_to_struct.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 2", ECPGt_EOIT,
+ ECPGt_varchar,&(custs1->name),(long)50,(long)-1,sizeof( customer ),
+ ECPGt_short,&(inds->name_ind),(long)1,(long)-1,sizeof( struct ind ),
+ ECPGt_int,&(custs1->phone),(long)1,(long)-1,sizeof( customer ),
+ ECPGt_short,&(inds->phone_ind),(long)1,(long)-1,sizeof( struct ind ), ECPGt_EORT);
+#line 60 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 60 "pointer_to_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 60 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 60 "pointer_to_struct.pgc"
+
+ printf("custs1:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", custs1[r].name.arr );
+ printf( "phone - %d\n", custs1[r].phone );
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 2", ECPGt_EOIT,
+ ECPGt_varchar,&(custs2->name),(long)50,(long)-1,sizeof( customer2 ),
+ ECPGt_short,&(inds->name_ind),(long)1,(long)-1,sizeof( struct ind ),
+ ECPGt_int,&(custs2->phone),(long)1,(long)-1,sizeof( customer2 ),
+ ECPGt_short,&(inds->phone_ind),(long)1,(long)-1,sizeof( struct ind ), ECPGt_EORT);
+#line 68 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 68 "pointer_to_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 68 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 68 "pointer_to_struct.pgc"
+
+ printf("\ncusts2:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", custs2[r].name.arr );
+ printf( "phone - %d\n", custs2[r].phone );
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 2", ECPGt_EOIT,
+ ECPGt_char,&(custs3->name),(long)50,(long)-1,sizeof( struct customer3 ),
+ ECPGt_short,&(inds->name_ind),(long)1,(long)-1,sizeof( struct ind ),
+ ECPGt_int,&(custs3->phone),(long)1,(long)-1,sizeof( struct customer3 ),
+ ECPGt_short,&(inds->phone_ind),(long)1,(long)-1,sizeof( struct ind ), ECPGt_EORT);
+#line 76 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 76 "pointer_to_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 76 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 76 "pointer_to_struct.pgc"
+
+ printf("\ncusts3:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", custs3[r].name );
+ printf( "phone - %d\n", custs3[r].phone );
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 1", ECPGt_EOIT,
+ ECPGt_varchar,&(custs4->name),(long)50,(long)-1,sizeof( struct customer4 ),
+ ECPGt_short,&(inds->name_ind),(long)1,(long)-1,sizeof( struct ind ),
+ ECPGt_int,&(custs4->phone),(long)1,(long)-1,sizeof( struct customer4 ),
+ ECPGt_short,&(inds->phone_ind),(long)1,(long)-1,sizeof( struct ind ), ECPGt_EORT);
+#line 84 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 84 "pointer_to_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 84 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 84 "pointer_to_struct.pgc"
+
+ printf("\ncusts4:\n");
+ printf( "name - %s\n", custs4->name.arr );
+ printf( "phone - %d\n", custs4->phone );
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select c from customers limit 2", ECPGt_EOIT,
+ ECPGt_varchar,(onlyname),(long)50,(long)2,sizeof(struct varchar_4),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 89 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 89 "pointer_to_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 89 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 89 "pointer_to_struct.pgc"
+
+ printf("\nname:\n");
+ for (r = 0; r < 2; r++)
+ {
+ printf( "name - %s\n", onlyname[r].arr );
+ }
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 96 "pointer_to_struct.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 96 "pointer_to_struct.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 96 "pointer_to_struct.pgc"
+
+
+ /* All the memory will anyway be freed at the end */
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.stderr b/src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.stderr
new file mode 100644
index 0000000..7076408
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.stderr
@@ -0,0 +1,86 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 56: query: create table customers ( c varchar ( 50 ) , p int ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 56: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 56: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 57: query: insert into customers values ( 'John Doe' , '12345' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 57: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 57: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 58: query: insert into customers values ( 'Jane Doe' , '67890' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 58: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 58: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 60: query: select * from customers limit 2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 60: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 60: correctly got 2 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 60: RESULT: John Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 60: RESULT: Jane Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 60: RESULT: 12345 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 60: RESULT: 67890 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 68: query: select * from customers limit 2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 68: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 68: correctly got 2 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 68: RESULT: John Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 68: RESULT: Jane Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 68: RESULT: 12345 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 68: RESULT: 67890 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 76: query: select * from customers limit 2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 76: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 76: correctly got 2 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: John Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: Jane Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: 12345 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 76: RESULT: 67890 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 84: query: select * from customers limit 1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 84: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 84: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 84: RESULT: John Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 84: RESULT: 12345 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 89: query: select c from customers limit 2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 89: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 89: correctly got 2 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 89: RESULT: John Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 89: RESULT: Jane Doe offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.stdout b/src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.stdout
new file mode 100644
index 0000000..23f41ff
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.stdout
@@ -0,0 +1,25 @@
+custs1:
+name - John Doe
+phone - 12345
+name - Jane Doe
+phone - 67890
+
+custs2:
+name - John Doe
+phone - 12345
+name - Jane Doe
+phone - 67890
+
+custs3:
+name - John Doe
+phone - 12345
+name - Jane Doe
+phone - 67890
+
+custs4:
+name - John Doe
+phone - 12345
+
+name:
+name - John Doe
+name - Jane Doe
diff --git a/src/interfaces/ecpg/test/expected/preproc-strings.c b/src/interfaces/ecpg/test/expected/preproc-strings.c
new file mode 100644
index 0000000..a268179
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-strings.c
@@ -0,0 +1,82 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "strings.pgc"
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 3 "strings.pgc"
+/* exec sql begin declare section */
+#line 1 "strings.h"
+
+
+
+
+
+
+
+
+
+#line 5 "strings.pgc"
+
+#line 1 "strings.h"
+ char * s1 , * s2 , * s3 , * s4 , * s5 , * s6 , * s7 , * s8 ;
+/* exec sql end declare section */
+#line 5 "strings.pgc"
+
+
+int main(void)
+{
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 11 "strings.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set standard_conforming_strings to on", ECPGt_EOIT, ECPGt_EORT);}
+#line 13 "strings.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select 'abc''d\\ef' , N'abc''d\\ef' as foo , E'abc''d\\\\ef' as \"foo\"\"bar\" , U&'d\\0061t\\0061' as U&\"foo\"\"bar\" , U&'d!+000061t!+000061' UESCAPE '!' , $foo$abc$def$foo$", ECPGt_EOIT,
+ ECPGt_char,&(s1),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(s2),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(s3),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(s4),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(s5),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(s6),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 21 "strings.pgc"
+
+
+ printf("%s %s %s %s %s %s\n", s1, s2, s3, s4, s5, s6);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select b'0010' , x'019ABcd'", ECPGt_EOIT,
+ ECPGt_char,&(s7),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(s8),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 26 "strings.pgc"
+
+
+ printf("%s %s\n", s7, s8);
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 30 "strings.pgc"
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-strings.stderr b/src/interfaces/ecpg/test/expected/preproc-strings.stderr
new file mode 100644
index 0000000..8364d6b
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-strings.stderr
@@ -0,0 +1,56 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 13: query: set standard_conforming_strings to on; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 13: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 13: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 15: query: select 'abc''d\ef' , N'abc''d\ef' as foo , E'abc''d\\ef' as "foo""bar" , U&'d\0061t\0061' as U&"foo""bar" , U&'d!+000061t!+000061' UESCAPE '!' , $foo$abc$def$foo$; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 15: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 15: correctly got 1 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 15: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 15: RESULT: abc'd\ef offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 15: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 15: RESULT: abc'd\ef offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 15: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 15: RESULT: abc'd\ef offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 15: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 15: RESULT: data offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 15: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 15: RESULT: data offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 15: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 15: RESULT: abc$def offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: query: select b'0010' , x'019ABcd'; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 25: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 25: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 25: RESULT: 0010 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 25: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 25: RESULT: 0000000110011010101111001101 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/preproc-strings.stdout b/src/interfaces/ecpg/test/expected/preproc-strings.stdout
new file mode 100644
index 0000000..5abbe69
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-strings.stdout
@@ -0,0 +1,2 @@
+abc'd\ef abc'd\ef abc'd\ef data data abc$def
+0010 0000000110011010101111001101
diff --git a/src/interfaces/ecpg/test/expected/preproc-type.c b/src/interfaces/ecpg/test/expected/preproc-type.c
new file mode 100644
index 0000000..1968a87
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-type.c
@@ -0,0 +1,170 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "type.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "type.pgc"
+
+
+typedef long mmInteger ;
+
+#line 6 "type.pgc"
+
+#line 6 "type.pgc"
+
+typedef char mmChar ;
+
+#line 7 "type.pgc"
+
+#line 7 "type.pgc"
+
+typedef short mmSmallInt ;
+
+#line 8 "type.pgc"
+
+#line 8 "type.pgc"
+
+
+/* exec sql type string is char [ 11 ] */
+#line 10 "type.pgc"
+
+typedef char string[11];
+
+/* exec sql type c is char reference */
+#line 13 "type.pgc"
+
+typedef char* c;
+
+/* exec sql begin declare section */
+
+
+
+
+
+
+struct TBempl {
+#line 19 "type.pgc"
+ mmInteger idnum ;
+
+#line 20 "type.pgc"
+ mmChar name [ 21 ] ;
+
+#line 21 "type.pgc"
+ mmSmallInt accs ;
+ } ;/* exec sql end declare section */
+#line 23 "type.pgc"
+
+
+int
+main (void)
+{
+ /* exec sql begin declare section */
+
+
+
+
+
+
+
+
+
+#line 29 "type.pgc"
+ struct TBempl empl ;
+
+#line 30 "type.pgc"
+ string str ;
+
+#line 31 "type.pgc"
+ c ptr = NULL ;
+
+#line 36 "type.pgc"
+ struct varchar {
+#line 34 "type.pgc"
+ int len ;
+
+#line 35 "type.pgc"
+ char text [ 10 ] ;
+ } vc ;
+/* exec sql end declare section */
+#line 37 "type.pgc"
+
+
+ /* exec sql var vc is [ 10 ] */
+#line 39 "type.pgc"
+
+ ECPGdebug (1, stderr);
+
+ empl.idnum = 1;
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 43 "type.pgc"
+
+ if (sqlca.sqlcode)
+ {
+ printf ("connect error = %ld\n", sqlca.sqlcode);
+ exit (sqlca.sqlcode);
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , string1 char ( 10 ) , string2 char ( 10 ) , string3 char ( 10 ) )", ECPGt_EOIT, ECPGt_EORT);}
+#line 51 "type.pgc"
+
+ if (sqlca.sqlcode)
+ {
+ printf ("create error = %ld\n", sqlca.sqlcode);
+ exit (sqlca.sqlcode);
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into empl values ( 1 , 'user name' , 320 , 'first str' , 'second str' , 'third str' )", ECPGt_EOIT, ECPGt_EORT);}
+#line 58 "type.pgc"
+
+ if (sqlca.sqlcode)
+ {
+ printf ("insert error = %ld\n", sqlca.sqlcode);
+ exit (sqlca.sqlcode);
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select idnum , name , accs , string1 , string2 , string3 from empl where idnum = $1 ",
+ ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof( struct TBempl ),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(empl.name),(long)21,(long)1,sizeof( struct TBempl ),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_short,&(empl.accs),(long)1,(long)1,sizeof( struct TBempl ),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(str),(long)11,(long)1,(11)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(ptr),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_varchar,&(vc),(long)10,(long)1,sizeof(struct varchar),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 68 "type.pgc"
+
+ if (sqlca.sqlcode)
+ {
+ printf ("select error = %ld\n", sqlca.sqlcode);
+ exit (sqlca.sqlcode);
+ }
+ 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);
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 76 "type.pgc"
+
+
+ free(ptr);
+ exit (0);
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-type.stderr b/src/interfaces/ecpg/test/expected/preproc-type.stderr
new file mode 100644
index 0000000..678ecef
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-type.stderr
@@ -0,0 +1,40 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: query: create table empl ( idnum integer , name char ( 20 ) , accs smallint , string1 char ( 10 ) , string2 char ( 10 ) , string3 char ( 10 ) ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 50: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 58: query: insert into empl values ( 1 , 'user name' , 320 , 'first str' , 'second str' , 'third str' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 58: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 58: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 65: query: select idnum , name , accs , string1 , string2 , string3 from empl where idnum = $1 ; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 65: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 65: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 65: correctly got 1 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 65: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 65: RESULT: user name offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 65: RESULT: 320 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 65: RESULT: first str offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 65: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 65: RESULT: second str offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 65: RESULT: third str offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/preproc-type.stdout b/src/interfaces/ecpg/test/expected/preproc-type.stdout
new file mode 100644
index 0000000..ee220d4
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-type.stdout
@@ -0,0 +1 @@
+id=1 name='user name ' accs=320 str='first str ' ptr='second str' vc='third str '
diff --git a/src/interfaces/ecpg/test/expected/preproc-variable.c b/src/interfaces/ecpg/test/expected/preproc-variable.c
new file mode 100644
index 0000000..3954f83
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-variable.c
@@ -0,0 +1,276 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "variable.pgc"
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "variable.pgc"
+
+
+/* exec sql whenever sqlerror stop ; */
+#line 6 "variable.pgc"
+
+
+/* exec sql type c is char reference */
+#line 8 "variable.pgc"
+
+typedef char* c;
+
+/* exec sql type ind is union {
+#line 11 "variable.pgc"
+ int integer ;
+
+#line 11 "variable.pgc"
+ short smallint ;
+ } */
+#line 11 "variable.pgc"
+
+typedef union { int integer; short smallint; } ind;
+
+#define BUFFERSIZ 8
+/* exec sql type str is [ BUFFERSIZ ] */
+#line 15 "variable.pgc"
+
+
+/* declare cur cursor for select name , born , age , married , children from family */
+#line 18 "variable.pgc"
+
+
+int
+main (void)
+{
+ struct birthinfo {
+#line 23 "variable.pgc"
+ long born ;
+
+#line 23 "variable.pgc"
+ short age ;
+ } ;
+#line 23 "variable.pgc"
+
+/* exec sql begin declare section */
+
+
+
+
+
+
+
+
+
+#line 27 "variable.pgc"
+ struct personal_struct {
+#line 25 "variable.pgc"
+ struct varchar_1 { int len; char arr[ BUFFERSIZ ]; } name ;
+
+#line 26 "variable.pgc"
+ struct birthinfo birth ;
+ } personal , * p ;
+
+#line 30 "variable.pgc"
+ struct personal_indicator {
+#line 28 "variable.pgc"
+ int ind_name ;
+
+#line 29 "variable.pgc"
+ struct birthinfo ind_birth ;
+ } ind_personal , * i ;
+
+#line 31 "variable.pgc"
+ ind ind_children ;
+ struct t1 {
+#line 32 "variable.pgc"
+ struct varchar_2 { int len; char arr[ BUFFERSIZ ]; } name ;
+ } ; struct t2 {
+#line 32 "variable.pgc"
+ struct varchar_3 { int len; char arr[ BUFFERSIZ ]; } name ;
+ } ;/* exec sql end declare section */
+#line 33 "variable.pgc"
+
+
+
+#line 35 "variable.pgc"
+ char * married = NULL ;
+
+#line 35 "variable.pgc"
+
+
+#line 36 "variable.pgc"
+ long ind_married ;
+
+#line 36 "variable.pgc"
+
+
+#line 37 "variable.pgc"
+ ind children ;
+
+#line 37 "variable.pgc"
+
+ int loopcount;
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 44 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 44 "variable.pgc"
+
+
+ strcpy(msg, "set");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+#line 47 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 47 "variable.pgc"
+
+
+ strcpy(msg, "create");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer )", ECPGt_EOIT, ECPGt_EORT);
+#line 50 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 50 "variable.pgc"
+
+
+ strcpy(msg, "insert");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 )", ECPGt_EOIT, ECPGt_EORT);
+#line 53 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 53 "variable.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 )", ECPGt_EOIT, ECPGt_EORT);
+#line 54 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 54 "variable.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 1' , 16 )", ECPGt_EOIT, ECPGt_EORT);
+#line 55 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 55 "variable.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 2' , 14 )", ECPGt_EOIT, ECPGt_EORT);
+#line 56 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 56 "variable.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 3' , 9 )", ECPGt_EOIT, ECPGt_EORT);
+#line 57 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 57 "variable.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 60 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 60 "variable.pgc"
+
+
+ strcpy(msg, "open");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur cursor for select name , born , age , married , children from family", ECPGt_EOIT, ECPGt_EORT);
+#line 63 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 63 "variable.pgc"
+
+
+ /* exec sql whenever not found break ; */
+#line 65 "variable.pgc"
+
+
+ p=&personal;
+ i=&ind_personal;
+ memset(i, 0, sizeof(ind_personal));
+ for (loopcount = 0; loopcount < 100; loopcount++) {
+ strcpy(msg, "fetch");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur", ECPGt_EOIT,
+ ECPGt_varchar,&(p->name),(long)BUFFERSIZ,(long)-1,sizeof( struct birthinfo ),
+ ECPGt_int,&(i->ind_name),(long)1,(long)-1,sizeof( struct birthinfo ),
+ ECPGt_long,&(p->birth.born),(long)1,(long)1,sizeof( struct birthinfo ),
+ ECPGt_long,&(i->ind_birth.born),(long)1,(long)1,sizeof( struct birthinfo ),
+ ECPGt_short,&(p->birth.age),(long)1,(long)1,sizeof( struct birthinfo ),
+ ECPGt_short,&(i->ind_birth.age),(long)1,(long)1,sizeof( struct birthinfo ),
+ 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 72 "variable.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+#line 72 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 72 "variable.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, 0, ECPGst_normal, "close cur", ECPGt_EOIT, ECPGt_EORT);
+#line 89 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 89 "variable.pgc"
+
+
+ strcpy(msg, "drop");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table family", ECPGt_EOIT, ECPGt_EORT);
+#line 92 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 92 "variable.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 95 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 95 "variable.pgc"
+
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 98 "variable.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 98 "variable.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-variable.stderr b/src/interfaces/ecpg/test/expected/preproc-variable.stderr
new file mode 100644
index 0000000..08cdcc6
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-variable.stderr
@@ -0,0 +1,168 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 47: query: set datestyle to iso; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 47: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 47: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: query: create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 50: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 50: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: query: insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 53: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 54: query: insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 54: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 54: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: insert into family ( name , age ) values ( 'Child 1' , 16 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 56: query: insert into family ( name , age ) values ( 'Child 2' , 14 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 56: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 56: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 57: query: insert into family ( name , age ) values ( 'Child 3' , 9 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 57: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 57: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 60: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 63: query: declare cur cursor for select name , born , age , married , children from family; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 63: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 63: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: query: fetch cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 72: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: Mum offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 72: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: 1987-07-14 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: query: fetch cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 72: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: Dad offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: 19610721 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 72: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: 1987-07-14 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: query: fetch cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 72: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: Child 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: 16 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 72: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: query: fetch cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 72: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: Child 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: 14 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 72: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: query: fetch cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 72: correctly got 1 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: Child 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: 9 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 72: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: query: fetch cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 72: correctly got 0 tuples with 5 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 72: no data found on line 72
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 89: query: close cur; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 89: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 89: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 92: query: drop table family; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 92: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 92: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 95: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/preproc-variable.stdout b/src/interfaces/ecpg/test/expected/preproc-variable.stdout
new file mode 100644
index 0000000..f4ee9c3
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-variable.stdout
@@ -0,0 +1,5 @@
+Mum , married 1987-07-14, children = 3
+Dad , born 19610721, married 1987-07-14, children = 3
+Child 1 , age = 16
+Child 2 , age = 14
+Child 3 , age = 9
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 0000000..861d84f
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-whenever.c
@@ -0,0 +1,246 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#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(const 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, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 31 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 31 "whenever.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "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, 0, ECPGst_normal, "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, 0, ECPGst_normal, "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, 0, ECPGst_normal, "select * from nonexistent", 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, 0, ECPGst_normal, "select * from nonexistent", 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, 0, ECPGst_normal, "select * from nonexistent", 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, 0, ECPGst_normal, "select * from nonexistent", 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, 0, ECPGst_normal, "select * from nonexistent", 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"
+
+ /* This cannot fail, thus we don't get an exit value not equal 0. */
+ /* However, it still test the precompiler output. */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select 1", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 64 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 64 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 64 "whenever.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 65 "whenever.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') warn ( );
+#line 65 "whenever.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 65 "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 0000000..03e94a6
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-whenever.stderr
@@ -0,0 +1,104 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: create table test ( i int , c char ( 10 ) ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: query: insert into test values ( 1 , 'abcdefghij' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 33: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: select * from test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 36: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 36: RESULT: abcdefghij offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+Warning: At least one column was truncated
+[NO_PID]: ECPGtrans on line 37: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: query: select * from nonexistent; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_check_PQresult on line 39: bad response - ERROR: relation "nonexistent" does not exist
+LINE 1: select * from nonexistent
+ ^
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlstate 42P01 (sqlcode -400): relation "nonexistent" does not exist on line 39
+[NO_PID]: sqlca: code: -400, state: 42P01
+SQL error: relation "nonexistent" does not exist on line 39
+[NO_PID]: ECPGtrans on line 40: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 43: query: select * from nonexistent; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 43: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_check_PQresult on line 43: bad response - ERROR: relation "nonexistent" does not exist
+LINE 1: select * from nonexistent
+ ^
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlstate 42P01 (sqlcode -400): relation "nonexistent" does not exist on line 43
+[NO_PID]: sqlca: code: -400, state: 42P01
+Error in statement 'select':
+SQL error: relation "nonexistent" does not exist on line 43
+[NO_PID]: ECPGtrans on line 44: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 47: query: select * from nonexistent; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 47: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_check_PQresult on line 47: bad response - ERROR: relation "nonexistent" does not exist
+LINE 1: select * from nonexistent
+ ^
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlstate 42P01 (sqlcode -400): relation "nonexistent" does not exist on line 47
+[NO_PID]: sqlca: code: -400, state: 42P01
+Found another error
+SQL error: relation "nonexistent" does not exist on line 47
+[NO_PID]: ECPGtrans on line 48: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: query: select * from nonexistent; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_check_PQresult on line 51: bad response - ERROR: relation "nonexistent" does not exist
+LINE 1: select * from nonexistent
+ ^
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlstate 42P01 (sqlcode -400): relation "nonexistent" does not exist on line 51
+[NO_PID]: sqlca: code: -400, state: 42P01
+[NO_PID]: ECPGtrans on line 52: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: select * from nonexistent; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_check_PQresult on line 55: bad response - ERROR: relation "nonexistent" does not exist
+LINE 1: select * from nonexistent
+ ^
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlstate 42P01 (sqlcode -400): relation "nonexistent" does not exist on line 55
+[NO_PID]: sqlca: code: -400, state: 42P01
+[NO_PID]: ECPGtrans on line 59: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 64: query: select 1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 64: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 64: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 64: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 65: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
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 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-whenever.stdout
diff --git a/src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.c b/src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.c
new file mode 100644
index 0000000..56354ba
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.c
@@ -0,0 +1,164 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "whenever_do_continue.pgc"
+#include <stdlib.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 3 "whenever_do_continue.pgc"
+
+
+/* exec sql whenever sqlerror stop ; */
+#line 5 "whenever_do_continue.pgc"
+
+
+int main(void)
+{
+ /* exec sql begin declare section */
+
+
+
+
+
+
+
+
+
+#line 15 "whenever_do_continue.pgc"
+ struct {
+#line 12 "whenever_do_continue.pgc"
+ char ename [ 12 ] ;
+
+#line 13 "whenever_do_continue.pgc"
+ float sal ;
+
+#line 14 "whenever_do_continue.pgc"
+ float comm ;
+ } emp ;
+
+#line 16 "whenever_do_continue.pgc"
+ int loopcount ;
+
+#line 17 "whenever_do_continue.pgc"
+ char msg [ 128 ] ;
+/* exec sql end declare section */
+#line 18 "whenever_do_continue.pgc"
+
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 23 "whenever_do_continue.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 23 "whenever_do_continue.pgc"
+
+
+ strcpy(msg, "create");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table emp ( ename varchar , sal double precision , comm double precision )", ECPGt_EOIT, ECPGt_EORT);
+#line 26 "whenever_do_continue.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 26 "whenever_do_continue.pgc"
+
+
+ strcpy(msg, "insert");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into emp values ( 'Ram' , 111100 , 21 )", ECPGt_EOIT, ECPGt_EORT);
+#line 29 "whenever_do_continue.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 29 "whenever_do_continue.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into emp values ( 'aryan' , 11110 , null )", ECPGt_EOIT, ECPGt_EORT);
+#line 30 "whenever_do_continue.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 30 "whenever_do_continue.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into emp values ( 'josh' , 10000 , 10 )", ECPGt_EOIT, ECPGt_EORT);
+#line 31 "whenever_do_continue.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 31 "whenever_do_continue.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into emp values ( 'tom' , 20000 , null )", ECPGt_EOIT, ECPGt_EORT);
+#line 32 "whenever_do_continue.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 32 "whenever_do_continue.pgc"
+
+
+ /* declare c cursor for select ename , sal , comm from emp order by ename collate \"C\" asc */
+#line 34 "whenever_do_continue.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare c cursor for select ename , sal , comm from emp order by ename collate \"C\" asc", ECPGt_EOIT, ECPGt_EORT);
+#line 36 "whenever_do_continue.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 36 "whenever_do_continue.pgc"
+
+
+ /* The 'BREAK' condition to exit the loop. */
+ /* exec sql whenever not found break ; */
+#line 39 "whenever_do_continue.pgc"
+
+
+ /* The DO CONTINUE makes the loop start at the next iteration when an error occurs.*/
+ /* exec sql whenever sqlerror continue ; */
+#line 42 "whenever_do_continue.pgc"
+
+
+ for (loopcount = 0; loopcount < 100; loopcount++)
+ {
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch c", ECPGt_EOIT,
+ ECPGt_char,&(emp.ename),(long)12,(long)1,(12)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_float,&(emp.sal),(long)1,(long)1,sizeof(float),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_float,&(emp.comm),(long)1,(long)1,sizeof(float),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 46 "whenever_do_continue.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+#line 46 "whenever_do_continue.pgc"
+
+if (sqlca.sqlcode < 0) continue;}
+#line 46 "whenever_do_continue.pgc"
+
+ /* The employees with non-NULL commissions will be displayed. */
+ printf("%s %7.2f %9.2f\n", emp.ename, emp.sal, emp.comm);
+ }
+
+ /*
+ * This 'CONTINUE' shuts off the 'DO CONTINUE' and allow the program to
+ * proceed if any further errors do occur.
+ */
+ /* exec sql whenever sqlerror continue ; */
+#line 55 "whenever_do_continue.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close c", ECPGt_EOIT, ECPGt_EORT);}
+#line 57 "whenever_do_continue.pgc"
+
+
+ strcpy(msg, "drop");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table emp", ECPGt_EOIT, ECPGt_EORT);}
+#line 60 "whenever_do_continue.pgc"
+
+
+ exit(0);
+}
diff --git a/src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.stderr b/src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.stderr
new file mode 100644
index 0000000..46bc4a5
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.stderr
@@ -0,0 +1,112 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: create table emp ( ename varchar , sal double precision , comm double precision ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: query: insert into emp values ( 'Ram' , 111100 , 21 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 29: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: query: insert into emp values ( 'aryan' , 11110 , null ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 30: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: query: insert into emp values ( 'josh' , 10000 , 10 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 31: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: insert into emp values ( 'tom' , 20000 , null ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: declare c cursor for select ename , sal , comm from emp order by ename collate "C" asc; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: query: fetch c; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: Ram offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: 111100 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: 21 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: query: fetch c; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: aryan offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: 11110 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -213 on line 46: null value without indicator on line 46
+[NO_PID]: sqlca: code: -213, state: 22002
+[NO_PID]: ecpg_execute on line 46: query: fetch c; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: josh offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: 10000 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: 10 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: query: fetch c; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: tom offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: 20000 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -213 on line 46: null value without indicator on line 46
+[NO_PID]: sqlca: code: -213, state: 22002
+[NO_PID]: ecpg_execute on line 46: query: fetch c; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: correctly got 0 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 46: no data found on line 46
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 57: query: close c; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 57: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 57: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 60: query: drop table emp; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 60: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 60: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.stdout b/src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.stdout
new file mode 100644
index 0000000..d6ac5a0
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.stdout
@@ -0,0 +1,2 @@
+Ram 111100.00 21.00
+josh 10000.00 10.00
diff --git a/src/interfaces/ecpg/test/expected/sql-array.c b/src/interfaces/ecpg/test/expected/sql-array.c
new file mode 100644
index 0000000..e48f5fa
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-array.c
@@ -0,0 +1,355 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "array.pgc"
+#include <locale.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <pgtypes_date.h>
+#include <pgtypes_interval.h>
+#include <pgtypes_numeric.h>
+#include <pgtypes_timestamp.h>
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 10 "array.pgc"
+
+
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 12 "array.pgc"
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 13 "array.pgc"
+
+
+int
+main (void)
+{
+/* exec sql begin declare section */
+
+
+
+
+
+
+
+
+
+
+
+#line 19 "array.pgc"
+ int i = 1 , j ;
+
+#line 20 "array.pgc"
+ int * did = & i ;
+
+#line 21 "array.pgc"
+ short a [ 10 ] = { 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0 } ;
+
+#line 22 "array.pgc"
+ timestamp ts [ 10 ] ;
+
+#line 23 "array.pgc"
+ date d [ 10 ] ;
+
+#line 24 "array.pgc"
+ interval in [ 10 ] ;
+
+#line 25 "array.pgc"
+ numeric n [ 10 ] ;
+
+#line 26 "array.pgc"
+ char text [ 25 ] = "klmnopqrst" ;
+
+#line 27 "array.pgc"
+ char * t = ( char * ) malloc ( 11 ) ;
+
+#line 28 "array.pgc"
+ double f ;
+/* exec sql end declare section */
+#line 29 "array.pgc"
+
+
+ strcpy(t, "0123456789");
+ setlocale(LC_ALL, "C");
+
+ ECPGdebug(1, stderr);
+
+ for (j = 0; j < 10; j++) {
+ char str[28];
+ numeric *value;
+ interval *inter;
+
+ sprintf(str, "2000-1-1 0%d:00:00", j);
+ ts[j] = PGTYPEStimestamp_from_asc(str, NULL);
+ sprintf(str, "2000-1-1%d\n", j);
+ d[j] = PGTYPESdate_from_asc(str, NULL);
+ sprintf(str, "%d hours", j+10);
+ inter = PGTYPESinterval_from_asc(str, NULL);
+ in[j] = *inter;
+ value = PGTYPESnumeric_new();
+ PGTYPESnumeric_from_int(j, value);
+ n[j] = *value;
+ }
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 53 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 53 "array.pgc"
+
+
+ { ECPGsetcommit(__LINE__, "on", NULL);
+#line 55 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 55 "array.pgc"
+
+
+ { ECPGtrans(__LINE__, NULL, "begin work");
+#line 57 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 57 "array.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( f float , i int , a int [ 10 ] , text char ( 10 ) , ts timestamp [ 10 ] , n numeric [ 10 ] , d date [ 10 ] , inter interval [ 10 ] )", ECPGt_EOIT, ECPGt_EORT);
+#line 59 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 59 "array.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test ( f , i , a , text , ts , n , d , inter ) values ( 404.90 , 3 , '{0,1,2,3,4,5,6,7,8,9}' , 'abcdefghij' , $1 , $2 , $3 , $4 )",
+ ECPGt_timestamp,&(ts),(long)1,(long)10,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_numeric,&(n),(long)1,(long)10,sizeof(numeric),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_date,&(d),(long)1,(long)10,sizeof(date),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_interval,&(in),(long)1,(long)10,sizeof(interval),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 61 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 61 "array.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test ( f , i , a , text , ts , n , d , inter ) values ( 140787.0 , 2 , $1 , $2 , $3 , $4 , $5 , $6 )",
+ ECPGt_short,(a),(long)1,(long)10,sizeof(short),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(text),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_timestamp,&(ts),(long)1,(long)10,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_numeric,&(n),(long)1,(long)10,sizeof(numeric),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_date,&(d),(long)1,(long)10,sizeof(date),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_interval,&(in),(long)1,(long)10,sizeof(interval),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 63 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 63 "array.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test ( f , i , a , text , ts , n , d , inter ) values ( 14.07 , $1 , $2 , $3 , $4 , $5 , $6 , $7 )",
+ ECPGt_int,&(did),(long)1,(long)0,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_short,(a),(long)1,(long)10,sizeof(short),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(t),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_timestamp,&(ts),(long)1,(long)10,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_numeric,&(n),(long)1,(long)10,sizeof(numeric),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_date,&(d),(long)1,(long)10,sizeof(date),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_interval,&(in),(long)1,(long)10,sizeof(interval),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 65 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 65 "array.pgc"
+
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 67 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 67 "array.pgc"
+
+
+ for (j = 0; j < 10; j++) {
+ ts[j] = PGTYPEStimestamp_from_asc("1900-01-01 00:00:00", NULL);
+ d[j] = PGTYPESdate_from_asc("1900-01-01", NULL);
+ in[j] = *PGTYPESinterval_new();
+ n[j] = *PGTYPESnumeric_new();
+ }
+ { ECPGtrans(__LINE__, NULL, "begin work");
+#line 75 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 75 "array.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select f , text from test where i = 1", ECPGt_EOIT,
+ ECPGt_double,&(f),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(text),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 80 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 80 "array.pgc"
+
+
+ printf("Found f=%f text=%10.10s\n", f, text);
+
+ f=140787;
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select a , text , ts , n , d , inter from test where f = $1 ",
+ ECPGt_double,&(f),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_short,(a),(long)1,(long)10,sizeof(short),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,&(t),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_timestamp,&(ts),(long)1,(long)10,sizeof(timestamp),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_numeric,&(n),(long)1,(long)10,sizeof(numeric),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_date,&(d),(long)1,(long)10,sizeof(date),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_interval,&(in),(long)1,(long)10,sizeof(interval),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 88 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 88 "array.pgc"
+
+
+ for (i = 0; i < 10; i++)
+ printf("Found a[%d] = %d ts[%d] = %s n[%d] = %s d[%d] = %s in[%d] = %s\n", i, a[i], i, PGTYPEStimestamp_to_asc(ts[i]), i, PGTYPESnumeric_to_asc(&(n[i]), -1), i, PGTYPESdate_to_asc(d[i]), i, PGTYPESinterval_to_asc(&(in[i])));
+
+ printf("Found text=%10.10s\n", t);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select a from test where f = $1 ",
+ ECPGt_double,&(f),(long)1,(long)1,sizeof(double),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_char,(text),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 98 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 98 "array.pgc"
+
+
+ printf("Found text=%s\n", text);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
+#line 102 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 102 "array.pgc"
+
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 104 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 104 "array.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 106 "array.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 106 "array.pgc"
+
+
+ free(t);
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-array.stderr b/src/interfaces/ecpg/test/expected/sql-array.stderr
new file mode 100644
index 0000000..be67d47
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-array.stderr
@@ -0,0 +1,130 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGsetcommit on line 55: action "on"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 57: action "begin work"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 59: query: create table test ( f float , i int , a int [ 10 ] , text char ( 10 ) , ts timestamp [ 10 ] , n numeric [ 10 ] , d date [ 10 ] , inter interval [ 10 ] ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 59: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 59: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 61: query: insert into test ( f , i , a , text , ts , n , d , inter ) values ( 404.90 , 3 , '{0,1,2,3,4,5,6,7,8,9}' , 'abcdefghij' , $1 , $2 , $3 , $4 ); with 4 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 61: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 61: parameter 1 = {2000-01-01 00:00:00,2000-01-01 01:00:00,2000-01-01 02:00:00,2000-01-01 03:00:00,2000-01-01 04:00:00,2000-01-01 05:00:00,2000-01-01 06:00:00,2000-01-01 07:00:00,2000-01-01 08:00:00,2000-01-01 09:00:00}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 61: parameter 2 = {0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 61: parameter 3 = {2000-01-10,2000-01-11,2000-01-12,2000-01-13,2000-01-14,2000-01-15,2000-01-16,2000-01-17,2000-01-18,2000-01-19}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 61: parameter 4 = {@ 10 hours,@ 11 hours,@ 12 hours,@ 13 hours,@ 14 hours,@ 15 hours,@ 16 hours,@ 17 hours,@ 18 hours,@ 19 hours}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 61: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 63: query: insert into test ( f , i , a , text , ts , n , d , inter ) values ( 140787.0 , 2 , $1 , $2 , $3 , $4 , $5 , $6 ); with 6 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 63: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 63: parameter 1 = {9,8,7,6,5,4,3,2,1,0}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 63: parameter 2 = klmnopqrst
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 63: parameter 3 = {2000-01-01 00:00:00,2000-01-01 01:00:00,2000-01-01 02:00:00,2000-01-01 03:00:00,2000-01-01 04:00:00,2000-01-01 05:00:00,2000-01-01 06:00:00,2000-01-01 07:00:00,2000-01-01 08:00:00,2000-01-01 09:00:00}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 63: parameter 4 = {0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 63: parameter 5 = {2000-01-10,2000-01-11,2000-01-12,2000-01-13,2000-01-14,2000-01-15,2000-01-16,2000-01-17,2000-01-18,2000-01-19}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 63: parameter 6 = {@ 10 hours,@ 11 hours,@ 12 hours,@ 13 hours,@ 14 hours,@ 15 hours,@ 16 hours,@ 17 hours,@ 18 hours,@ 19 hours}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 63: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 65: query: insert into test ( f , i , a , text , ts , n , d , inter ) values ( 14.07 , $1 , $2 , $3 , $4 , $5 , $6 , $7 ); with 7 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 65: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 65: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 65: parameter 2 = {9,8,7,6,5,4,3,2,1,0}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 65: parameter 3 = 0123456789
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 65: parameter 4 = {2000-01-01 00:00:00,2000-01-01 01:00:00,2000-01-01 02:00:00,2000-01-01 03:00:00,2000-01-01 04:00:00,2000-01-01 05:00:00,2000-01-01 06:00:00,2000-01-01 07:00:00,2000-01-01 08:00:00,2000-01-01 09:00:00}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 65: parameter 5 = {0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 65: parameter 6 = {2000-01-10,2000-01-11,2000-01-12,2000-01-13,2000-01-14,2000-01-15,2000-01-16,2000-01-17,2000-01-18,2000-01-19}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 65: parameter 7 = {@ 10 hours,@ 11 hours,@ 12 hours,@ 13 hours,@ 14 hours,@ 15 hours,@ 16 hours,@ 17 hours,@ 18 hours,@ 19 hours}
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 65: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 67: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 75: action "begin work"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 77: query: select f , text from test where i = 1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 77: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 77: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 77: RESULT: 14.07 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 77: RESULT: 0123456789 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 85: query: select a , text , ts , n , d , inter from test where f = $1 ; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 85: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 85: parameter 1 = 140787
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 85: correctly got 1 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_is_type_an_array on line 85: type (1007); C (3); array (yes)
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 85: RESULT: {9,8,7,6,5,4,3,2,1,0} offset: -1; array: yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 85: RESULT: klmnopqrst offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_is_type_an_array on line 85: type (1115); C (19); array (yes)
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 85: RESULT: {"Sat Jan 01 00:00:00 2000","Sat Jan 01 01:00:00 2000","Sat Jan 01 02:00:00 2000","Sat Jan 01 03:00:00 2000","Sat Jan 01 04:00:00 2000","Sat Jan 01 05:00:00 2000","Sat Jan 01 06:00:00 2000","Sat Jan 01 07:00:00 2000","Sat Jan 01 08:00:00 2000","Sat Jan 01 09:00:00 2000"} offset: -1; array: yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_is_type_an_array on line 85: type (1231); C (16); array (yes)
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 85: RESULT: {0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0} offset: -1; array: yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_is_type_an_array on line 85: type (1182); C (18); array (yes)
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 85: RESULT: {01-10-2000,01-11-2000,01-12-2000,01-13-2000,01-14-2000,01-15-2000,01-16-2000,01-17-2000,01-18-2000,01-19-2000} offset: -1; array: yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_is_type_an_array on line 85: type (1187); C (20); array (yes)
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 85: RESULT: {"@ 10 hours","@ 11 hours","@ 12 hours","@ 13 hours","@ 14 hours","@ 15 hours","@ 16 hours","@ 17 hours","@ 18 hours","@ 19 hours"} offset: -1; array: yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 95: query: select a from test where f = $1 ; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 95: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 95: parameter 1 = 140787
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 95: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 95: RESULT: {9,8,7,6,5,4,3,2,1,0} offset: -1; array: yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 102: query: drop table test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 102: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 102: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 104: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-array.stdout b/src/interfaces/ecpg/test/expected/sql-array.stdout
new file mode 100644
index 0000000..e2a91b9
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-array.stdout
@@ -0,0 +1,13 @@
+Found f=14.070000 text=0123456789
+Found a[0] = 9 ts[0] = 2000-01-01 00:00:00 n[0] = 0.0 d[0] = 2000-01-10 in[0] = @ 10 hours
+Found a[1] = 8 ts[1] = 2000-01-01 01:00:00 n[1] = 1.0 d[1] = 2000-01-11 in[1] = @ 11 hours
+Found a[2] = 7 ts[2] = 2000-01-01 02:00:00 n[2] = 2.0 d[2] = 2000-01-12 in[2] = @ 12 hours
+Found a[3] = 6 ts[3] = 2000-01-01 03:00:00 n[3] = 3.0 d[3] = 2000-01-13 in[3] = @ 13 hours
+Found a[4] = 5 ts[4] = 2000-01-01 04:00:00 n[4] = 4.0 d[4] = 2000-01-14 in[4] = @ 14 hours
+Found a[5] = 4 ts[5] = 2000-01-01 05:00:00 n[5] = 5.0 d[5] = 2000-01-15 in[5] = @ 15 hours
+Found a[6] = 3 ts[6] = 2000-01-01 06:00:00 n[6] = 6.0 d[6] = 2000-01-16 in[6] = @ 16 hours
+Found a[7] = 2 ts[7] = 2000-01-01 07:00:00 n[7] = 7.0 d[7] = 2000-01-17 in[7] = @ 17 hours
+Found a[8] = 1 ts[8] = 2000-01-01 08:00:00 n[8] = 8.0 d[8] = 2000-01-18 in[8] = @ 18 hours
+Found a[9] = 0 ts[9] = 2000-01-01 09:00:00 n[9] = 9.0 d[9] = 2000-01-19 in[9] = @ 19 hours
+Found text=klmnopqrst
+Found text={9,8,7,6,5,4,3,2,1,0}
diff --git a/src/interfaces/ecpg/test/expected/sql-binary.c b/src/interfaces/ecpg/test/expected/sql-binary.c
new file mode 100644
index 0000000..6d92ce3
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-binary.c
@@ -0,0 +1,230 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "binary.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "binary.pgc"
+
+
+/* exec sql begin declare section */
+
+
+
+
+
+
+
+struct TBempl {
+#line 9 "binary.pgc"
+ long idnum ;
+
+#line 10 "binary.pgc"
+ char name [ 21 ] ;
+
+#line 11 "binary.pgc"
+ short accs ;
+
+#line 12 "binary.pgc"
+ char byte [ 20 ] ;
+ } ;/* exec sql end declare section */
+#line 14 "binary.pgc"
+
+
+/* exec sql whenever sqlerror stop ; */
+#line 16 "binary.pgc"
+
+
+int
+main (void)
+{
+ /* exec sql begin declare section */
+
+
+
+
+#line 22 "binary.pgc"
+ struct TBempl empl ;
+
+#line 23 "binary.pgc"
+ char * pointer = NULL ;
+
+#line 24 "binary.pgc"
+ char * data = "\\001\\155\\000\\212" ;
+/* exec sql end declare section */
+#line 25 "binary.pgc"
+
+ int i;
+
+ ECPGdebug (1, stderr);
+
+ empl.idnum = 1;
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 31 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 31 "binary.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set bytea_output = escape", ECPGt_EOIT, ECPGt_EORT);
+#line 32 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 32 "binary.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea )", ECPGt_EOIT, ECPGt_EORT);
+#line 34 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 34 "binary.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into empl values ( 1 , 'first user' , 320 , $1 )",
+ ECPGt_char,&(data),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 35 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 35 "binary.pgc"
+
+ ECPGset_var( 0, &( empl.idnum ), __LINE__);\
+ /* declare C cursor for select name , accs , byte from empl where idnum = $1 */
+#line 36 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 36 "binary.pgc"
+
+#line 36 "binary.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare C cursor for select name , accs , byte from empl where idnum = $1 ",
+ ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 37 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 37 "binary.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch C", ECPGt_EOIT,
+ ECPGt_char,(empl.name),(long)21,(long)1,(21)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_short,&(empl.accs),(long)1,(long)1,sizeof(short),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(empl.byte),(long)20,(long)1,(20)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 38 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 38 "binary.pgc"
+
+ printf ("name=%s, accs=%d byte=%s\n", empl.name, empl.accs, empl.byte);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close C", ECPGt_EOIT, ECPGt_EORT);
+#line 41 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 41 "binary.pgc"
+
+
+ memset(empl.name, 0, 21L);
+ ECPGset_var( 1, &( empl.idnum ), __LINE__);\
+ /* declare B binary cursor for select name , accs , byte from empl where idnum = $1 */
+#line 44 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 44 "binary.pgc"
+
+#line 44 "binary.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare B binary cursor for select name , accs , byte from empl where idnum = $1 ",
+ ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 45 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 45 "binary.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch B", ECPGt_EOIT,
+ ECPGt_char,(empl.name),(long)21,(long)1,(21)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_short,&(empl.accs),(long)1,(long)1,sizeof(short),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(empl.byte),(long)20,(long)1,(20)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 46 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 46 "binary.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close B", ECPGt_EOIT, ECPGt_EORT);
+#line 47 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 47 "binary.pgc"
+
+
+ /* do not print a.accs because big/little endian will have different outputs here */
+ printf ("name=%s, byte=", empl.name);
+ for (i=0; i<4; i++)
+ printf("(%o)", (unsigned char)empl.byte[i]);
+ printf("\n");
+
+ ECPGset_var( 2, &( empl.idnum ), __LINE__);\
+ /* declare A binary cursor for select byte from empl where idnum = $1 */
+#line 55 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 55 "binary.pgc"
+
+#line 55 "binary.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare A binary cursor for select byte from empl where idnum = $1 ",
+ ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 56 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 56 "binary.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch A", ECPGt_EOIT,
+ ECPGt_char,&(pointer),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 57 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 57 "binary.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close A", ECPGt_EOIT, ECPGt_EORT);
+#line 58 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 58 "binary.pgc"
+
+
+ if (pointer) {
+ printf ("pointer=");
+ for (i=0; i<4; i++)
+ printf("(%o)", (unsigned char)pointer[i]);
+ printf("\n");
+ free(pointer);
+ }
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 68 "binary.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 68 "binary.pgc"
+
+ exit (0);
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-binary.stderr b/src/interfaces/ecpg/test/expected/sql-binary.stderr
new file mode 100644
index 0000000..28e5474
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-binary.stderr
@@ -0,0 +1,102 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: set bytea_output = escape; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: query: create table empl ( idnum integer , name char ( 20 ) , accs smallint , byte bytea ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 33: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: query: insert into empl values ( 1 , 'first user' , 320 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 35: parameter 1 = \001\155\000\212
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 35: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: query: declare C cursor for select name , accs , byte from empl where idnum = $1 ; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 37: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 37: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 38: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 38: RESULT: first user offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 38: RESULT: 320 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 38: RESULT: \001m\000\212 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: query: close C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 41: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 45: query: declare B binary cursor for select name , accs , byte from empl where idnum = $1 ; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 45: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 45: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 45: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: query: fetch B; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: BINARY offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: BINARY offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: BINARY offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 47: query: close B; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 47: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 47: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 56: query: declare A binary cursor for select byte from empl where idnum = $1 ; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 56: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 56: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 56: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 57: query: fetch A; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 57: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 57: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 57: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 57: RESULT: BINARY offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 58: query: close A; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 58: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 58: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-binary.stdout b/src/interfaces/ecpg/test/expected/sql-binary.stdout
new file mode 100644
index 0000000..b2a94db
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-binary.stdout
@@ -0,0 +1,3 @@
+name=first user , accs=320 byte=\001m\000\212
+name=first user , byte=(1)(155)(0)(212)
+pointer=(1)(155)(0)(212)
diff --git a/src/interfaces/ecpg/test/expected/sql-bytea.c b/src/interfaces/ecpg/test/expected/sql-bytea.c
new file mode 100644
index 0000000..8338c60
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-bytea.c
@@ -0,0 +1,373 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "bytea.pgc"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <time.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 6 "bytea.pgc"
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 7 "bytea.pgc"
+
+
+static void
+dump_binary(char *buf, int len, int ind)
+{
+ int i;
+
+ printf("len=%d, ind=%d, data=0x", len, ind);
+ for (i = 0; i < len; ++i)
+ printf("%02x", 0xff & buf[i]);
+ printf("\n");
+}
+
+#define DATA_SIZE 0x200
+#define LACK_SIZE 13
+#
+int
+main(void)
+{
+/* exec sql begin declare section */
+
+
+
+
+
+
+#line 27 "bytea.pgc"
+ struct bytea_1 { int len; char arr[ 512 ]; } send_buf [ 2 ] ;
+
+#line 28 "bytea.pgc"
+ struct bytea_2 { int len; char arr[ DATA_SIZE ]; } recv_buf [ 2 ] ;
+
+#line 29 "bytea.pgc"
+ struct bytea_3 { int len; char arr[ DATA_SIZE ]; } * recv_vlen_buf ;
+
+#line 30 "bytea.pgc"
+ struct bytea_4 { int len; char arr[ DATA_SIZE - LACK_SIZE ]; } recv_short_buf ;
+
+#line 31 "bytea.pgc"
+ int ind [ 2 ] ;
+/* exec sql end declare section */
+#line 32 "bytea.pgc"
+
+ int i, j, c;
+
+#define init() { \
+ for (i = 0; i < 2; ++i) \
+ { \
+ memset(recv_buf[i].arr, 0x0, sizeof(recv_buf[i].arr)); \
+ recv_buf[i].len = 0; \
+ ind[i] = 0; \
+ } \
+ recv_vlen_buf = NULL, \
+ memset(recv_short_buf.arr, 0x0, sizeof(recv_short_buf.arr)); \
+} \
+while (0)
+
+ ECPGdebug(1, stderr);
+
+ for (i = 0; i < 2; ++i)
+ {
+ for (j = 0, c = 0xff; (c == -1 ? c = 0xff : 1), j < DATA_SIZE; ++j, --c)
+ send_buf[i].arr[j] = c;
+
+ send_buf[i].len = DATA_SIZE;
+ }
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 57 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 57 "bytea.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table if not exists test ( data1 bytea , data2 bytea )", ECPGt_EOIT, ECPGt_EORT);
+#line 59 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 59 "bytea.pgc"
+
+
+ { ECPGprepare(__LINE__, NULL, 0, "ins_stmt", "insert into test values(?,?)");
+#line 61 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 61 "bytea.pgc"
+
+ { ECPGprepare(__LINE__, NULL, 0, "sel_stmt", "select data1,data2 from test");
+#line 62 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 62 "bytea.pgc"
+
+ ECPGallocate_desc(__LINE__, "idesc");
+#line 63 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();
+#line 63 "bytea.pgc"
+
+ ECPGallocate_desc(__LINE__, "odesc");
+#line 64 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();
+#line 64 "bytea.pgc"
+
+
+ /* Test for static sql statement with normal host variable, indicator */
+ init();
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 68 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 68 "bytea.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( $1 , $2 )",
+ ECPGt_bytea,&(send_buf[0]),(long)512,(long)1,sizeof(struct bytea_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_bytea,&(send_buf[1]),(long)512,(long)1,sizeof(struct bytea_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 69 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 69 "bytea.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select data1 , data2 from test", ECPGt_EOIT,
+ ECPGt_bytea,&(recv_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_2),
+ ECPGt_int,&(ind[0]),(long)1,(long)1,sizeof(int),
+ ECPGt_bytea,&(recv_short_buf),(long)DATA_SIZE - LACK_SIZE,(long)1,sizeof(struct bytea_4),
+ ECPGt_int,&(ind[1]),(long)1,(long)1,sizeof(int), ECPGt_EORT);
+#line 70 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 70 "bytea.pgc"
+
+ dump_binary(recv_buf[0].arr, recv_buf[0].len, ind[0]);
+ dump_binary(recv_short_buf.arr, recv_short_buf.len, ind[1]);
+
+ /* Test for cursor */
+ init();
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 76 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 76 "bytea.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( $1 , $2 )",
+ ECPGt_bytea,&(send_buf[0]),(long)512,(long)1,sizeof(struct bytea_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_bytea,&(send_buf[1]),(long)512,(long)1,sizeof(struct bytea_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 77 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 77 "bytea.pgc"
+
+ ECPGset_var( 0, &( send_buf[0] ), __LINE__);\
+ /* declare cursor1 cursor for select data1 from test where data1 = $1 */
+#line 78 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();
+#line 78 "bytea.pgc"
+
+#line 78 "bytea.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cursor1 cursor for select data1 from test where data1 = $1 ",
+ ECPGt_bytea,&(send_buf[0]),(long)512,(long)1,sizeof(struct bytea_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 79 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 79 "bytea.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch from cursor1", ECPGt_EOIT,
+ ECPGt_bytea,&(recv_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_2),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 80 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 80 "bytea.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cursor1", ECPGt_EOIT, ECPGt_EORT);
+#line 81 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 81 "bytea.pgc"
+
+ { ECPGdeallocate(__LINE__, 0, NULL, "cursor1");
+#line 82 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 82 "bytea.pgc"
+
+ dump_binary(recv_buf[0].arr, recv_buf[0].len, 0);
+
+ /* Test for variable length array */
+ init();
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 87 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 87 "bytea.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( $1 , $2 )",
+ ECPGt_bytea,&(send_buf[0]),(long)512,(long)1,sizeof(struct bytea_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_bytea,&(send_buf[1]),(long)512,(long)1,sizeof(struct bytea_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 88 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 88 "bytea.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( $1 , $2 )",
+ ECPGt_bytea,&(send_buf[0]),(long)512,(long)1,sizeof(struct bytea_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_bytea,&(send_buf[1]),(long)512,(long)1,sizeof(struct bytea_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 89 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 89 "bytea.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select data1 from test", ECPGt_EOIT,
+ ECPGt_bytea,&(recv_vlen_buf),(long)DATA_SIZE,(long)0,sizeof(struct bytea_3),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 90 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 90 "bytea.pgc"
+
+ dump_binary(recv_vlen_buf[0].arr, recv_vlen_buf[0].len, 0);
+ dump_binary(recv_vlen_buf[1].arr, recv_vlen_buf[1].len, 0);
+ free(recv_vlen_buf);
+
+ /* Test for dynamic sql statement with normal host variable, indicator */
+ init();
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 97 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 97 "bytea.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "ins_stmt",
+ ECPGt_bytea,&(send_buf[0]),(long)512,(long)1,sizeof(struct bytea_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_bytea,&(send_buf[1]),(long)512,(long)1,sizeof(struct bytea_1),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 98 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 98 "bytea.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "sel_stmt", ECPGt_EOIT,
+ ECPGt_bytea,&(recv_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_2),
+ ECPGt_int,&(ind[0]),(long)1,(long)1,sizeof(int),
+ ECPGt_bytea,&(recv_short_buf),(long)DATA_SIZE - LACK_SIZE,(long)1,sizeof(struct bytea_4),
+ ECPGt_int,&(ind[1]),(long)1,(long)1,sizeof(int), ECPGt_EORT);
+#line 99 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 99 "bytea.pgc"
+
+ dump_binary(recv_buf[0].arr, recv_buf[0].len, ind[0]);
+ dump_binary(recv_short_buf.arr, recv_short_buf.len, ind[1]);
+
+ /* Test for dynamic sql statement with sql descriptor */
+ init();
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 105 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 105 "bytea.pgc"
+
+ { ECPGset_desc(__LINE__, "idesc", 1,ECPGd_data,
+ ECPGt_bytea,&(send_buf[0]),(long)512,(long)1,sizeof(struct bytea_1), ECPGd_EODT);
+
+#line 106 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 106 "bytea.pgc"
+
+ { ECPGset_desc(__LINE__, "idesc", 2,ECPGd_data,
+ ECPGt_bytea,&(send_buf[1]),(long)512,(long)1,sizeof(struct bytea_1), ECPGd_EODT);
+
+#line 107 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 107 "bytea.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "ins_stmt",
+ ECPGt_descriptor, "idesc", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 108 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 108 "bytea.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "sel_stmt", ECPGt_EOIT,
+ ECPGt_descriptor, "odesc", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 109 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 109 "bytea.pgc"
+
+ { ECPGget_desc(__LINE__, "odesc", 1,ECPGd_indicator,
+ ECPGt_int,&(ind[0]),(long)1,(long)1,sizeof(int), ECPGd_data,
+ ECPGt_bytea,&(recv_buf[0]),(long)DATA_SIZE,(long)1,sizeof(struct bytea_2), ECPGd_EODT);
+
+#line 110 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 110 "bytea.pgc"
+
+ { ECPGget_desc(__LINE__, "odesc", 2,ECPGd_indicator,
+ ECPGt_int,&(ind[1]),(long)1,(long)1,sizeof(int), ECPGd_data,
+ ECPGt_bytea,&(recv_short_buf),(long)DATA_SIZE - LACK_SIZE,(long)1,sizeof(struct bytea_4), ECPGd_EODT);
+
+#line 111 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 111 "bytea.pgc"
+
+ dump_binary(recv_buf[0].arr, recv_buf[0].len, ind[0]);
+ dump_binary(recv_short_buf.arr, recv_short_buf.len, ind[1]);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
+#line 115 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 115 "bytea.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 116 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 116 "bytea.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 117 "bytea.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 117 "bytea.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-bytea.stderr b/src/interfaces/ecpg/test/expected/sql-bytea.stderr
new file mode 100644
index 0000000..cb828a7
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-bytea.stderr
@@ -0,0 +1,191 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 59: query: create table if not exists test ( data1 bytea , data2 bytea ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 59: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 59: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 61: name ins_stmt; query: "insert into test values($1,$2)"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 62: name sel_stmt; query: "select data1,data2 from test"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 68: query: truncate test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 68: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 68: OK: TRUNCATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 69: query: insert into test values ( $1 , $2 ); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 69: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 69: parameter 1 = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 69: parameter 2 = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 69: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 70: query: select data1 , data2 from test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 70: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 70: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 70: RESULT: \xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 70: RESULT: \xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 76: query: truncate test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 76: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 76: OK: TRUNCATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 77: query: insert into test values ( $1 , $2 ); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 77: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 77: parameter 1 = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 77: parameter 2 = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 77: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 79: query: declare cursor1 cursor for select data1 from test where data1 = $1 ; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 79: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 79: parameter 1 = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 79: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 80: query: fetch from cursor1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 80: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 80: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 80: RESULT: \xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 81: query: close cursor1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 81: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 81: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -230 on line 82: invalid statement name "cursor1" on line 82
+[NO_PID]: sqlca: code: -230, state: 26000
+SQL error: invalid statement name "cursor1" on line 82
+[NO_PID]: ecpg_execute on line 87: query: truncate test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 87: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 87: OK: TRUNCATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 88: query: insert into test values ( $1 , $2 ); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 88: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 88: parameter 1 = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 88: parameter 2 = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 88: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 89: query: insert into test values ( $1 , $2 ); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 89: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 89: parameter 1 = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 89: parameter 2 = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 89: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 90: query: select data1 from test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 90: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 90: correctly got 2 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 90: allocating memory for 2 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 90: RESULT: \xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 90: RESULT: \xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 97: query: truncate test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 97: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 97: OK: TRUNCATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 98: query: insert into test values($1,$2); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 98: using PQexecPrepared for "insert into test values($1,$2)"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 98: parameter 1 = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 98: parameter 2 = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 98: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 99: query: select data1,data2 from test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 99: using PQexecPrepared for "select data1,data2 from test"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 99: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 99: RESULT: \xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 99: RESULT: \xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 105: query: truncate test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 105: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 105: OK: TRUNCATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 108: query: insert into test values($1,$2); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 108: using PQexecPrepared for "insert into test values($1,$2)"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 108: parameter 1 = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 108: parameter 2 = fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 108: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 109: query: select data1,data2 from test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 109: using PQexecPrepared for "select data1,data2 from test"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 109: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 109: putting result (1 tuples) into descriptor odesc
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 110: RESULT: \xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 111: RESULT: \xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 115: query: drop table test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 115: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 115: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 116: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name sel_stmt
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name ins_stmt
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-bytea.stdout b/src/interfaces/ecpg/test/expected/sql-bytea.stdout
new file mode 100644
index 0000000..33e6100
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-bytea.stdout
@@ -0,0 +1,9 @@
+len=512, ind=0, data=0xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+len=499, ind=512, data=0xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d
+len=512, ind=0, data=0xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+len=512, ind=0, data=0xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+len=512, ind=0, data=0xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+len=512, ind=0, data=0xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+len=499, ind=512, data=0xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d
+len=512, ind=0, data=0xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
+len=499, ind=512, data=0xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d
diff --git a/src/interfaces/ecpg/test/expected/sql-code100.c b/src/interfaces/ecpg/test/expected/sql-code100.c
new file mode 100644
index 0000000..4c85530
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-code100.c
@@ -0,0 +1,164 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "code100.pgc"
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 1 "code100.pgc"
+
+#include <stdio.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "code100.pgc"
+
+
+
+int main()
+{ /* exec sql begin declare section */
+
+
+#line 9 "code100.pgc"
+ int index ;
+/* exec sql end declare section */
+#line 10 "code100.pgc"
+
+
+
+ ECPGdebug(1,stderr);
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 15 "code100.pgc"
+
+ if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( \"index\" numeric ( 3 ) primary key , \"payload\" int4 not null )", ECPGt_EOIT, ECPGt_EORT);}
+#line 20 "code100.pgc"
+
+ if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
+ { ECPGtrans(__LINE__, NULL, "commit work");}
+#line 22 "code100.pgc"
+
+ if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
+
+ for (index=0;index<10;++index)
+ { { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test ( payload , index ) values ( 0 , $1 )",
+ ECPGt_int,&(index),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
+#line 28 "code100.pgc"
+
+ if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
+ }
+ { ECPGtrans(__LINE__, NULL, "commit work");}
+#line 31 "code100.pgc"
+
+ if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update test set payload = payload + 1 where index = - 1", ECPGt_EOIT, ECPGt_EORT);}
+#line 35 "code100.pgc"
+
+ if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "delete from test where index = - 1", ECPGt_EOIT, ECPGt_EORT);}
+#line 38 "code100.pgc"
+
+ if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test ( select * from test where index = - 1 )", ECPGt_EOIT, ECPGt_EORT);}
+#line 41 "code100.pgc"
+
+ if (sqlca.sqlcode!=100) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);}
+#line 44 "code100.pgc"
+
+ if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
+ { ECPGtrans(__LINE__, NULL, "commit work");}
+#line 46 "code100.pgc"
+
+ if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 49 "code100.pgc"
+
+ if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-code100.stderr b/src/interfaces/ecpg/test/expected/sql-code100.stderr
new file mode 100644
index 0000000..a84332e
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-code100.stderr
@@ -0,0 +1,128 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 18: query: create table test ( "index" numeric ( 3 ) primary key , "payload" int4 not null ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 18: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 18: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 22: action "commit work"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into test ( payload , index ) values ( 0 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 26: parameter 1 = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into test ( payload , index ) values ( 0 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 26: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into test ( payload , index ) values ( 0 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 26: parameter 1 = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into test ( payload , index ) values ( 0 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 26: parameter 1 = 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into test ( payload , index ) values ( 0 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 26: parameter 1 = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into test ( payload , index ) values ( 0 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 26: parameter 1 = 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into test ( payload , index ) values ( 0 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 26: parameter 1 = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into test ( payload , index ) values ( 0 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 26: parameter 1 = 7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into test ( payload , index ) values ( 0 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 26: parameter 1 = 8
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into test ( payload , index ) values ( 0 , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 26: parameter 1 = 9
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 31: action "commit work"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: query: update test set payload = payload + 1 where index = - 1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 34: OK: UPDATE 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 34: no data found on line 34
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 38: query: delete from test where index = - 1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 38: OK: DELETE 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 38: no data found on line 38
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 41: query: insert into test ( select * from test where index = - 1 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 41: OK: INSERT 0 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 41: no data found on line 41
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 44: query: drop table test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 44: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 44: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 46: action "commit work"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-code100.stdout b/src/interfaces/ecpg/test/expected/sql-code100.stdout
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-code100.stdout
diff --git a/src/interfaces/ecpg/test/expected/sql-copystdout.c b/src/interfaces/ecpg/test/expected/sql-copystdout.c
new file mode 100644
index 0000000..d2599fb
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-copystdout.c
@@ -0,0 +1,150 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "copystdout.pgc"
+#include <stdio.h>
+
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 3 "copystdout.pgc"
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "copystdout.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 6 "copystdout.pgc"
+
+
+int
+main ()
+{
+ ECPGdebug (1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 13 "copystdout.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 13 "copystdout.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table foo ( a int , b varchar )", ECPGt_EOIT, ECPGt_EORT);
+#line 14 "copystdout.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 14 "copystdout.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into foo values ( 5 , 'abc' )", ECPGt_EOIT, ECPGt_EORT);
+#line 15 "copystdout.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 15 "copystdout.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into foo values ( 6 , 'def' )", ECPGt_EOIT, ECPGt_EORT);
+#line 16 "copystdout.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 16 "copystdout.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into foo values ( 7 , 'ghi' )", ECPGt_EOIT, ECPGt_EORT);
+#line 17 "copystdout.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 17 "copystdout.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "copy foo to stdout with delimiter ','", ECPGt_EOIT, ECPGt_EORT);
+#line 19 "copystdout.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 19 "copystdout.pgc"
+
+ printf ("copy to STDOUT : sqlca.sqlcode = %ld\n", sqlca.sqlcode);
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 22 "copystdout.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 22 "copystdout.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-copystdout.stderr b/src/interfaces/ecpg/test/expected/sql-copystdout.stderr
new file mode 100644
index 0000000..df53ce1
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-copystdout.stderr
@@ -0,0 +1,38 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 14: query: create table foo ( a int , b varchar ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 14: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 14: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 15: query: insert into foo values ( 5 , 'abc' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 15: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 15: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 16: query: insert into foo values ( 6 , 'def' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 16: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 16: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 17: query: insert into foo values ( 7 , 'ghi' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 17: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 17: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 19: query: copy foo to stdout with delimiter ','; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 19: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 19: COPY OUT data transfer in progress
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 19: got PGRES_COMMAND_OK after PGRES_COPY_OUT
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-copystdout.stdout b/src/interfaces/ecpg/test/expected/sql-copystdout.stdout
new file mode 100644
index 0000000..4fbc432
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-copystdout.stdout
@@ -0,0 +1,4 @@
+5,abc
+6,def
+7,ghi
+copy to STDOUT : sqlca.sqlcode = 0
diff --git a/src/interfaces/ecpg/test/expected/sql-createtableas.c b/src/interfaces/ecpg/test/expected/sql-createtableas.c
new file mode 100644
index 0000000..973b463
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-createtableas.c
@@ -0,0 +1,164 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "createtableas.pgc"
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 6 "createtableas.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 8 "createtableas.pgc"
+
+
+int
+main(void)
+{
+ /* exec sql begin declare section */
+
+
+#line 14 "createtableas.pgc"
+ int id ;
+/* exec sql end declare section */
+#line 15 "createtableas.pgc"
+
+
+ ECPGdebug(1, stderr);
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 18 "createtableas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 18 "createtableas.pgc"
+
+
+ { ECPGsetcommit(__LINE__, "on", NULL);
+#line 20 "createtableas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 20 "createtableas.pgc"
+
+ /* exec sql whenever sql_warning sqlprint ; */
+#line 21 "createtableas.pgc"
+
+ /* exec sql whenever sqlerror sqlprint ; */
+#line 22 "createtableas.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table cta_test ( id int )", ECPGt_EOIT, ECPGt_EORT);
+#line 24 "createtableas.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 24 "createtableas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 24 "createtableas.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into cta_test values ( 100 )", ECPGt_EOIT, ECPGt_EORT);
+#line 25 "createtableas.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 25 "createtableas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 25 "createtableas.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table if not exists cta_test1 as select * from cta_test", ECPGt_EOIT, ECPGt_EORT);
+#line 27 "createtableas.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 27 "createtableas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 27 "createtableas.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select id from cta_test1", ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 28 "createtableas.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 28 "createtableas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 28 "createtableas.pgc"
+
+ printf("ID = %d\n", id);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table cta_test2 as select * from cta_test with no data", ECPGt_EOIT, ECPGt_EORT);
+#line 31 "createtableas.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 31 "createtableas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 31 "createtableas.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( id ) from cta_test2", ECPGt_EOIT,
+ ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 32 "createtableas.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 32 "createtableas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 32 "createtableas.pgc"
+
+ printf("ID = %d\n", id);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table cta_test", ECPGt_EOIT, ECPGt_EORT);
+#line 35 "createtableas.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 35 "createtableas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 35 "createtableas.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table cta_test1", ECPGt_EOIT, ECPGt_EORT);
+#line 36 "createtableas.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 36 "createtableas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 36 "createtableas.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table cta_test2", ECPGt_EOIT, ECPGt_EORT);
+#line 37 "createtableas.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 37 "createtableas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 37 "createtableas.pgc"
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 38 "createtableas.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 38 "createtableas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 38 "createtableas.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-createtableas.stderr b/src/interfaces/ecpg/test/expected/sql-createtableas.stderr
new file mode 100644
index 0000000..adb6711
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-createtableas.stderr
@@ -0,0 +1,66 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGsetcommit on line 20: action "on"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: query: create table cta_test ( id int ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 24: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: query: insert into cta_test values ( 100 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 25: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 27: query: create table if not exists cta_test1 as select * from cta_test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 27: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 27: OK: SELECT 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: query: select id from cta_test1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 28: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 28: RESULT: 100 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: query: create table cta_test2 as select * from cta_test with no data; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 31: OK: CREATE TABLE AS
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: select count ( id ) from cta_test2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: 0 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: query: drop table cta_test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 35: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: drop table cta_test1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: query: drop table cta_test2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 37: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-createtableas.stdout b/src/interfaces/ecpg/test/expected/sql-createtableas.stdout
new file mode 100644
index 0000000..e27a3e9
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-createtableas.stdout
@@ -0,0 +1,2 @@
+ID = 100
+ID = 0
diff --git a/src/interfaces/ecpg/test/expected/sql-declare.c b/src/interfaces/ecpg/test/expected/sql-declare.c
new file mode 100644
index 0000000..6248d99
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-declare.c
@@ -0,0 +1,618 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "declare.pgc"
+#include <locale.h>
+#include <string.h>
+#include <stdlib.h>
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 5 "declare.pgc"
+
+
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 7 "declare.pgc"
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 8 "declare.pgc"
+
+
+#define ARRAY_SIZE 2
+
+void execute_test(void);
+void commitTable(void);
+void reset(void);
+void printResult(char *tc_name, int loop);
+
+/* exec sql begin declare section */
+
+
+
+
+#line 18 "declare.pgc"
+ int f1 [ ARRAY_SIZE ] ;
+
+#line 19 "declare.pgc"
+ int f2 [ ARRAY_SIZE ] ;
+
+#line 20 "declare.pgc"
+ char f3 [ ARRAY_SIZE ] [ 20 ] ;
+/* exec sql end declare section */
+#line 21 "declare.pgc"
+
+
+int main(void)
+{
+ setlocale(LC_ALL, "C");
+
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "con1", 0);
+#line 29 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 29 "declare.pgc"
+
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "con2", 0);
+#line 30 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 30 "declare.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, "con1", 0, ECPGst_normal, "create table source ( f1 integer , f2 integer , f3 varchar ( 20 ) )", ECPGt_EOIT, ECPGt_EORT);
+#line 32 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 32 "declare.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "con2", 0, ECPGst_normal, "create table source ( f1 integer , f2 integer , f3 varchar ( 20 ) )", ECPGt_EOIT, ECPGt_EORT);
+#line 33 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 33 "declare.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, "con1", 0, ECPGst_normal, "insert into source values ( 1 , 10 , 'db on con1' )", ECPGt_EOIT, ECPGt_EORT);
+#line 35 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 35 "declare.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "con1", 0, ECPGst_normal, "insert into source values ( 2 , 20 , 'db on con1' )", ECPGt_EOIT, ECPGt_EORT);
+#line 36 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 36 "declare.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, "con2", 0, ECPGst_normal, "insert into source values ( 1 , 10 , 'db on con2' )", ECPGt_EOIT, ECPGt_EORT);
+#line 38 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 38 "declare.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "con2", 0, ECPGst_normal, "insert into source values ( 2 , 20 , 'db on con2' )", ECPGt_EOIT, ECPGt_EORT);
+#line 39 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 39 "declare.pgc"
+
+
+ commitTable();
+
+ execute_test();
+
+ { ECPGdo(__LINE__, 0, 1, "con1", 0, ECPGst_normal, "drop table if exists source", ECPGt_EOIT, ECPGt_EORT);
+#line 45 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 45 "declare.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "con2", 0, ECPGst_normal, "drop table if exists source", ECPGt_EOIT, ECPGt_EORT);
+#line 46 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 46 "declare.pgc"
+
+
+ commitTable();
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 50 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 50 "declare.pgc"
+
+
+ return 0;
+}
+
+/*
+ * default connection: con2
+ * Non-default connection: con1
+ *
+ */
+void execute_test(void)
+{
+ /* exec sql begin declare section */
+
+
+
+#line 63 "declare.pgc"
+ int i , count , length ;
+
+#line 64 "declare.pgc"
+ char * selectString = "SELECT f1,f2,f3 FROM source" ;
+/* exec sql end declare section */
+#line 65 "declare.pgc"
+
+
+ /*
+ * testcase1. using DECLARE STATEMENT without using AT clause,
+ * using PREPARE and CURSOR statement without using AT clause
+ */
+ reset();
+
+ /* declare \"stmt_1\" as an SQL identifier */
+#line 73 "declare.pgc"
+
+ { ECPGprepare(__LINE__, NULL, 0, "stmt_1", selectString);
+#line 74 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 74 "declare.pgc"
+
+ /* declare cur_1 cursor for $1 */
+#line 75 "declare.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_1 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "stmt_1", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 76 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 76 "declare.pgc"
+
+
+ /* exec sql whenever not found break ; */
+#line 78 "declare.pgc"
+
+ i = 0;
+ while (1)
+ {
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_1", ECPGt_EOIT,
+ ECPGt_int,&(f1[i]),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(f2[i]),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(f3[i]),(long)20,(long)1,(20)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 82 "declare.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+#line 82 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 82 "declare.pgc"
+
+ i++;
+ }
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_1", ECPGt_EOIT, ECPGt_EORT);
+#line 85 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 85 "declare.pgc"
+
+ { ECPGdeallocate(__LINE__, 0, NULL, "stmt_1");
+#line 86 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 86 "declare.pgc"
+
+ /* exec sql whenever not found continue ; */
+#line 87 "declare.pgc"
+
+
+ printResult("testcase1", 2);
+
+
+ /*
+ * testcase2. using DECLARE STATEMENT at con1,
+ * using PREPARE and CURSOR statement without using AT clause
+ */
+ reset();
+
+ /* declare \"stmt_2\" as an SQL identifier */
+#line 98 "declare.pgc"
+
+ { ECPGprepare(__LINE__, "con1", 0, "stmt_2", selectString);
+#line 99 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 99 "declare.pgc"
+
+ /* declare cur_2 cursor for $1 */
+#line 100 "declare.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "con1", 0, ECPGst_normal, "declare cur_2 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement("con1", "stmt_2", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 101 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 101 "declare.pgc"
+
+
+ /* exec sql whenever not found break ; */
+#line 103 "declare.pgc"
+
+ i = 0;
+ while (1)
+ {
+ { ECPGdo(__LINE__, 0, 1, "con1", 0, ECPGst_normal, "fetch cur_2", ECPGt_EOIT,
+ ECPGt_int,&(f1[i]),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(f2[i]),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(f3[i]),(long)20,(long)1,(20)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 107 "declare.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+#line 107 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 107 "declare.pgc"
+
+ i++;
+ }
+ { ECPGdo(__LINE__, 0, 1, "con1", 0, ECPGst_normal, "close cur_2", ECPGt_EOIT, ECPGt_EORT);
+#line 110 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 110 "declare.pgc"
+
+ { ECPGdeallocate(__LINE__, 0, "con1", "stmt_2");
+#line 111 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 111 "declare.pgc"
+
+ /* exec sql whenever not found continue ; */
+#line 112 "declare.pgc"
+
+
+ printResult("testcase2", 2);
+
+ /*
+ * testcase3. using DECLARE STATEMENT without using AT clause,
+ * using PREPARE and EXECUTE statement without using AT clause
+ */
+ reset();
+
+ /* declare \"stmt_3\" as an SQL identifier */
+#line 122 "declare.pgc"
+
+ { ECPGprepare(__LINE__, NULL, 0, "stmt_3", selectString);
+#line 123 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 123 "declare.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "stmt_3", ECPGt_EOIT,
+ ECPGt_int,(f1),(long)1,(long)ARRAY_SIZE,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,(f2),(long)1,(long)ARRAY_SIZE,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(f3),(long)20,(long)ARRAY_SIZE,(20)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 124 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 124 "declare.pgc"
+
+
+ { ECPGdeallocate(__LINE__, 0, NULL, "stmt_3");
+#line 126 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 126 "declare.pgc"
+
+
+ printResult("testcase3", 2);
+
+ /*
+ * testcase4. using DECLARE STATEMENT without using AT clause,
+ * using PREPARE and CURSOR statement at con2
+ */
+ reset();
+
+ /* declare \"stmt_4\" as an SQL identifier */
+#line 136 "declare.pgc"
+
+ { ECPGprepare(__LINE__, "con2", 0, "stmt_4", selectString);
+#line 137 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 137 "declare.pgc"
+
+ /* declare cur_4 cursor for $1 */
+#line 138 "declare.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "con2", 0, ECPGst_normal, "declare cur_4 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement("con2", "stmt_4", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 139 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 139 "declare.pgc"
+
+
+ /* exec sql whenever not found break ; */
+#line 141 "declare.pgc"
+
+ i = 0;
+ while (1)
+ {
+ { ECPGdo(__LINE__, 0, 1, "con2", 0, ECPGst_normal, "fetch cur_4", ECPGt_EOIT,
+ ECPGt_int,&(f1[i]),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(f2[i]),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(f3[i]),(long)20,(long)1,(20)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 145 "declare.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+#line 145 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 145 "declare.pgc"
+
+ i++;
+ }
+ { ECPGdo(__LINE__, 0, 1, "con2", 0, ECPGst_normal, "close cur_4", ECPGt_EOIT, ECPGt_EORT);
+#line 148 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 148 "declare.pgc"
+
+ { ECPGdeallocate(__LINE__, 0, "con2", "stmt_4");
+#line 149 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 149 "declare.pgc"
+
+ /* exec sql whenever not found continue ; */
+#line 150 "declare.pgc"
+
+
+ printResult("testcase4", 2);
+
+ /*
+ * DESCRIBE statement is also supported.
+ */
+ /* declare \"stmt_desc\" as an SQL identifier */
+#line 157 "declare.pgc"
+
+ { ECPGprepare(__LINE__, "con1", 0, "stmt_desc", selectString);
+#line 158 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 158 "declare.pgc"
+
+ /* declare cur_desc cursor for $1 */
+#line 159 "declare.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "con1", 0, ECPGst_normal, "declare cur_desc cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement("con1", "stmt_desc", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 160 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 160 "declare.pgc"
+
+
+ /* descriptor can be used for describe statement */
+ ECPGallocate_desc(__LINE__, "desc_for_describe");
+#line 163 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();
+#line 163 "declare.pgc"
+
+ { ECPGdescribe(__LINE__, 0, 0, "con1", "stmt_desc",
+ ECPGt_descriptor, "desc_for_describe", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 164 "declare.pgc"
+
+
+ { ECPGget_desc_header(__LINE__, "desc_for_describe", &(count));
+
+#line 166 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 166 "declare.pgc"
+
+ { ECPGget_desc(__LINE__, "desc_for_describe", 3,ECPGd_length,
+ ECPGt_int,&(length),(long)1,(long)1,sizeof(int), ECPGd_EODT);
+
+#line 167 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 167 "declare.pgc"
+
+
+ ECPGdeallocate_desc(__LINE__, "desc_for_describe");
+#line 169 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();
+#line 169 "declare.pgc"
+
+
+ /* for fetch statement */
+ ECPGallocate_desc(__LINE__, "desc_for_fetch");
+#line 172 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();
+#line 172 "declare.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "con1", 0, ECPGst_normal, "fetch cur_desc", ECPGt_EOIT,
+ ECPGt_descriptor, "desc_for_fetch", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 173 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 173 "declare.pgc"
+
+
+ { ECPGget_desc(__LINE__, "desc_for_fetch", 3,ECPGd_data,
+ ECPGt_char,(f3[0]),(long)20,(long)1,(20)*sizeof(char), ECPGd_EODT);
+
+#line 175 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 175 "declare.pgc"
+
+
+ ECPGdeallocate_desc(__LINE__, "desc_for_fetch");
+#line 177 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();
+#line 177 "declare.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, "con1", 0, ECPGst_normal, "close cur_desc", ECPGt_EOIT, ECPGt_EORT);
+#line 178 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 178 "declare.pgc"
+
+ { ECPGdeallocate(__LINE__, 0, "con1", "stmt_desc");
+#line 179 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 179 "declare.pgc"
+
+
+ printf("****descriptor results****\n");
+ printf("count: %d, length: %d, data: %s\n", count, length, f3[0]);
+}
+
+void commitTable()
+{
+ { ECPGtrans(__LINE__, "con1", "commit");
+#line 187 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 187 "declare.pgc"
+
+ { ECPGtrans(__LINE__, "con2", "commit");
+#line 188 "declare.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 188 "declare.pgc"
+
+}
+
+/*
+ * reset all the output variables
+ */
+void reset()
+{
+ memset(f1, 0, sizeof(f1));
+ memset(f2, 0, sizeof(f2));
+ memset(f3, 0, sizeof(f3));
+}
+
+void printResult(char *tc_name, int loop)
+{
+ int i;
+
+ if (tc_name)
+ printf("****%s test results:****\n", tc_name);
+
+ for (i = 0; i < loop; i++)
+ printf("f1=%d, f2=%d, f3=%s\n", f1[i], f2[i], f3[i]);
+
+ printf("\n");
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-declare.stderr b/src/interfaces/ecpg/test/expected/sql-declare.stderr
new file mode 100644
index 0000000..f5dc7c5
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-declare.stderr
@@ -0,0 +1,266 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: create table source ( f1 integer , f2 integer , f3 varchar ( 20 ) ); with 0 parameter(s) on connection con1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: query: create table source ( f1 integer , f2 integer , f3 varchar ( 20 ) ); with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 33: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: query: insert into source values ( 1 , 10 , 'db on con1' ); with 0 parameter(s) on connection con1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 35: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: insert into source values ( 2 , 20 , 'db on con1' ); with 0 parameter(s) on connection con1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: query: insert into source values ( 1 , 10 , 'db on con2' ); with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 38: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: query: insert into source values ( 2 , 20 , 'db on con2' ); with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 39: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 187: action "commit"; connection "con1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 188: action "commit"; connection "con2"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 74: name stmt_1; query: "SELECT f1,f2,f3 FROM source"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 76: query: declare cur_1 cursor for SELECT f1,f2,f3 FROM source; with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 76: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 76: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 82: query: fetch cur_1; with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 82: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 82: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 82: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 82: RESULT: 10 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 82: RESULT: db on con2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 82: query: fetch cur_1; with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 82: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 82: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 82: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 82: RESULT: 20 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 82: RESULT: db on con2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 82: query: fetch cur_1; with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 82: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 82: correctly got 0 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 82: no data found on line 82
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 85: query: close cur_1; with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 85: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 85: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 86: name stmt_1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 99: name stmt_2; query: "SELECT f1,f2,f3 FROM source"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 101: query: declare cur_2 cursor for SELECT f1,f2,f3 FROM source; with 0 parameter(s) on connection con1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 101: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 101: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 107: query: fetch cur_2; with 0 parameter(s) on connection con1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 107: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 107: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 107: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 107: RESULT: 10 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 107: RESULT: db on con1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 107: query: fetch cur_2; with 0 parameter(s) on connection con1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 107: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 107: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 107: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 107: RESULT: 20 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 107: RESULT: db on con1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 107: query: fetch cur_2; with 0 parameter(s) on connection con1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 107: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 107: correctly got 0 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 107: no data found on line 107
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 110: query: close cur_2; with 0 parameter(s) on connection con1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 110: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 110: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 111: name stmt_2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 123: name stmt_3; query: "SELECT f1,f2,f3 FROM source"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 124: query: SELECT f1,f2,f3 FROM source; with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 124: using PQexecPrepared for "SELECT f1,f2,f3 FROM source"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 124: correctly got 2 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 124: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 124: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 124: RESULT: 10 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 124: RESULT: 20 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 124: RESULT: db on con2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 124: RESULT: db on con2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 126: name stmt_3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 137: name stmt_4; query: "SELECT f1,f2,f3 FROM source"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 139: query: declare cur_4 cursor for SELECT f1,f2,f3 FROM source; with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 139: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 139: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 145: query: fetch cur_4; with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 145: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 145: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 145: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 145: RESULT: 10 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 145: RESULT: db on con2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 145: query: fetch cur_4; with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 145: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 145: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 145: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 145: RESULT: 20 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 145: RESULT: db on con2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 145: query: fetch cur_4; with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 145: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 145: correctly got 0 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 145: no data found on line 145
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 148: query: close cur_4; with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 148: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 148: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 149: name stmt_4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 158: name stmt_desc; query: "SELECT f1,f2,f3 FROM source"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 160: query: declare cur_desc cursor for SELECT f1,f2,f3 FROM source; with 0 parameter(s) on connection con1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 160: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 160: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 3 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = 20
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 173: query: fetch cur_desc; with 0 parameter(s) on connection con1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 173: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 173: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 173: putting result (1 tuples) into descriptor desc_for_fetch
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 175: RESULT: db on con1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 178: query: close cur_desc; with 0 parameter(s) on connection con1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 178: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 178: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 179: name stmt_desc
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 45: query: drop table if exists source; with 0 parameter(s) on connection con1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 45: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 45: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: query: drop table if exists source; with 0 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 187: action "commit"; connection "con1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 188: action "commit"; connection "con2"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection con2 closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection con1 closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-declare.stdout b/src/interfaces/ecpg/test/expected/sql-declare.stdout
new file mode 100644
index 0000000..c231f62
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-declare.stdout
@@ -0,0 +1,18 @@
+****testcase1 test results:****
+f1=1, f2=10, f3=db on con2
+f1=2, f2=20, f3=db on con2
+
+****testcase2 test results:****
+f1=1, f2=10, f3=db on con1
+f1=2, f2=20, f3=db on con1
+
+****testcase3 test results:****
+f1=1, f2=10, f3=db on con2
+f1=2, f2=20, f3=db on con2
+
+****testcase4 test results:****
+f1=1, f2=10, f3=db on con2
+f1=2, f2=20, f3=db on con2
+
+****descriptor results****
+count: 3, length: 20, data: db on con1
diff --git a/src/interfaces/ecpg/test/expected/sql-define.c b/src/interfaces/ecpg/test/expected/sql-define.c
new file mode 100644
index 0000000..29583ec
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-define.c
@@ -0,0 +1,205 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "define.pgc"
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 1 "define.pgc"
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 2 "define.pgc"
+
+
+
+
+
+int main(void)
+{
+ /* exec sql begin declare section */
+
+
+
+#line 10 "define.pgc"
+ int i ;
+
+#line 11 "define.pgc"
+ char s [ 200 ] ;
+/* exec sql end declare section */
+#line 12 "define.pgc"
+
+
+ ECPGdebug(1, stderr);
+
+ /* exec sql whenever sqlerror do sqlprint ( ) ; */
+#line 16 "define.pgc"
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 17 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 17 "define.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( a int , b text )", ECPGt_EOIT, ECPGt_EORT);
+#line 19 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 19 "define.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( 29 , 'abcdef' )", ECPGt_EOIT, ECPGt_EORT);
+#line 20 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 20 "define.pgc"
+
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( null , 'defined' )", ECPGt_EOIT, ECPGt_EORT);
+#line 23 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 23 "define.pgc"
+
+
+
+
+
+
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( null , 'someothervar not defined' )", ECPGt_EOIT, ECPGt_EORT);
+#line 31 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 31 "define.pgc"
+
+
+
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select 1 , 29 :: text || '-' || 'abcdef'", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(s),(long)200,(long)1,(200)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 36 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 36 "define.pgc"
+
+
+ printf("i: %d, s: %s\n", i, s);
+
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( 29 , 'no string' )", ECPGt_EOIT, ECPGt_EORT);
+#line 42 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 42 "define.pgc"
+
+
+
+ /* no value */
+
+
+
+
+
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set TIMEZONE to 'UTC'", ECPGt_EOIT, ECPGt_EORT);
+#line 53 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 53 "define.pgc"
+
+
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 56 "define.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 56 "define.pgc"
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-define.stderr b/src/interfaces/ecpg/test/expected/sql-define.stderr
new file mode 100644
index 0000000..20601b6
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-define.stderr
@@ -0,0 +1,52 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 19: query: create table test ( a int , b text ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 19: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 19: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: query: insert into test values ( 29 , 'abcdef' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 20: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: query: insert into test values ( null , 'defined' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 23: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: query: insert into test values ( null , 'someothervar not defined' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 31: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: select 1 , 29 :: text || '-' || 'abcdef'; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 36: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 36: RESULT: 29-abcdef offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: query: insert into test values ( 29 , 'no string' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 42: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: query: set TIMEZONE to 'UTC'; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 53: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-define.stdout b/src/interfaces/ecpg/test/expected/sql-define.stdout
new file mode 100644
index 0000000..864cd85
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-define.stdout
@@ -0,0 +1 @@
+i: 1, s: 29-abcdef
diff --git a/src/interfaces/ecpg/test/expected/sql-desc.c b/src/interfaces/ecpg/test/expected/sql-desc.c
new file mode 100644
index 0000000..bdd12a5
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-desc.c
@@ -0,0 +1,377 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "desc.pgc"
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 1 "desc.pgc"
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 2 "desc.pgc"
+
+
+int
+main(void)
+{
+ /* exec sql begin declare section */
+
+
+
+
+
+
+
+
+
+
+
+#line 8 "desc.pgc"
+ char * stmt1 = "INSERT INTO test1 VALUES ($1, $2)" ;
+
+#line 9 "desc.pgc"
+ char * stmt2 = "SELECT * from test1 where a = $1 and b = $2" ;
+
+#line 10 "desc.pgc"
+ char * stmt3 = "SELECT * from test1 where :var = a" ;
+
+#line 12 "desc.pgc"
+ int val1 = 1 ;
+
+#line 13 "desc.pgc"
+ char val2 [ 4 ] = "one" , val2output [] = "AAA" ;
+
+#line 14 "desc.pgc"
+ int val1output = 2 , val2i = 0 ;
+
+#line 15 "desc.pgc"
+ int val2null = - 1 ;
+
+#line 16 "desc.pgc"
+ int ind1 , ind2 ;
+
+#line 17 "desc.pgc"
+ char desc1 [ 8 ] = "outdesc" ;
+/* exec sql end declare section */
+#line 18 "desc.pgc"
+
+
+ ECPGdebug(1, stderr);
+
+ ECPGallocate_desc(__LINE__, "indesc");
+#line 22 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();
+#line 22 "desc.pgc"
+
+ ECPGallocate_desc(__LINE__, (desc1));
+#line 23 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();
+#line 23 "desc.pgc"
+
+
+ { ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
+ ECPGt_int,&(val1),(long)1,(long)1,sizeof(int), ECPGd_EODT);
+
+#line 25 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 25 "desc.pgc"
+
+ { ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
+ ECPGt_char,(val2),(long)4,(long)1,(4)*sizeof(char), ECPGd_indicator,
+ ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGd_EODT);
+
+#line 26 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 26 "desc.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 28 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 28 "desc.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test1 ( a int , b text )", ECPGt_EOIT, ECPGt_EORT);
+#line 30 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 30 "desc.pgc"
+
+ { ECPGprepare(__LINE__, NULL, 0, "foo1", stmt1);
+#line 31 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 31 "desc.pgc"
+
+ { ECPGprepare(__LINE__, NULL, 0, "Foo-1", stmt1);
+#line 32 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 32 "desc.pgc"
+
+ { ECPGprepare(__LINE__, NULL, 0, "foo2", stmt2);
+#line 33 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 33 "desc.pgc"
+
+ { ECPGprepare(__LINE__, NULL, 0, "foo3", stmt3);
+#line 34 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 34 "desc.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "foo1",
+ ECPGt_descriptor, "indesc", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 36 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 36 "desc.pgc"
+
+
+ { ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
+ ECPGt_const,"2",(long)1,(long)1,strlen("2"), ECPGd_EODT);
+
+#line 38 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 38 "desc.pgc"
+
+ { ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
+ ECPGt_char,(val2),(long)4,(long)1,(4)*sizeof(char), ECPGd_indicator,
+ ECPGt_int,&(val2null),(long)1,(long)1,sizeof(int), ECPGd_EODT);
+
+#line 39 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 39 "desc.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "foo1",
+ ECPGt_descriptor, "indesc", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 41 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 41 "desc.pgc"
+
+
+ { ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
+ ECPGt_const,"3",(long)1,(long)1,strlen("3"), ECPGd_EODT);
+
+#line 43 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 43 "desc.pgc"
+
+ { ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
+ ECPGt_const,"this is a long test",(long)19,(long)1,strlen("this is a long test"), ECPGd_indicator,
+ ECPGt_int,&(val1),(long)1,(long)1,sizeof(int), ECPGd_EODT);
+
+#line 44 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 44 "desc.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "Foo-1",
+ ECPGt_descriptor, "indesc", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 46 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 46 "desc.pgc"
+
+
+ { ECPGdeallocate(__LINE__, 0, NULL, "Foo-1");
+#line 48 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 48 "desc.pgc"
+
+
+ { ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
+ ECPGt_int,&(val1),(long)1,(long)1,sizeof(int), ECPGd_EODT);
+
+#line 50 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 50 "desc.pgc"
+
+ { ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
+ ECPGt_char,(val2),(long)4,(long)1,(4)*sizeof(char), ECPGd_indicator,
+ ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGd_EODT);
+
+#line 51 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 51 "desc.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "foo2",
+ ECPGt_descriptor, "indesc", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_descriptor, (desc1), 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 53 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 53 "desc.pgc"
+
+
+ { ECPGget_desc(__LINE__, (desc1), 1,ECPGd_data,
+ ECPGt_char,(val2output),(long)sizeof("AAA"),(long)1,(sizeof("AAA"))*sizeof(char), ECPGd_EODT);
+
+#line 55 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 55 "desc.pgc"
+
+ printf("output = %s\n", val2output);
+
+ /* declare c1 cursor for $1 */
+#line 58 "desc.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare c1 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "foo2", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_descriptor, "indesc", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 59 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 59 "desc.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch next from c1", ECPGt_EOIT,
+ ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
+ ECPGt_int,&(ind1),(long)1,(long)1,sizeof(int),
+ ECPGt_char,(val2output),(long)sizeof("AAA"),(long)1,(sizeof("AAA"))*sizeof(char),
+ ECPGt_int,&(ind2),(long)1,(long)1,sizeof(int), ECPGt_EORT);
+#line 61 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 61 "desc.pgc"
+
+ printf("val1=%d (ind1: %d) val2=%s (ind2: %d)\n",
+ val1output, ind1, val2output, ind2);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close c1", ECPGt_EOIT, ECPGt_EORT);
+#line 65 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 65 "desc.pgc"
+
+
+ { ECPGset_desc_header(__LINE__, "indesc", (int)(1));
+
+#line 67 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 67 "desc.pgc"
+
+ { ECPGset_desc(__LINE__, "indesc", 1,ECPGd_data,
+ ECPGt_const,"2",(long)1,(long)1,strlen("2"), ECPGd_EODT);
+
+#line 68 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 68 "desc.pgc"
+
+
+ /* declare c2 cursor for $1 */
+#line 70 "desc.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare c2 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "foo3", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_descriptor, "indesc", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 71 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 71 "desc.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch next from c2", ECPGt_EOIT,
+ ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(val2output),(long)sizeof("AAA"),(long)1,(sizeof("AAA"))*sizeof(char),
+ ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGt_EORT);
+#line 73 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 73 "desc.pgc"
+
+ printf("val1=%d val2=%s\n", val1output, val2i ? "null" : val2output);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close c2", ECPGt_EOIT, ECPGt_EORT);
+#line 76 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 76 "desc.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from test1 where a = 3", ECPGt_EOIT,
+ ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(val2output),(long)sizeof("AAA"),(long)1,(sizeof("AAA"))*sizeof(char),
+ ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGt_EORT);
+#line 78 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 78 "desc.pgc"
+
+ printf("val1=%d val2=%c%c%c%c warn=%c truncate=%d\n", val1output, val2output[0], val2output[1], val2output[2], val2output[3], sqlca.sqlwarn[0], val2i);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test1", ECPGt_EOIT, ECPGt_EORT);
+#line 81 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 81 "desc.pgc"
+
+ { ECPGdeallocate_all(__LINE__, 0, NULL);
+#line 82 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 82 "desc.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 83 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 83 "desc.pgc"
+
+
+ ECPGdeallocate_desc(__LINE__, "indesc");
+#line 85 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();
+#line 85 "desc.pgc"
+
+ ECPGdeallocate_desc(__LINE__, (desc1));
+#line 86 "desc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();
+#line 86 "desc.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-desc.stderr b/src/interfaces/ecpg/test/expected/sql-desc.stderr
new file mode 100644
index 0000000..65e7cea
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-desc.stderr
@@ -0,0 +1,140 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: query: create table test1 ( a int , b text ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 30: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 31: name foo1; query: "INSERT INTO test1 VALUES ($1, $2)"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 32: name Foo-1; query: "INSERT INTO test1 VALUES ($1, $2)"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 33: name foo2; query: "SELECT * from test1 where a = $1 and b = $2"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 34: name foo3; query: "SELECT * from test1 where $1 = a"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: INSERT INTO test1 VALUES ($1, $2); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexecPrepared for "INSERT INTO test1 VALUES ($1, $2)"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 36: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 36: parameter 2 = one
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: query: INSERT INTO test1 VALUES ($1, $2); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: using PQexecPrepared for "INSERT INTO test1 VALUES ($1, $2)"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 41: parameter 1 = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 41: parameter 2 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 41: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: query: INSERT INTO test1 VALUES ($1, $2); with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexecPrepared for "INSERT INTO test1 VALUES ($1, $2)"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 46: parameter 1 = 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 46: parameter 2 = this is a long test
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 48: name Foo-1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: query: SELECT * from test1 where a = $1 and b = $2; with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: using PQexecPrepared for "SELECT * from test1 where a = $1 and b = $2"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 53: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 53: parameter 2 = one
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 53: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 53: putting result (1 tuples) into descriptor outdesc
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 55: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 59: query: declare c1 cursor for SELECT * from test1 where a = $1 and b = $2; with 2 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 59: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 59: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 59: parameter 2 = one
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 59: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 61: query: fetch next from c1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 61: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 61: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 61: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 61: RESULT: one offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 65: query: close c1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 65: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 65: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 71: query: declare c2 cursor for SELECT * from test1 where $1 = a; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 71: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 71: parameter 1 = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 71: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 73: query: fetch next from c2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 73: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 73: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 73: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 73: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 76: query: close c2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 76: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 76: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 78: query: select * from test1 where a = 3; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 78: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 78: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 78: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 78: RESULT: this is a long test offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 81: query: drop table test1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 81: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 81: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 82: name foo3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 82: name foo2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 82: name foo1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-desc.stdout b/src/interfaces/ecpg/test/expected/sql-desc.stdout
new file mode 100644
index 0000000..7d91043
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-desc.stdout
@@ -0,0 +1,4 @@
+output = 1
+val1=1 (ind1: 0) val2=one (ind2: 0)
+val1=2 val2=null
+val1=3 val2=this warn=W truncate=19
diff --git a/src/interfaces/ecpg/test/expected/sql-describe.c b/src/interfaces/ecpg/test/expected/sql-describe.c
new file mode 100644
index 0000000..b79a6f4
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-describe.c
@@ -0,0 +1,465 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "describe.pgc"
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "describe.pgc"
+
+
+#line 1 "sqlda.h"
+#ifndef ECPG_SQLDA_H
+#define ECPG_SQLDA_H
+
+#ifdef _ECPG_INFORMIX_H
+
+#include "sqlda-compat.h"
+typedef struct sqlvar_compat sqlvar_t;
+typedef struct sqlda_compat sqlda_t;
+
+#else
+
+#include "sqlda-native.h"
+typedef struct sqlvar_struct sqlvar_t;
+typedef struct sqlda_struct sqlda_t;
+
+#endif
+
+#endif /* ECPG_SQLDA_H */
+
+#line 5 "describe.pgc"
+
+
+/* exec sql whenever sqlerror stop ; */
+#line 7 "describe.pgc"
+
+
+sqlda_t *sqlda1, *sqlda2, *sqlda3;
+
+int
+main (void)
+{
+/* exec sql begin declare section */
+
+
+
+
+
+
+#line 15 "describe.pgc"
+ char * stmt1 = "SELECT id, t FROM descr_t2" ;
+
+#line 16 "describe.pgc"
+ char * stmt2 = "SELECT id, t FROM descr_t2 WHERE id = -1" ;
+
+#line 17 "describe.pgc"
+ int i , count1 , count2 ;
+
+#line 18 "describe.pgc"
+ char field_name1 [ 30 ] = "not set" ;
+
+#line 19 "describe.pgc"
+ char field_name2 [ 30 ] = "not set" ;
+/* exec sql end declare section */
+#line 20 "describe.pgc"
+
+
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 27 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 27 "describe.pgc"
+
+
+ strcpy(msg, "set");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+#line 30 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 30 "describe.pgc"
+
+
+ strcpy(msg, "create");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table descr_t2 ( id serial primary key , t text )", ECPGt_EOIT, ECPGt_EORT);
+#line 33 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 33 "describe.pgc"
+
+
+ strcpy(msg, "insert");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into descr_t2 ( id , t ) values ( default , 'a' )", ECPGt_EOIT, ECPGt_EORT);
+#line 36 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 36 "describe.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into descr_t2 ( id , t ) values ( default , 'b' )", ECPGt_EOIT, ECPGt_EORT);
+#line 37 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 37 "describe.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into descr_t2 ( id , t ) values ( default , 'c' )", ECPGt_EOIT, ECPGt_EORT);
+#line 38 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 38 "describe.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into descr_t2 ( id , t ) values ( default , 'd' )", ECPGt_EOIT, ECPGt_EORT);
+#line 39 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 39 "describe.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 42 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 42 "describe.pgc"
+
+
+ /*
+ * Test DESCRIBE with a query producing tuples.
+ * DESCRIPTOR and SQL DESCRIPTOR are NOT the same in
+ * Informix-compat mode.
+ */
+
+ strcpy(msg, "allocate");
+ ECPGallocate_desc(__LINE__, "desc1");
+#line 51 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 51 "describe.pgc"
+
+ ECPGallocate_desc(__LINE__, "desc2");
+#line 52 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 52 "describe.pgc"
+
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, NULL, 0, "st_id1", stmt1);
+#line 55 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 55 "describe.pgc"
+
+
+ sqlda1 = sqlda2 = sqlda3 = NULL;
+
+ strcpy(msg, "describe");
+ { ECPGdescribe(__LINE__, 0, 0, NULL, "st_id1",
+ ECPGt_descriptor, "desc1", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 60 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 0, 0, NULL, "st_id1",
+ ECPGt_descriptor, "desc2", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 61 "describe.pgc"
+
+
+ { ECPGdescribe(__LINE__, 0, 0, NULL, "st_id1",
+ ECPGt_sqlda, &sqlda1, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 63 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 0, 0, NULL, "st_id1",
+ ECPGt_sqlda, &sqlda2, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 64 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 0, 0, NULL, "st_id1",
+ ECPGt_sqlda, &sqlda3, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 65 "describe.pgc"
+
+
+ if (sqlda1 == NULL)
+ {
+ printf("sqlda1 NULL\n");
+ exit(1);
+ }
+
+ if (sqlda2 == NULL)
+ {
+ printf("sqlda2 NULL\n");
+ exit(1);
+ }
+
+ if (sqlda3 == NULL)
+ {
+ printf("sqlda3 NULL\n");
+ exit(1);
+ }
+
+ strcpy(msg, "get descriptor");
+ { ECPGget_desc_header(__LINE__, "desc1", &(count1));
+
+#line 86 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 86 "describe.pgc"
+
+ { ECPGget_desc_header(__LINE__, "desc1", &(count2));
+
+#line 87 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 87 "describe.pgc"
+
+
+ if (count1 != count2)
+ {
+ printf("count1 (%d) != count2 (%d)\n", count1, count2);
+ exit(1);
+ }
+
+ if (count1 != sqlda1->sqld)
+ {
+ printf("count1 (%d) != sqlda1->sqld (%d)\n", count1, sqlda1->sqld);
+ exit(1);
+ }
+
+ if (count1 != sqlda2->sqld)
+ {
+ printf("count1 (%d) != sqlda2->sqld (%d)\n", count1, sqlda2->sqld);
+ exit(1);
+ }
+
+ if (count1 != sqlda3->sqld)
+ {
+ printf("count1 (%d) != sqlda3->sqld (%d)\n", count1, sqlda3->sqld);
+ exit(1);
+ }
+
+ for (i = 1; i <= count1; i++)
+ {
+ { ECPGget_desc(__LINE__, "desc1", i,ECPGd_name,
+ ECPGt_char,(field_name1),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 115 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 115 "describe.pgc"
+
+ { ECPGget_desc(__LINE__, "desc2", i,ECPGd_name,
+ ECPGt_char,(field_name2),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 116 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 116 "describe.pgc"
+
+ printf("%d\n\tfield_name1 '%s'\n\tfield_name2 '%s'\n\t"
+ "sqlda1 '%s'\n\tsqlda2 '%s'\n\tsqlda3 '%s'\n",
+ i, field_name1, field_name2,
+ sqlda1->sqlvar[i-1].sqlname.data,
+ sqlda2->sqlvar[i-1].sqlname.data,
+ sqlda3->sqlvar[i-1].sqlname.data);
+ }
+
+ strcpy(msg, "deallocate");
+ ECPGdeallocate_desc(__LINE__, "desc1");
+#line 126 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 126 "describe.pgc"
+
+ ECPGdeallocate_desc(__LINE__, "desc2");
+#line 127 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 127 "describe.pgc"
+
+ free(sqlda1);
+ free(sqlda2);
+ free(sqlda3);
+
+ { ECPGdeallocate(__LINE__, 0, NULL, "st_id1");
+#line 132 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 132 "describe.pgc"
+
+
+ /* Test DESCRIBE with a query not producing tuples */
+
+ strcpy(msg, "allocate");
+ ECPGallocate_desc(__LINE__, "desc1");
+#line 137 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 137 "describe.pgc"
+
+ ECPGallocate_desc(__LINE__, "desc2");
+#line 138 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 138 "describe.pgc"
+
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, NULL, 0, "st_id2", stmt2);
+#line 141 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 141 "describe.pgc"
+
+
+ sqlda1 = sqlda2 = sqlda3 = NULL;
+
+ strcpy(msg, "describe");
+ { ECPGdescribe(__LINE__, 0, 0, NULL, "st_id2",
+ ECPGt_descriptor, "desc1", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 146 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 0, 0, NULL, "st_id2",
+ ECPGt_descriptor, "desc2", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 147 "describe.pgc"
+
+
+ { ECPGdescribe(__LINE__, 0, 0, NULL, "st_id2",
+ ECPGt_sqlda, &sqlda1, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 149 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 0, 0, NULL, "st_id2",
+ ECPGt_sqlda, &sqlda2, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 150 "describe.pgc"
+
+ { ECPGdescribe(__LINE__, 0, 0, NULL, "st_id2",
+ ECPGt_sqlda, &sqlda3, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 151 "describe.pgc"
+
+
+ if (sqlda1 == NULL || sqlda2 == NULL || sqlda3 == NULL)
+ exit(1);
+
+ strcpy(msg, "get descriptor");
+ { ECPGget_desc_header(__LINE__, "desc1", &(count1));
+
+#line 157 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 157 "describe.pgc"
+
+ { ECPGget_desc_header(__LINE__, "desc1", &(count2));
+
+#line 158 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 158 "describe.pgc"
+
+
+ if (!( count1 == count2 &&
+ count1 == sqlda1->sqld &&
+ count1 == sqlda2->sqld &&
+ count1 == sqlda3->sqld))
+ exit(1);
+
+ for (i = 1; i <= count1; i++)
+ {
+ { ECPGget_desc(__LINE__, "desc1", i,ECPGd_name,
+ ECPGt_char,(field_name1),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 168 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 168 "describe.pgc"
+
+ { ECPGget_desc(__LINE__, "desc2", i,ECPGd_name,
+ ECPGt_char,(field_name2),(long)30,(long)1,(30)*sizeof(char), ECPGd_EODT);
+
+#line 169 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 169 "describe.pgc"
+
+ printf("%d\n\tfield_name1 '%s'\n\tfield_name2 '%s'\n\t"
+ "sqlda1 '%s'\n\tsqlda2 '%s'\n\tsqlda3 '%s'\n",
+ i, field_name1, field_name2,
+ sqlda1->sqlvar[i-1].sqlname.data,
+ sqlda2->sqlvar[i-1].sqlname.data,
+ sqlda3->sqlvar[i-1].sqlname.data);
+ }
+
+ strcpy(msg, "deallocate");
+ ECPGdeallocate_desc(__LINE__, "desc1");
+#line 179 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 179 "describe.pgc"
+
+ ECPGdeallocate_desc(__LINE__, "desc2");
+#line 180 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);
+#line 180 "describe.pgc"
+
+ free(sqlda1);
+ free(sqlda2);
+ free(sqlda3);
+
+ { ECPGdeallocate(__LINE__, 0, NULL, "st_id2");
+#line 185 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 185 "describe.pgc"
+
+
+ /* End test */
+
+ strcpy(msg, "drop");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table descr_t2", ECPGt_EOIT, ECPGt_EORT);
+#line 190 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 190 "describe.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 193 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 193 "describe.pgc"
+
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 196 "describe.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 196 "describe.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-describe.stderr b/src/interfaces/ecpg/test/expected/sql-describe.stderr
new file mode 100644
index 0000000..4b9c5a9
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-describe.stderr
@@ -0,0 +1,112 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: query: set datestyle to iso; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 30: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: query: create table descr_t2 ( id serial primary key , t text ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 33: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: insert into descr_t2 ( id , t ) values ( default , 'a' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: query: insert into descr_t2 ( id , t ) values ( default , 'b' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 37: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: query: insert into descr_t2 ( id , t ) values ( default , 'c' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 38: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: query: insert into descr_t2 ( id , t ) values ( default , 'd' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 39: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 42: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 55: name st_id1; query: "SELECT id, t FROM descr_t2"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 63 sqld = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 64 sqld = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 65 sqld = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 132: name st_id1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 141: name st_id2; query: "SELECT id, t FROM descr_t2 WHERE id = -1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 149 sqld = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 150 sqld = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 151 sqld = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = id
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = t
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 185: name st_id2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 190: query: drop table descr_t2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 190: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 190: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 193: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-describe.stdout b/src/interfaces/ecpg/test/expected/sql-describe.stdout
new file mode 100644
index 0000000..1e3fe10
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-describe.stdout
@@ -0,0 +1,24 @@
+1
+ field_name1 'id'
+ field_name2 'id'
+ sqlda1 'id'
+ sqlda2 'id'
+ sqlda3 'id'
+2
+ field_name1 't'
+ field_name2 't'
+ sqlda1 't'
+ sqlda2 't'
+ sqlda3 't'
+1
+ field_name1 'id'
+ field_name2 'id'
+ sqlda1 'id'
+ sqlda2 'id'
+ sqlda3 'id'
+2
+ field_name1 't'
+ field_name2 't'
+ sqlda1 't'
+ sqlda2 't'
+ sqlda3 't'
diff --git a/src/interfaces/ecpg/test/expected/sql-dynalloc.c b/src/interfaces/ecpg/test/expected/sql-dynalloc.c
new file mode 100644
index 0000000..a95dddf
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-dynalloc.c
@@ -0,0 +1,340 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "dynalloc.pgc"
+#include <stdio.h>
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 2 "dynalloc.pgc"
+
+#include <stdlib.h>
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "dynalloc.pgc"
+
+
+int main(void)
+{
+ /* exec sql begin declare section */
+
+
+
+
+
+
+
+/* char **d8=0; */
+
+
+
+
+
+
+
+
+/* int *i8=0; */
+
+
+#line 9 "dynalloc.pgc"
+ int * d1 = 0 ;
+
+#line 10 "dynalloc.pgc"
+ double * d2 = 0 ;
+
+#line 11 "dynalloc.pgc"
+ char ** d3 = 0 ;
+
+#line 12 "dynalloc.pgc"
+ char ** d4 = 0 ;
+
+#line 13 "dynalloc.pgc"
+ char ** d5 = 0 ;
+
+#line 14 "dynalloc.pgc"
+ char ** d6 = 0 ;
+
+#line 15 "dynalloc.pgc"
+ char ** d7 = 0 ;
+
+#line 17 "dynalloc.pgc"
+ char ** d9 = 0 ;
+
+#line 18 "dynalloc.pgc"
+ int * i1 = 0 ;
+
+#line 19 "dynalloc.pgc"
+ int * i2 = 0 ;
+
+#line 20 "dynalloc.pgc"
+ int * i3 = 0 ;
+
+#line 21 "dynalloc.pgc"
+ int * i4 = 0 ;
+
+#line 22 "dynalloc.pgc"
+ int * i5 = 0 ;
+
+#line 23 "dynalloc.pgc"
+ int * i6 = 0 ;
+
+#line 24 "dynalloc.pgc"
+ int * i7 = 0 ;
+
+#line 26 "dynalloc.pgc"
+ int * i9 = 0 ;
+/* exec sql end declare section */
+#line 27 "dynalloc.pgc"
+
+ int i;
+
+ ECPGdebug(1, stderr);
+
+ /* exec sql whenever sqlerror do sqlprint ( ) ; */
+#line 32 "dynalloc.pgc"
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 33 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 33 "dynalloc.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to mdy", ECPGt_EOIT, ECPGt_EORT);
+#line 35 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 35 "dynalloc.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( a serial , b numeric ( 12 , 3 ) , c varchar , d varchar ( 3 ) , e char ( 4 ) , f timestamptz , g boolean , h box , i inet )", ECPGt_EOIT, ECPGt_EORT);
+#line 37 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 37 "dynalloc.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test ( b , c , d , e , f , g , h , i ) values ( 23.456 , 'varchar' , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , true , '(1,2,3,4)' , '2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128' )", ECPGt_EOIT, ECPGt_EORT);
+#line 38 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 38 "dynalloc.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test ( b , c , d , e , f , g , h , i ) values ( 2.446456 , null , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , false , null , null )", ECPGt_EOIT, ECPGt_EORT);
+#line 39 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 39 "dynalloc.pgc"
+
+
+ ECPGallocate_desc(__LINE__, "mydesc");
+#line 41 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );
+#line 41 "dynalloc.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select a , b , c , d , e , f , g , h , i from test order by a", ECPGt_EOIT,
+ ECPGt_descriptor, "mydesc", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 42 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 42 "dynalloc.pgc"
+
+ { ECPGget_desc(__LINE__, "mydesc", 1,ECPGd_indicator,
+ ECPGt_int,&(i1),(long)1,(long)0,sizeof(int), ECPGd_data,
+ ECPGt_int,&(d1),(long)1,(long)0,sizeof(int), ECPGd_EODT);
+
+#line 43 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 43 "dynalloc.pgc"
+
+ { ECPGget_desc(__LINE__, "mydesc", 2,ECPGd_indicator,
+ ECPGt_int,&(i2),(long)1,(long)0,sizeof(int), ECPGd_data,
+ ECPGt_double,&(d2),(long)1,(long)0,sizeof(double), ECPGd_EODT);
+
+#line 44 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 44 "dynalloc.pgc"
+
+ { ECPGget_desc(__LINE__, "mydesc", 3,ECPGd_indicator,
+ ECPGt_int,&(i3),(long)1,(long)0,sizeof(int), ECPGd_data,
+ ECPGt_char,&(d3),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
+
+#line 45 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 45 "dynalloc.pgc"
+
+ { ECPGget_desc(__LINE__, "mydesc", 4,ECPGd_indicator,
+ ECPGt_int,&(i4),(long)1,(long)0,sizeof(int), ECPGd_data,
+ ECPGt_char,&(d4),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
+
+#line 46 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 46 "dynalloc.pgc"
+
+ { ECPGget_desc(__LINE__, "mydesc", 5,ECPGd_indicator,
+ ECPGt_int,&(i5),(long)1,(long)0,sizeof(int), ECPGd_data,
+ ECPGt_char,&(d5),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
+
+#line 47 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 47 "dynalloc.pgc"
+
+ { ECPGget_desc(__LINE__, "mydesc", 6,ECPGd_indicator,
+ ECPGt_int,&(i6),(long)1,(long)0,sizeof(int), ECPGd_data,
+ ECPGt_char,&(d6),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
+
+#line 48 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 48 "dynalloc.pgc"
+
+ { ECPGget_desc(__LINE__, "mydesc", 7,ECPGd_indicator,
+ ECPGt_int,&(i7),(long)1,(long)0,sizeof(int), ECPGd_data,
+ ECPGt_char,&(d7),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
+
+#line 49 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 49 "dynalloc.pgc"
+
+ /* skip box for now */
+ /* exec sql get descriptor mydesc value 8 :d8=DATA, :i8=INDICATOR; */
+ { ECPGget_desc(__LINE__, "mydesc", 9,ECPGd_indicator,
+ ECPGt_int,&(i9),(long)1,(long)0,sizeof(int), ECPGd_data,
+ ECPGt_char,&(d9),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
+
+#line 52 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 52 "dynalloc.pgc"
+
+
+ printf("Result:\n");
+ for (i=0;i<sqlca.sqlerrd[2];++i)
+ {
+ if (i1[i]) printf("NULL, ");
+ else printf("%d, ",d1[i]);
+
+ if (i2[i]) printf("NULL, ");
+ else printf("%f, ",d2[i]);
+
+ if (i3[i]) printf("NULL, ");
+ else printf("'%s', ",d3[i]);
+
+ if (i4[i]) printf("NULL, ");
+ else printf("'%s', ",d4[i]);
+
+ if (i5[i]) printf("NULL, ");
+ else printf("'%s', ",d5[i]);
+
+ if (i6[i]) printf("NULL, ");
+ else printf("'%s', ",d6[i]);
+
+ if (i7[i]) printf("NULL, ");
+ else printf("'%s', ",d7[i]);
+
+ if (i9[i]) printf("NULL, ");
+ else printf("'%s', ",d9[i]);
+
+ printf("\n");
+ }
+ ECPGfree_auto_mem();
+ printf("\n");
+
+ ECPGdeallocate_desc(__LINE__, "mydesc");
+#line 86 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );
+#line 86 "dynalloc.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 87 "dynalloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 87 "dynalloc.pgc"
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-dynalloc.stderr b/src/interfaces/ecpg/test/expected/sql-dynalloc.stderr
new file mode 100644
index 0000000..58a0b9e
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-dynalloc.stderr
@@ -0,0 +1,102 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: query: set datestyle to mdy; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 35: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: query: create table test ( a serial , b numeric ( 12 , 3 ) , c varchar , d varchar ( 3 ) , e char ( 4 ) , f timestamptz , g boolean , h box , i inet ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 37: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: query: insert into test ( b , c , d , e , f , g , h , i ) values ( 23.456 , 'varchar' , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , true , '(1,2,3,4)' , '2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 38: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: query: insert into test ( b , c , d , e , f , g , h , i ) values ( 2.446456 , null , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , false , null , null ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 39: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: query: select a , b , c , d , e , f , g , h , i from test order by a; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 42: correctly got 2 tuples with 9 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 42: putting result (2 tuples) into descriptor mydesc
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 43: allocating memory for 2 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 43: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 43: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 44: allocating memory for 2 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 44: RESULT: 23.456 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 44: RESULT: 2.446 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 45: allocating memory for 2 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 45: RESULT: varchar offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 45: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 46: allocating memory for 2 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: v offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 46: RESULT: v offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 47: allocating memory for 2 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 47: RESULT: c offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 47: RESULT: c offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 48: allocating memory for 2 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: Mon Mar 03 11:33:07 2003 PST offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: Mon Mar 03 11:33:07 2003 PST offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 49: allocating memory for 2 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 49: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 49: RESULT: f offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 9
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 52: allocating memory for 2 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 52: RESULT: 2001:4f8:3:ba:2e0:81ff:fe22:d1f1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 52: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-dynalloc.stdout b/src/interfaces/ecpg/test/expected/sql-dynalloc.stdout
new file mode 100644
index 0000000..5c212c8
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-dynalloc.stdout
@@ -0,0 +1,4 @@
+Result:
+1, 23.456000, 'varchar', 'v', 'c ', 'Mon Mar 03 11:33:07 2003 PST', 't', '2001:4f8:3:ba:2e0:81ff:fe22:d1f1',
+2, 2.446000, NULL, 'v', 'c ', 'Mon Mar 03 11:33:07 2003 PST', 'f', NULL,
+
diff --git a/src/interfaces/ecpg/test/expected/sql-dynalloc2.c b/src/interfaces/ecpg/test/expected/sql-dynalloc2.c
new file mode 100644
index 0000000..7118577
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-dynalloc2.c
@@ -0,0 +1,256 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "dynalloc2.pgc"
+#include <stdio.h>
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 2 "dynalloc2.pgc"
+
+#include <stdlib.h>
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "dynalloc2.pgc"
+
+
+int main(void)
+{
+ /* exec sql begin declare section */
+
+
+
+
+
+
+#line 9 "dynalloc2.pgc"
+ int * ip1 = 0 ;
+
+#line 10 "dynalloc2.pgc"
+ char ** cp2 = 0 ;
+
+#line 11 "dynalloc2.pgc"
+ int * ipointer1 = 0 ;
+
+#line 12 "dynalloc2.pgc"
+ int * ipointer2 = 0 ;
+
+#line 13 "dynalloc2.pgc"
+ int colnum ;
+/* exec sql end declare section */
+#line 14 "dynalloc2.pgc"
+
+ int i;
+
+ ECPGdebug(1, stderr);
+
+ /* exec sql whenever sqlerror do sqlprint ( ) ; */
+#line 19 "dynalloc2.pgc"
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 20 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 20 "dynalloc2.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to postgres", ECPGt_EOIT, ECPGt_EORT);
+#line 22 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 22 "dynalloc2.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( a int , b text )", ECPGt_EOIT, ECPGt_EORT);
+#line 24 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 24 "dynalloc2.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( 1 , 'one' )", ECPGt_EOIT, ECPGt_EORT);
+#line 25 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 25 "dynalloc2.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( 2 , 'two' )", ECPGt_EOIT, ECPGt_EORT);
+#line 26 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 26 "dynalloc2.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( null , 'three' )", ECPGt_EOIT, ECPGt_EORT);
+#line 27 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 27 "dynalloc2.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( 4 , 'four' )", ECPGt_EOIT, ECPGt_EORT);
+#line 28 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 28 "dynalloc2.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( 5 , null )", ECPGt_EOIT, ECPGt_EORT);
+#line 29 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 29 "dynalloc2.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( null , null )", ECPGt_EOIT, ECPGt_EORT);
+#line 30 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 30 "dynalloc2.pgc"
+
+
+ ECPGallocate_desc(__LINE__, "mydesc");
+#line 32 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );
+#line 32 "dynalloc2.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from test", ECPGt_EOIT,
+ ECPGt_descriptor, "mydesc", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 33 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 33 "dynalloc2.pgc"
+
+ { ECPGget_desc_header(__LINE__, "mydesc", &(colnum));
+
+#line 34 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 34 "dynalloc2.pgc"
+
+ { ECPGget_desc(__LINE__, "mydesc", 1,ECPGd_indicator,
+ ECPGt_int,&(ipointer1),(long)1,(long)0,sizeof(int), ECPGd_data,
+ ECPGt_int,&(ip1),(long)1,(long)0,sizeof(int), ECPGd_EODT);
+
+#line 35 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 35 "dynalloc2.pgc"
+
+ { ECPGget_desc(__LINE__, "mydesc", 2,ECPGd_indicator,
+ ECPGt_int,&(ipointer2),(long)1,(long)0,sizeof(int), ECPGd_data,
+ ECPGt_char,&(cp2),(long)0,(long)0,(1)*sizeof(char), ECPGd_EODT);
+
+#line 36 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 36 "dynalloc2.pgc"
+
+
+ printf("Result (%d columns):\n", colnum);
+ for (i=0;i < sqlca.sqlerrd[2];++i)
+ {
+ if (ipointer1[i]) printf("NULL, ");
+ else printf("%d, ",ip1[i]);
+
+ if (ipointer2[i]) printf("NULL, ");
+ else printf("'%s', ",cp2[i]);
+ printf("\n");
+ }
+ ECPGfree_auto_mem();
+ printf("\n");
+
+ ECPGdeallocate_desc(__LINE__, "mydesc");
+#line 51 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );
+#line 51 "dynalloc2.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 52 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 52 "dynalloc2.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 53 "dynalloc2.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint ( );}
+#line 53 "dynalloc2.pgc"
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-dynalloc2.stderr b/src/interfaces/ecpg/test/expected/sql-dynalloc2.stderr
new file mode 100644
index 0000000..1c64948
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-dynalloc2.stderr
@@ -0,0 +1,98 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 22: query: set datestyle to postgres; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 22: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 22: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: query: create table test ( a int , b text ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 24: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: query: insert into test values ( 1 , 'one' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 25: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: insert into test values ( 2 , 'two' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 27: query: insert into test values ( null , 'three' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 27: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 27: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: query: insert into test values ( 4 , 'four' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 28: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: query: insert into test values ( 5 , null ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 29: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: query: insert into test values ( null , null ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 30: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: query: select * from test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 33: correctly got 6 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 33: putting result (6 tuples) into descriptor mydesc
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 2 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 35: allocating memory for 6 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 35: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 35: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 35: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 35: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 35: RESULT: 5 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 35: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 36: allocating memory for 6 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 36: RESULT: one offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 36: RESULT: two offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 36: RESULT: three offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 36: RESULT: four offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 36: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 36: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 52: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-dynalloc2.stdout b/src/interfaces/ecpg/test/expected/sql-dynalloc2.stdout
new file mode 100644
index 0000000..87be3ac
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-dynalloc2.stdout
@@ -0,0 +1,8 @@
+Result (2 columns):
+1, 'one',
+2, 'two',
+NULL, 'three',
+4, 'four',
+5, NULL,
+NULL, NULL,
+
diff --git a/src/interfaces/ecpg/test/expected/sql-dyntest.c b/src/interfaces/ecpg/test/expected/sql-dyntest.c
new file mode 100644
index 0000000..513d44c
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-dyntest.c
@@ -0,0 +1,486 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "dyntest.pgc"
+/* dynamic SQL test program
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+#line 1 "sql3types.h"
+#ifndef _ECPG_SQL3TYPES_H
+#define _ECPG_SQL3TYPES_H
+
+/* SQL3 dynamic type codes */
+
+/* chapter 13.1 table 2: Codes used for SQL data types in Dynamic SQL */
+
+enum
+{
+ SQL3_CHARACTER = 1,
+ SQL3_NUMERIC,
+ SQL3_DECIMAL,
+ SQL3_INTEGER,
+ SQL3_SMALLINT,
+ SQL3_FLOAT,
+ SQL3_REAL,
+ SQL3_DOUBLE_PRECISION,
+ SQL3_DATE_TIME_TIMESTAMP,
+ SQL3_INTERVAL, /* 10 */
+ SQL3_CHARACTER_VARYING = 12,
+ SQL3_ENUMERATED,
+ SQL3_BIT,
+ SQL3_BIT_VARYING,
+ SQL3_BOOLEAN,
+ SQL3_abstract
+ /* the rest is xLOB stuff */
+};
+
+/* chapter 13.1 table 3: Codes associated with datetime data types in Dynamic SQL */
+
+enum
+{
+ SQL3_DDT_DATE = 1,
+ SQL3_DDT_TIME,
+ SQL3_DDT_TIMESTAMP,
+ SQL3_DDT_TIME_WITH_TIME_ZONE,
+ SQL3_DDT_TIMESTAMP_WITH_TIME_ZONE,
+
+ SQL3_DDT_ILLEGAL /* not a datetime data type (not part of
+ * standard) */
+};
+
+#endif /* !_ECPG_SQL3TYPES_H */
+
+#line 7 "dyntest.pgc"
+
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 8 "dyntest.pgc"
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 9 "dyntest.pgc"
+
+
+static void
+error (void)
+{
+ printf ("\n#%ld:%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
+ exit (1);
+}
+
+int
+main ()
+{
+ /* exec sql begin declare section */
+
+
+
+
+
+
+
+
+
+
+
+#line 22 "dyntest.pgc"
+ int COUNT ;
+
+#line 23 "dyntest.pgc"
+ int INTVAR ;
+
+#line 24 "dyntest.pgc"
+ int INDEX ;
+
+#line 25 "dyntest.pgc"
+ int INDICATOR ;
+
+#line 26 "dyntest.pgc"
+ int TYPE , LENGTH , OCTET_LENGTH , PRECISION , SCALE , RETURNED_OCTET_LENGTH ;
+
+#line 27 "dyntest.pgc"
+ int DATETIME_INTERVAL_CODE ;
+
+#line 28 "dyntest.pgc"
+ char NAME [ 120 ] , BOOLVAR ;
+
+#line 29 "dyntest.pgc"
+ char STRINGVAR [ 1024 ] ;
+
+#line 30 "dyntest.pgc"
+ double DOUBLEVAR ;
+
+#line 31 "dyntest.pgc"
+ char * QUERY ;
+/* exec sql end declare section */
+#line 32 "dyntest.pgc"
+
+ int done = 0;
+
+ /* exec sql var BOOLVAR is bool */
+#line 35 "dyntest.pgc"
+
+
+ ECPGdebug (1, stderr);
+
+ QUERY = "select * from dyntest";
+
+ /* exec sql whenever sqlerror do error ( ) ; */
+#line 43 "dyntest.pgc"
+
+
+ ECPGallocate_desc(__LINE__, "MYDESC");
+#line 45 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );
+#line 45 "dyntest.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 47 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 47 "dyntest.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to german", ECPGt_EOIT, ECPGt_EORT);
+#line 49 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 49 "dyntest.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table dyntest ( name char ( 14 ) , d float8 , i int , bignumber int8 , b boolean , comment text , day date )", ECPGt_EOIT, ECPGt_EORT);
+#line 53 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 53 "dyntest.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into dyntest values ( 'first entry' , 14.7 , 14 , 123045607890 , true , 'The world''s most advanced open source database.' , '1987-07-14' )", ECPGt_EOIT, ECPGt_EORT);
+#line 54 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 54 "dyntest.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into dyntest values ( 'second entry' , 1407.87 , 1407 , 987065403210 , false , 'The elephant never forgets.' , '1999-11-5' )", ECPGt_EOIT, ECPGt_EORT);
+#line 55 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 55 "dyntest.pgc"
+
+
+ { ECPGprepare(__LINE__, NULL, 0, "myquery", QUERY);
+#line 57 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 57 "dyntest.pgc"
+
+ /* declare MYCURS cursor for $1 */
+#line 58 "dyntest.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare MYCURS cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "myquery", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 60 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 60 "dyntest.pgc"
+
+
+ while (1)
+ {
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch in MYCURS", ECPGt_EOIT,
+ ECPGt_descriptor, "MYDESC", 1L, 1L, 1L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 64 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 64 "dyntest.pgc"
+
+
+ if (sqlca.sqlcode)
+ break;
+
+ { ECPGget_desc_header(__LINE__, "MYDESC", &(COUNT));
+
+#line 69 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 69 "dyntest.pgc"
+
+ if (!done)
+ {
+ printf ("Found %d columns\n", COUNT);
+ done = 1;
+ }
+
+ for (INDEX = 1; INDEX <= COUNT; ++INDEX)
+ {
+ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_indicator,
+ ECPGt_int,&(INDICATOR),(long)1,(long)1,sizeof(int), ECPGd_name,
+ ECPGt_char,(NAME),(long)120,(long)1,(120)*sizeof(char), ECPGd_scale,
+ ECPGt_int,&(SCALE),(long)1,(long)1,sizeof(int), ECPGd_precision,
+ ECPGt_int,&(PRECISION),(long)1,(long)1,sizeof(int), ECPGd_ret_octet,
+ ECPGt_int,&(RETURNED_OCTET_LENGTH),(long)1,(long)1,sizeof(int), ECPGd_octet,
+ ECPGt_int,&(OCTET_LENGTH),(long)1,(long)1,sizeof(int), ECPGd_length,
+ ECPGt_int,&(LENGTH),(long)1,(long)1,sizeof(int), ECPGd_type,
+ ECPGt_int,&(TYPE),(long)1,(long)1,sizeof(int), ECPGd_EODT);
+
+#line 86 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 86 "dyntest.pgc"
+
+ printf ("%2d\t%s (type: %d length: %d precision: %d scale: %d = " , INDEX, NAME, TYPE, LENGTH, PRECISION, SCALE);
+ switch (TYPE)
+ {
+ case SQL3_BOOLEAN:
+ printf ("bool");
+ break;
+ case SQL3_NUMERIC:
+ printf ("numeric(%d,%d)", PRECISION, SCALE);
+ break;
+ case SQL3_DECIMAL:
+ printf ("decimal(%d,%d)", PRECISION, SCALE);
+ break;
+ case SQL3_INTEGER:
+ printf ("integer");
+ break;
+ case SQL3_SMALLINT:
+ printf ("smallint");
+ break;
+ case SQL3_FLOAT:
+ printf ("float(%d,%d)", PRECISION, SCALE);
+ break;
+ case SQL3_REAL:
+ printf ("real");
+ break;
+ case SQL3_DOUBLE_PRECISION:
+ printf ("double precision");
+ break;
+ case SQL3_DATE_TIME_TIMESTAMP:
+ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_di_code,
+ ECPGt_int,&(DATETIME_INTERVAL_CODE),(long)1,(long)1,sizeof(int), ECPGd_EODT);
+
+#line 116 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 116 "dyntest.pgc"
+
+ switch (DATETIME_INTERVAL_CODE)
+ {
+ case SQL3_DDT_DATE:
+ printf ("date");
+ break;
+ case SQL3_DDT_TIME:
+ printf ("time");
+ break;
+ case SQL3_DDT_TIMESTAMP:
+ printf ("timestamp");
+ break;
+ case SQL3_DDT_TIME_WITH_TIME_ZONE:
+ printf ("time with time zone");
+ break;
+ case SQL3_DDT_TIMESTAMP_WITH_TIME_ZONE:
+ printf ("timestamp with time zone");
+ break;
+ }
+ break;
+ case SQL3_INTERVAL:
+ printf ("interval");
+ break;
+ case SQL3_CHARACTER:
+ if (LENGTH > 0)
+ printf ("char(%d)", LENGTH);
+ else
+ printf ("text");
+ break;
+ case SQL3_CHARACTER_VARYING:
+ if (LENGTH > 0)
+ printf ("varchar(%d)", LENGTH);
+ else
+ printf ("varchar()");
+ break;
+ default:
+ printf ("<SQL3 %d>", TYPE);
+ break;
+ }
+ printf (")\n\toctet_length: %d returned_octet_length: %d)\n\t= ",
+ OCTET_LENGTH, RETURNED_OCTET_LENGTH);
+ if (INDICATOR == -1)
+ printf ("NULL\n");
+ else
+ switch (TYPE)
+ {
+ case SQL3_BOOLEAN:
+ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
+ ECPGt_bool,&(BOOLVAR),(long)1,(long)1,sizeof(bool), ECPGd_EODT);
+
+#line 163 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 163 "dyntest.pgc"
+
+ printf ("%s\n", BOOLVAR ? "true" : "false");
+ break;
+ case SQL3_INTEGER:
+ case SQL3_SMALLINT:
+ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
+ ECPGt_int,&(INTVAR),(long)1,(long)1,sizeof(int), ECPGd_EODT);
+
+#line 168 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 168 "dyntest.pgc"
+
+ printf ("%d\n", INTVAR);
+ break;
+ case SQL3_DOUBLE_PRECISION:
+ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
+ ECPGt_double,&(DOUBLEVAR),(long)1,(long)1,sizeof(double), ECPGd_EODT);
+
+#line 172 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 172 "dyntest.pgc"
+
+ printf ("%.*f\n", PRECISION, DOUBLEVAR);
+ break;
+ case SQL3_DATE_TIME_TIMESTAMP:
+ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
+ ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_di_code,
+ ECPGt_int,&(DATETIME_INTERVAL_CODE),(long)1,(long)1,sizeof(int), ECPGd_EODT);
+
+#line 178 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 178 "dyntest.pgc"
+
+ printf ("%d \"%s\"\n", DATETIME_INTERVAL_CODE, STRINGVAR);
+ break;
+ case SQL3_CHARACTER:
+ case SQL3_CHARACTER_VARYING:
+ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
+ ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);
+
+#line 183 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 183 "dyntest.pgc"
+
+ printf ("\"%s\"\n", STRINGVAR);
+ break;
+ default:
+ { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
+ ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);
+
+#line 187 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 187 "dyntest.pgc"
+
+ printf ("<\"%s\">\n", STRINGVAR);
+ break;
+ }
+ }
+ }
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close MYCURS", ECPGt_EOIT, ECPGt_EORT);
+#line 194 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );}
+#line 194 "dyntest.pgc"
+
+
+ ECPGdeallocate_desc(__LINE__, "MYDESC");
+#line 196 "dyntest.pgc"
+
+if (sqlca.sqlcode < 0) error ( );
+#line 196 "dyntest.pgc"
+
+
+ return 0;
+ }
diff --git a/src/interfaces/ecpg/test/expected/sql-dyntest.stderr b/src/interfaces/ecpg/test/expected/sql-dyntest.stderr
new file mode 100644
index 0000000..f0b21b0
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-dyntest.stderr
@@ -0,0 +1,390 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 49: query: set datestyle to german; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 49: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 49: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: query: create table dyntest ( name char ( 14 ) , d float8 , i int , bignumber int8 , b boolean , comment text , day date ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 51: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 54: query: insert into dyntest values ( 'first entry' , 14.7 , 14 , 123045607890 , true , 'The world''s most advanced open source database.' , '1987-07-14' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 54: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 54: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: query: insert into dyntest values ( 'second entry' , 1407.87 , 1407 , 987065403210 , false , 'The elephant never forgets.' , '1999-11-5' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 55: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 57: name myquery; query: "select * from dyntest"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 60: query: declare MYCURS cursor for select * from dyntest; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 60: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 60: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 64: query: fetch in MYCURS; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 64: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 64: correctly got 1 tuples with 7 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 64: putting result (1 tuples) into descriptor MYDESC
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 7 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = name
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 14
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 14
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = 14
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 183: RESULT: first entry offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = d
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 8
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 8
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 172: RESULT: 14.7 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = i
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 168: RESULT: 14 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = bignumber
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 12
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 8
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 187: RESULT: 123045607890 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = b
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 16
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 163: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = comment
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 47
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 183: RESULT: The world's most advanced open source database. offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = day
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 10
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 9
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 176: RESULT: 14.07.1987 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 64: query: fetch in MYCURS; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 64: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 64: correctly got 1 tuples with 7 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 64: putting result (1 tuples) into descriptor MYDESC
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc_header: found 7 attributes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = name
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 14
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 14
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = 14
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 183: RESULT: second entry offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = d
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 8
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 8
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 172: RESULT: 1407.87 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = i
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 168: RESULT: 1407 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = bignumber
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 12
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 8
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 187: RESULT: 987065403210 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = b
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 16
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 163: RESULT: f offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = comment
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 27
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 183: RESULT: The elephant never forgets. offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = day
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 10
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 9
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 176: RESULT: 05.11.1999 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 64: query: fetch in MYCURS; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 64: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 64: correctly got 0 tuples with 7 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 64: no data found on line 64
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 194: query: close MYCURS; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 194: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 194: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-dyntest.stdout b/src/interfaces/ecpg/test/expected/sql-dyntest.stdout
new file mode 100644
index 0000000..f8c4c8e
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-dyntest.stdout
@@ -0,0 +1,43 @@
+Found 7 columns
+ 1 name (type: 1 length: 14 precision: 0 scale: 14 = char(14))
+ octet_length: -1 returned_octet_length: 14)
+ = "first entry "
+ 2 d (type: 8 length: -5 precision: -1 scale: 65531 = double precision)
+ octet_length: 8 returned_octet_length: 4)
+ = 14.700000
+ 3 i (type: 4 length: -5 precision: -1 scale: 65531 = integer)
+ octet_length: 4 returned_octet_length: 2)
+ = 14
+ 4 bignumber (type: 0 length: -5 precision: -1 scale: 65531 = <SQL3 0>)
+ octet_length: 8 returned_octet_length: 12)
+ = <"123045607890">
+ 5 b (type: 16 length: -5 precision: -1 scale: 65531 = bool)
+ octet_length: 1 returned_octet_length: 1)
+ = true
+ 6 comment (type: 1 length: -5 precision: -1 scale: 65531 = text)
+ octet_length: -1 returned_octet_length: 47)
+ = "The world's most advanced open source database."
+ 7 day (type: 9 length: -5 precision: -1 scale: 65531 = date)
+ octet_length: 4 returned_octet_length: 10)
+ = 1 "14.07.1987"
+ 1 name (type: 1 length: 14 precision: 0 scale: 14 = char(14))
+ octet_length: -1 returned_octet_length: 14)
+ = "second entry "
+ 2 d (type: 8 length: -5 precision: -1 scale: 65531 = double precision)
+ octet_length: 8 returned_octet_length: 7)
+ = 1407.870000
+ 3 i (type: 4 length: -5 precision: -1 scale: 65531 = integer)
+ octet_length: 4 returned_octet_length: 4)
+ = 1407
+ 4 bignumber (type: 0 length: -5 precision: -1 scale: 65531 = <SQL3 0>)
+ octet_length: 8 returned_octet_length: 12)
+ = <"987065403210">
+ 5 b (type: 16 length: -5 precision: -1 scale: 65531 = bool)
+ octet_length: 1 returned_octet_length: 1)
+ = false
+ 6 comment (type: 1 length: -5 precision: -1 scale: 65531 = text)
+ octet_length: -1 returned_octet_length: 27)
+ = "The elephant never forgets."
+ 7 day (type: 9 length: -5 precision: -1 scale: 65531 = date)
+ octet_length: 4 returned_octet_length: 10)
+ = 1 "05.11.1999"
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 0000000..10e9ad5
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-execute.c
@@ -0,0 +1,331 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#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, "ecpg1_regression" , NULL, NULL , "main", 0);
+#line 24 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 24 "execute.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "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"
+
+
+ /* test handling of embedded quotes in EXECUTE IMMEDIATE "literal" */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_immediate, "insert into test (name, \042amount\042, letter) values ('db: ''r1''', 1, 'f')", 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, 0, ECPGst_exec_immediate, command, 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, 0, ECPGst_exec_immediate, command, 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+$1, letter from test");
+ { ECPGprepare(__LINE__, NULL, 0, "i", command);
+#line 40 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 40 "execute.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "i",
+ 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__, NULL, 0, "f", command);
+#line 49 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 49 "execute.pgc"
+
+ /* declare CUR cursor for $1 */
+#line 50 "execute.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare CUR cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "f", __LINE__)),(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, 0, ECPGst_normal, "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, 0, ECPGst_normal, "close CUR", ECPGt_EOIT, ECPGt_EORT);
+#line 66 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 66 "execute.pgc"
+
+ { ECPGdeallocate(__LINE__, 0, NULL, "f");
+#line 67 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 67 "execute.pgc"
+
+
+ sprintf (command, "select * from test where amount = $1");
+
+ { ECPGprepare(__LINE__, NULL, 0, "f", command);
+#line 71 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 71 "execute.pgc"
+
+ /* declare CUR2 cursor for $1 */
+#line 72 "execute.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare CUR2 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "f", __LINE__)),(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 74 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 74 "execute.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "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 75 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 75 "execute.pgc"
+
+
+ for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
+ {
+ /* exec sql begin declare section */
+
+
+
+#line 80 "execute.pgc"
+ char n [ 8 ] , l = letter [ i ] [ 0 ] ;
+
+#line 81 "execute.pgc"
+ int a = amount [ i ] ;
+/* exec sql end declare section */
+#line 82 "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, 0, ECPGst_normal, "close CUR2", ECPGt_EOIT, ECPGt_EORT);
+#line 88 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 88 "execute.pgc"
+
+ { ECPGdeallocate(__LINE__, 0, NULL, "f");
+#line 89 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 89 "execute.pgc"
+
+
+ sprintf (command, "select * from test where amount = $1");
+
+ { ECPGprepare(__LINE__, NULL, 0, "f", command);
+#line 93 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 93 "execute.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "f",
+ ECPGt_const,"2",(long)1,(long)1,strlen("2"),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 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 94 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 94 "execute.pgc"
+
+
+ for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
+ {
+ /* exec sql begin declare section */
+
+
+
+#line 99 "execute.pgc"
+ char n [ 8 ] , l = letter [ i ] [ 0 ] ;
+
+#line 100 "execute.pgc"
+ int a = amount [ i ] ;
+/* exec sql end declare section */
+#line 101 "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);
+ }
+
+ { ECPGdeallocate(__LINE__, 0, NULL, "f");
+#line 107 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 107 "execute.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
+#line 108 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 108 "execute.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 109 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 109 "execute.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 110 "execute.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 110 "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 0000000..d8bc3c6
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-execute.stderr
@@ -0,0 +1,172 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: query: create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ); with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 25: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 26: action "commit"; connection "main"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: query: insert into test (name, "amount", letter) values ('db: ''r1''', 1, 'f'); with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 29: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: insert into test (name, amount, letter) values ('db: ''r1''', 2, 't'); with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: query: insert into test (name, amount, letter) select name, amount+10, letter from test; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 35: OK: INSERT 0 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 40: name i; query: "insert into test (name, amount, letter) select name, amount+$1, letter from test"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: query: insert into test (name, amount, letter) select name, amount+$1, letter from test; with 1 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: using PQexecPrepared for "insert into test (name, amount, letter) select name, amount+$1, letter from test"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 41: parameter 1 = 100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 41: OK: INSERT 0 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 45: action "commit"; connection "main"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 49: name f; query: "select * from test"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 52: query: declare CUR cursor for select * from test; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 52: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 52: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: query: fetch 8 in CUR; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 53: correctly got 8 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: 11 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: 12 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: 101 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: 102 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: 111 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: 112 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: f offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: f offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: f offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: f offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 53: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 66: query: close CUR; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 66: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 66: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 67: name f
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 71: name f; query: "select * from test where amount = $1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: query: declare CUR2 cursor for select * from test where amount = $1; with 1 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 74: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 74: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 74: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 75: query: fetch in CUR2; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 75: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 75: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 75: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 75: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 75: RESULT: f offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 88: query: close CUR2; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 88: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 88: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 89: name f
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 93: name f; query: "select * from test where amount = $1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 94: query: select * from test where amount = $1; with 1 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 94: using PQexecPrepared for "select * from test where amount = $1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 94: parameter 1 = 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 94: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 94: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 94: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 94: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 107: name f
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 108: query: drop table test; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 108: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 108: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 109: action "commit"; connection "main"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name i
+[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 0000000..5f9295a
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-execute.stdout
@@ -0,0 +1,12 @@
+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
+name[0]=db: 'r1' amount[0]=2 letter[0]=t
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 0000000..ca7d14e
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-fetch.c
@@ -0,0 +1,237 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "fetch.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 5 "fetch.pgc"
+
+
+int main() {
+ /* exec sql begin declare section */
+
+
+
+#line 9 "fetch.pgc"
+ char str [ 25 ] ;
+
+#line 10 "fetch.pgc"
+ int i , count = 1 , loopcount ;
+/* exec sql end declare section */
+#line 11 "fetch.pgc"
+
+
+ ECPGdebug(1, stderr);
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 14 "fetch.pgc"
+
+
+ /* exec sql whenever sql_warning sqlprint ; */
+#line 16 "fetch.pgc"
+
+ /* exec sql whenever sqlerror stop ; */
+#line 17 "fetch.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "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) exit (1);}
+#line 19 "fetch.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "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) exit (1);}
+#line 21 "fetch.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "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) exit (1);}
+#line 22 "fetch.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "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) exit (1);}
+#line 23 "fetch.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "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) exit (1);}
+#line 24 "fetch.pgc"
+
+
+ /* declare C cursor for select * from My_Table */
+#line 26 "fetch.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "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) exit (1);}
+#line 28 "fetch.pgc"
+
+
+ /* exec sql whenever not found break ; */
+#line 30 "fetch.pgc"
+
+ for (loopcount = 0; loopcount < 100; loopcount++) {
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "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) exit (1);}
+#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, 0, ECPGst_normal, "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) exit (1);}
+#line 37 "fetch.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 in C",
+ ECPGt_int,&(count),(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) exit (1);}
+#line 39 "fetch.pgc"
+
+ printf("%d: %s\n", i, str);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close C", ECPGt_EOIT, ECPGt_EORT);
+#line 42 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 42 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 42 "fetch.pgc"
+
+
+ /* declare D cursor for select * from My_Table where Item1 = $1 */
+#line 44 "fetch.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare D cursor for select * from My_Table where Item1 = $1",
+ ECPGt_const,"1",(long)1,(long)1,strlen("1"),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 46 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 46 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 46 "fetch.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in D", 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 48 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 48 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 48 "fetch.pgc"
+
+ printf("%d: %s\n", i, str);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close D", ECPGt_EOIT, ECPGt_EORT);
+#line 51 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 51 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 51 "fetch.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table My_Table", ECPGt_EOIT, ECPGt_EORT);
+#line 53 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 53 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 53 "fetch.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 55 "fetch.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 55 "fetch.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 55 "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 0000000..319d3b8
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-fetch.stderr
@@ -0,0 +1,142 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 19: query: create table My_Table ( Item1 int , Item2 text ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 19: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 19: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 21: query: insert into My_Table values ( 1 , 'text1' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 21: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 21: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 22: query: insert into My_Table values ( 2 , 'text2' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 22: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 22: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: query: insert into My_Table values ( 3 , 'text3' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 23: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: query: insert into My_Table values ( 4 , 'text4' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 24: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: query: declare C cursor for select * from My_Table; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 28: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: fetch 1 in C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: text1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: fetch 1 in C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: text2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: fetch 1 in C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: text3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: fetch 1 in C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 32: RESULT: text4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: fetch 1 in C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: correctly got 0 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 32: no data found on line 32
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 37: query: move backward 2 in C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 37: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 37: OK: MOVE 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: query: fetch 1 in C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 39: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 39: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 39: RESULT: text4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: query: close C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 42: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: query: declare D cursor for select * from My_Table where Item1 = $1; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 46: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 46: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 46: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: query: fetch 1 in D; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 48: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 48: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 48: RESULT: text1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: query: close D; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 51: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: query: drop table My_Table; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 53: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression 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 0000000..84dca88
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-fetch.stdout
@@ -0,0 +1,6 @@
+1: text1
+2: text2
+3: text3
+4: text4
+4: text4
+1: text1
diff --git a/src/interfaces/ecpg/test/expected/sql-func.c b/src/interfaces/ecpg/test/expected/sql-func.c
new file mode 100644
index 0000000..17c5d26
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-func.c
@@ -0,0 +1,170 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "func.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 5 "func.pgc"
+
+
+int main() {
+
+#line 8 "func.pgc"
+ char text [ 25 ] ;
+
+#line 8 "func.pgc"
+
+
+ ECPGdebug(1, stderr);
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 11 "func.pgc"
+
+
+ { ECPGsetcommit(__LINE__, "on", NULL);}
+#line 13 "func.pgc"
+
+ /* exec sql whenever sql_warning sqlprint ; */
+#line 14 "func.pgc"
+
+ /* exec sql whenever sqlerror sqlprint ; */
+#line 15 "func.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table My_Table ( Item1 int , Item2 text )", ECPGt_EOIT, ECPGt_EORT);
+#line 17 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 17 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 17 "func.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table Log ( name text , w text )", ECPGt_EOIT, ECPGt_EORT);
+#line 18 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 18 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 18 "func.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create function My_Table_Check ( ) returns trigger as $test$\
+ BEGIN\
+ INSERT INTO Log VALUES(TG_NAME, TG_WHEN);\
+ RETURN NEW;\
+ END; $test$ language plpgsql", ECPGt_EOIT, ECPGt_EORT);
+#line 26 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 26 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 26 "func.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create trigger My_Table_Check_Trigger before insert on My_Table for each row execute procedure My_Table_Check ( )", ECPGt_EOIT, ECPGt_EORT);
+#line 32 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 32 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 32 "func.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into My_Table values ( 1234 , 'Some random text' )", ECPGt_EOIT, ECPGt_EORT);
+#line 34 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 34 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 34 "func.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into My_Table values ( 5678 , 'The Quick Brown' )", ECPGt_EOIT, ECPGt_EORT);
+#line 35 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 35 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 35 "func.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select name from Log limit 1", ECPGt_EOIT,
+ ECPGt_char,(text),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 36 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 36 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 36 "func.pgc"
+
+ printf("Trigger %s fired.\n", text);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop trigger My_Table_Check_Trigger on My_Table", ECPGt_EOIT, ECPGt_EORT);
+#line 39 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 39 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 39 "func.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop function My_Table_Check ( )", ECPGt_EOIT, ECPGt_EORT);
+#line 40 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 40 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 40 "func.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table Log", ECPGt_EOIT, ECPGt_EORT);
+#line 41 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 41 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 41 "func.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table My_Table", ECPGt_EOIT, ECPGt_EORT);
+#line 42 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 42 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 42 "func.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 44 "func.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 44 "func.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 44 "func.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-func.stderr b/src/interfaces/ecpg/test/expected/sql-func.stderr
new file mode 100644
index 0000000..9b2501a
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-func.stderr
@@ -0,0 +1,76 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGsetcommit on line 13: action "on"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 17: query: create table My_Table ( Item1 int , Item2 text ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 17: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 17: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 18: query: create table Log ( name text , w text ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 18: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 18: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: query: create function My_Table_Check ( ) returns trigger as $test$ BEGIN INSERT INTO Log VALUES(TG_NAME, TG_WHEN); RETURN NEW; END; $test$ language plpgsql; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 20: OK: CREATE FUNCTION
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: query: create trigger My_Table_Check_Trigger before insert on My_Table for each row execute procedure My_Table_Check ( ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 28: OK: CREATE TRIGGER
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: query: insert into My_Table values ( 1234 , 'Some random text' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 34: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: query: insert into My_Table values ( 5678 , 'The Quick Brown' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 35: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: select name from Log limit 1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 36: RESULT: my_table_check_trigger offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: query: drop trigger My_Table_Check_Trigger on My_Table; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 39: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 39: OK: DROP TRIGGER
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: query: drop function My_Table_Check ( ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 40: OK: DROP FUNCTION
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: query: drop table Log; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 41: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: query: drop table My_Table; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 42: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-func.stdout b/src/interfaces/ecpg/test/expected/sql-func.stdout
new file mode 100644
index 0000000..9a3ec25
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-func.stdout
@@ -0,0 +1 @@
+Trigger my_table_check_trigger fired.
diff --git a/src/interfaces/ecpg/test/expected/sql-indicators.c b/src/interfaces/ecpg/test/expected/sql-indicators.c
new file mode 100644
index 0000000..7cf43ad
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-indicators.c
@@ -0,0 +1,189 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "indicators.pgc"
+#include <stdio.h>
+
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 3 "indicators.pgc"
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 4 "indicators.pgc"
+
+
+int main()
+{
+ /* exec sql begin declare section */
+
+
+
+#line 9 "indicators.pgc"
+ int intvar = 5 ;
+
+#line 10 "indicators.pgc"
+ int nullind = - 1 ;
+/* exec sql end declare section */
+#line 11 "indicators.pgc"
+
+
+ ECPGdebug(1,stderr);
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 15 "indicators.pgc"
+
+ { ECPGsetcommit(__LINE__, "off", NULL);}
+#line 16 "indicators.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table indicator_test ( \"id\" int primary key , \"str\" text not null , val int null )", ECPGt_EOIT, ECPGt_EORT);}
+#line 21 "indicators.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit work");}
+#line 22 "indicators.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into indicator_test ( id , str , val ) values ( 1 , 'Hello' , 0 )", ECPGt_EOIT, ECPGt_EORT);}
+#line 24 "indicators.pgc"
+
+
+ /* use indicator in insert */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into indicator_test ( id , str , val ) values ( 2 , 'Hi there' , $1 )",
+ ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
+ ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EOIT, ECPGt_EORT);}
+#line 27 "indicators.pgc"
+
+ nullind = 0;
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into indicator_test ( id , str , val ) values ( 3 , 'Good evening' , $1 )",
+ ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
+ ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EOIT, ECPGt_EORT);}
+#line 29 "indicators.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit work");}
+#line 30 "indicators.pgc"
+
+
+ /* use indicators to get information about selects */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select val from indicator_test where id = 1", ECPGt_EOIT,
+ ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 33 "indicators.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select val from indicator_test where id = 2", ECPGt_EOIT,
+ ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
+ ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EORT);}
+#line 34 "indicators.pgc"
+
+ printf("intvar: %d, nullind: %d\n", intvar, nullind);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select val from indicator_test where id = 3", ECPGt_EOIT,
+ ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
+ ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EORT);}
+#line 36 "indicators.pgc"
+
+ printf("intvar: %d, nullind: %d\n", intvar, nullind);
+
+ /* use indicators for update */
+ intvar = 5; nullind = -1;
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update indicator_test set val = $1 where id = 1",
+ ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
+ ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EOIT, ECPGt_EORT);}
+#line 41 "indicators.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select val from indicator_test where id = 1", ECPGt_EOIT,
+ ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int),
+ ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EORT);}
+#line 42 "indicators.pgc"
+
+ printf("intvar: %d, nullind: %d\n", intvar, nullind);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table indicator_test", ECPGt_EOIT, ECPGt_EORT);}
+#line 45 "indicators.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit work");}
+#line 46 "indicators.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 48 "indicators.pgc"
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-indicators.stderr b/src/interfaces/ecpg/test/expected/sql-indicators.stderr
new file mode 100644
index 0000000..5813ce2
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-indicators.stderr
@@ -0,0 +1,88 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGsetcommit on line 16: action "off"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 18: query: create table indicator_test ( "id" int primary key , "str" text not null , val int null ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 18: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 18: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 22: action "commit work"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: query: insert into indicator_test ( id , str , val ) values ( 1 , 'Hello' , 0 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 24: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 27: query: insert into indicator_test ( id , str , val ) values ( 2 , 'Hi there' , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 27: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 27: parameter 1 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 27: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: query: insert into indicator_test ( id , str , val ) values ( 3 , 'Good evening' , $1 ); with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 29: parameter 1 = 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 29: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 30: action "commit work"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: query: select val from indicator_test where id = 1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 33: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 33: RESULT: 0 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: query: select val from indicator_test where id = 2; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 34: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 34: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: select val from indicator_test where id = 3; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 36: RESULT: 5 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: query: update indicator_test set val = $1 where id = 1; with 1 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 41: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 41: parameter 1 = null
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 41: OK: UPDATE 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: query: select val from indicator_test where id = 1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 42: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 42: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 45: query: drop table indicator_test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 45: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 45: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 46: action "commit work"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-indicators.stdout b/src/interfaces/ecpg/test/expected/sql-indicators.stdout
new file mode 100644
index 0000000..e9d6fd1
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-indicators.stdout
@@ -0,0 +1,3 @@
+intvar: 0, nullind: -1
+intvar: 5, nullind: 0
+intvar: 5, nullind: -1
diff --git a/src/interfaces/ecpg/test/expected/sql-insupd.c b/src/interfaces/ecpg/test/expected/sql-insupd.c
new file mode 100644
index 0000000..5f73bf5
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-insupd.c
@@ -0,0 +1,145 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "insupd.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 5 "insupd.pgc"
+
+
+int main() {
+ /* exec sql begin declare section */
+
+
+#line 9 "insupd.pgc"
+ int i1 [ 3 ] , i2 [ 3 ] , i3 [ 3 ] , i4 ;
+/* exec sql end declare section */
+#line 10 "insupd.pgc"
+
+
+ ECPGdebug(1, stderr);
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 13 "insupd.pgc"
+
+
+ /* exec sql whenever sql_warning sqlprint ; */
+#line 15 "insupd.pgc"
+
+ /* exec sql whenever sqlerror sqlprint ; */
+#line 16 "insupd.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table insupd_test ( a int , b int )", ECPGt_EOIT, ECPGt_EORT);
+#line 18 "insupd.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 18 "insupd.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 18 "insupd.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into insupd_test ( a , b ) values ( 1 , 1 )", ECPGt_EOIT, ECPGt_EORT);
+#line 20 "insupd.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 20 "insupd.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 20 "insupd.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into insupd_test ( a , b ) values ( 2 , 2 )", ECPGt_EOIT, ECPGt_EORT);
+#line 21 "insupd.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 21 "insupd.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 21 "insupd.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into insupd_test ( a , b ) values ( 3 , 3 ) returning a", ECPGt_EOIT,
+ ECPGt_int,&(i4),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 22 "insupd.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 22 "insupd.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 22 "insupd.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update insupd_test set a = a + 1 returning a", ECPGt_EOIT,
+ ECPGt_int,(i3),(long)1,(long)3,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 24 "insupd.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 24 "insupd.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 24 "insupd.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update insupd_test set ( a , b ) = ( 5 , 5 ) where a = 4", ECPGt_EOIT, ECPGt_EORT);
+#line 25 "insupd.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 25 "insupd.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 25 "insupd.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update insupd_test set a = 4 where a = 3", ECPGt_EOIT, ECPGt_EORT);
+#line 26 "insupd.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 26 "insupd.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 26 "insupd.pgc"
+;
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select a , b from insupd_test order by a", ECPGt_EOIT,
+ ECPGt_int,(i1),(long)1,(long)3,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,(i2),(long)1,(long)3,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 28 "insupd.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 28 "insupd.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 28 "insupd.pgc"
+
+
+ printf("changes\n%d %d %d %d\n", i3[0], i3[1], i3[2], i4);
+ printf("test\na b\n%d %d\n%d %d\n%d %d\n", i1[0], i2[0], i1[1], i2[1], i1[2], i2[2]);
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 33 "insupd.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 33 "insupd.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 33 "insupd.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-insupd.stderr b/src/interfaces/ecpg/test/expected/sql-insupd.stderr
new file mode 100644
index 0000000..16f7c0a
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-insupd.stderr
@@ -0,0 +1,74 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 18: query: create table insupd_test ( a int , b int ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 18: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 18: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: query: insert into insupd_test ( a , b ) values ( 1 , 1 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 20: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 21: query: insert into insupd_test ( a , b ) values ( 2 , 2 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 21: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 21: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 22: query: insert into insupd_test ( a , b ) values ( 3 , 3 ) returning a; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 22: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 22: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 22: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: query: update insupd_test set a = a + 1 returning a; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 24: correctly got 3 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 24: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 24: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 24: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: query: update insupd_test set ( a , b ) = ( 5 , 5 ) where a = 4; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 25: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 25: OK: UPDATE 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: update insupd_test set a = 4 where a = 3; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: UPDATE 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: query: select a , b from insupd_test order by a; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 28: correctly got 3 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 28: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 28: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 28: RESULT: 5 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 28: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 28: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 28: RESULT: 5 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-insupd.stdout b/src/interfaces/ecpg/test/expected/sql-insupd.stdout
new file mode 100644
index 0000000..5cefd43
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-insupd.stdout
@@ -0,0 +1,7 @@
+changes
+2 3 4 3
+test
+a b
+2 1
+4 2
+5 5
diff --git a/src/interfaces/ecpg/test/expected/sql-oldexec.c b/src/interfaces/ecpg/test/expected/sql-oldexec.c
new file mode 100644
index 0000000..d6a661e
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-oldexec.c
@@ -0,0 +1,251 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "oldexec.pgc"
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 6 "oldexec.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 8 "oldexec.pgc"
+
+
+int
+main(void)
+{
+/* exec sql begin declare section */
+
+
+
+
+
+
+#line 14 "oldexec.pgc"
+ int amount [ 8 ] ;
+
+#line 15 "oldexec.pgc"
+ int increment = 100 ;
+
+#line 16 "oldexec.pgc"
+ char name [ 8 ] [ 8 ] ;
+
+#line 17 "oldexec.pgc"
+ char letter [ 8 ] [ 1 ] ;
+
+#line 18 "oldexec.pgc"
+ char command [ 128 ] ;
+/* exec sql end declare section */
+#line 19 "oldexec.pgc"
+
+ int i,j;
+
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "main", 0);
+#line 24 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 24 "oldexec.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, ECPGst_normal, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) )", ECPGt_EOIT, ECPGt_EORT);
+#line 26 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 26 "oldexec.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 27 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 27 "oldexec.pgc"
+
+
+ sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f')");
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, ECPGst_exec_immediate, command, ECPGt_EOIT, ECPGt_EORT);
+#line 30 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 30 "oldexec.pgc"
+
+
+ sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 2, 't')");
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, ECPGst_exec_immediate, command, ECPGt_EOIT, ECPGt_EORT);
+#line 33 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 33 "oldexec.pgc"
+
+
+ sprintf(command, "insert into test (name, amount, letter) select name, amount+10, letter from test");
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, ECPGst_exec_immediate, command, ECPGt_EOIT, ECPGt_EORT);
+#line 36 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 36 "oldexec.pgc"
+
+
+ printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
+
+ sprintf(command, "insert into test (name, amount, letter) select name, amount+$1, letter from test");
+ { ECPGprepare(__LINE__, NULL, 1, "i", command);
+#line 41 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 41 "oldexec.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, ECPGst_execute, "i",
+ ECPGt_int,&(increment),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 42 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 42 "oldexec.pgc"
+
+
+ printf("Inserted %ld tuples via prepared execute\n", sqlca.sqlerrd[2]);
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 46 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 46 "oldexec.pgc"
+
+
+ sprintf (command, "select * from test");
+
+ { ECPGprepare(__LINE__, NULL, 1, "f", command);
+#line 50 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 50 "oldexec.pgc"
+
+ /* declare CUR cursor for $1 */
+#line 51 "oldexec.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, ECPGst_normal, "declare CUR cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "f", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 53 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 53 "oldexec.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, ECPGst_normal, "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 54 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 54 "oldexec.pgc"
+
+
+ for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
+ {
+ char n[8], l = letter[i][0];
+ int a = amount[i];
+
+ 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, 1, ECPGst_normal, "close CUR", ECPGt_EOIT, ECPGt_EORT);
+#line 65 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 65 "oldexec.pgc"
+
+
+ sprintf (command, "select * from test where ? = amount");
+
+ { ECPGprepare(__LINE__, NULL, 1, "f", command);
+#line 69 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 69 "oldexec.pgc"
+
+ /* declare CUR3 cursor for $1 */
+#line 70 "oldexec.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, ECPGst_normal, "declare CUR3 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "f", __LINE__)),(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 72 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 72 "oldexec.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, ECPGst_normal, "fetch in CUR3", 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 73 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 73 "oldexec.pgc"
+
+
+ for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
+ {
+ char n[8], l = letter[i][0];
+ int a = amount[i];
+
+ 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, 1, ECPGst_normal, "close CUR3", ECPGt_EOIT, ECPGt_EORT);
+#line 84 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 84 "oldexec.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 1, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
+#line 85 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 85 "oldexec.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 86 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 86 "oldexec.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 87 "oldexec.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 87 "oldexec.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-oldexec.stderr b/src/interfaces/ecpg/test/expected/sql-oldexec.stderr
new file mode 100644
index 0000000..7543757
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-oldexec.stderr
@@ -0,0 +1,154 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ); with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 27: action "commit"; connection "main"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: query: insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f'); with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 30: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: query: insert into test (name, amount, letter) values ('db: ''r1''', 2, 't'); with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 33: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 33: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: query: insert into test (name, amount, letter) select name, amount+10, letter from test; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 36: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 36: OK: INSERT 0 2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 41: name i; query: "insert into test (name, amount, letter) select name, amount+$1, letter from test"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: query: insert into test (name, amount, letter) select name, amount+$1, letter from test; with 1 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 42: using PQexecPrepared for "insert into test (name, amount, letter) select name, amount+$1, letter from test"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 42: parameter 1 = 100
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 42: OK: INSERT 0 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 46: action "commit"; connection "main"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 50: name f; query: "select * from test"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: query: declare CUR cursor for select * from test; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 53: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 53: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 54: query: fetch 8 in CUR; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 54: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 54: correctly got 8 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: 11 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: 12 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: 101 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: 102 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: 111 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: 112 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: f offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: f offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: f offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: f offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 54: RESULT: t offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 65: query: close CUR; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 65: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 65: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 69: name f
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 69: name f; query: "select * from test where $1 = amount"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: query: declare CUR3 cursor for select * from test where $1 = amount; with 1 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 72: using PQexecParams
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 72: parameter 1 = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 72: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 73: query: fetch in CUR3; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 73: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 73: correctly got 1 tuples with 3 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 73: RESULT: db: 'r1' offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 73: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 73: RESULT: f offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 84: query: close CUR3; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 84: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 84: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 85: query: drop table test; with 0 parameter(s) on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 85: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 85: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 86: action "commit"; connection "main"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name f
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 0: name i
+[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-oldexec.stdout b/src/interfaces/ecpg/test/expected/sql-oldexec.stdout
new file mode 100644
index 0000000..1f4d4f2
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-oldexec.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-parser.c b/src/interfaces/ecpg/test/expected/sql-parser.c
new file mode 100644
index 0000000..32bb2c2
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-parser.c
@@ -0,0 +1,126 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "parser.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* test parser addition that merges two tokens into one */
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 6 "parser.pgc"
+
+
+int main() {
+ /* exec sql begin declare section */
+
+
+#line 10 "parser.pgc"
+ int item [ 3 ] , ind [ 3 ] , i ;
+/* exec sql end declare section */
+#line 11 "parser.pgc"
+
+
+ ECPGdebug(1, stderr);
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 14 "parser.pgc"
+
+
+ { ECPGsetcommit(__LINE__, "on", NULL);}
+#line 16 "parser.pgc"
+
+ /* exec sql whenever sql_warning sqlprint ; */
+#line 17 "parser.pgc"
+
+ /* exec sql whenever sqlerror sqlprint ; */
+#line 18 "parser.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table T ( Item1 int , Item2 int )", ECPGt_EOIT, ECPGt_EORT);
+#line 20 "parser.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 20 "parser.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 20 "parser.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t select 1 , nullif ( y - 1 , 0 ) from generate_series ( 1 , 3 ) with ordinality as series ( x , y )", ECPGt_EOIT, ECPGt_EORT);
+#line 24 "parser.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 24 "parser.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 24 "parser.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select Item2 from T order by Item2 nulls last", ECPGt_EOIT,
+ ECPGt_int,(item),(long)1,(long)3,sizeof(int),
+ ECPGt_int,(ind),(long)1,(long)3,sizeof(int), ECPGt_EORT);
+#line 26 "parser.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 26 "parser.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 26 "parser.pgc"
+
+
+ for (i=0; i<3; i++)
+ printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter table T alter Item1 type bigint", ECPGt_EOIT, ECPGt_EORT);
+#line 31 "parser.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 31 "parser.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 31 "parser.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter table T alter column Item2 set data type smallint", ECPGt_EOIT, ECPGt_EORT);
+#line 32 "parser.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 32 "parser.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 32 "parser.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table T", ECPGt_EOIT, ECPGt_EORT);
+#line 34 "parser.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 34 "parser.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 34 "parser.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 36 "parser.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 36 "parser.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 36 "parser.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-parser.stderr b/src/interfaces/ecpg/test/expected/sql-parser.stderr
new file mode 100644
index 0000000..fba8fd1
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-parser.stderr
@@ -0,0 +1,50 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGsetcommit on line 16: action "on"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: query: create table T ( Item1 int , Item2 int ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 20: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 22: query: insert into t select 1 , nullif ( y - 1 , 0 ) from generate_series ( 1 , 3 ) with ordinality as series ( x , y ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 22: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 22: OK: INSERT 0 3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: select Item2 from T order by Item2 nulls last; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: correctly got 3 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 26: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 26: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 26: RESULT: offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: query: alter table T alter Item1 type bigint; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 31: OK: ALTER TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: alter table T alter column Item2 set data type smallint; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: OK: ALTER TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: query: drop table T; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 34: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-parser.stdout b/src/interfaces/ecpg/test/expected/sql-parser.stdout
new file mode 100644
index 0000000..e646ca2
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-parser.stdout
@@ -0,0 +1,3 @@
+item[0] = 1
+item[1] = 2
+item[2] = -1
diff --git a/src/interfaces/ecpg/test/expected/sql-prepareas.c b/src/interfaces/ecpg/test/expected/sql-prepareas.c
new file mode 100644
index 0000000..b925c4b
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-prepareas.c
@@ -0,0 +1,664 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "prepareas.pgc"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 5 "prepareas.pgc"
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 6 "prepareas.pgc"
+
+
+static void
+check_result_of_insert(void)
+{
+ /* exec sql begin declare section */
+
+
+#line 12 "prepareas.pgc"
+ int ivar1 = 0 , ivar2 = 0 ;
+/* exec sql end declare section */
+#line 13 "prepareas.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select c1 , c2 from test", ECPGt_EOIT,
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 15 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 15 "prepareas.pgc"
+
+ printf("%d %d\n", ivar1, ivar2);
+}
+
+int main(void)
+{
+ /* exec sql begin declare section */
+
+
+
+#line 22 "prepareas.pgc"
+ int ivar1 = 1 , ivar2 = 2 ;
+
+#line 23 "prepareas.pgc"
+ char v_include_dq_name [ 16 ] , v_include_ws_name [ 16 ] , v_normal_name [ 16 ] , v_query [ 64 ] ;
+/* exec sql end declare section */
+#line 24 "prepareas.pgc"
+
+
+ strcpy(v_normal_name, "normal_name");
+ strcpy(v_include_dq_name, "include_\"_name");
+ strcpy(v_include_ws_name, "include_ _name");
+ strcpy(v_query, "insert into test values(?,?)");
+
+ /*
+ * preparing for test
+ */
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 34 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 34 "prepareas.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "begin");
+#line 35 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 35 "prepareas.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( c1 int , c2 int )", ECPGt_EOIT, ECPGt_EORT);
+#line 36 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 36 "prepareas.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit work");
+#line 37 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 37 "prepareas.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "begin");
+#line 38 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 38 "prepareas.pgc"
+
+
+ /*
+ * Non dynamic statement
+ */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 43 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 43 "prepareas.pgc"
+
+ printf("+++++ Test for prepnormal +++++\n");
+ printf("insert into test values(:ivar1,:ivar2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test values ( $1 , $2 )",
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 46 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 46 "prepareas.pgc"
+
+ check_result_of_insert();
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 49 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 49 "prepareas.pgc"
+
+ printf("+++++ Test for execute immediate +++++\n");
+ printf("execute immediate \"insert into test values(1,2)\"\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_immediate, "insert into test values(1,2)", ECPGt_EOIT, ECPGt_EORT);
+#line 52 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 52 "prepareas.pgc"
+
+ check_result_of_insert();
+
+ /*
+ * PREPARE FROM
+ */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 58 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 58 "prepareas.pgc"
+
+ printf("+++++ Test for PREPARE ident FROM CString +++++\n");
+ printf("prepare ident_name from \"insert into test values(?,?)\"\n");
+ { ECPGprepare(__LINE__, NULL, 0, "ident_name", "insert into test values(?,?)");
+#line 61 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 61 "prepareas.pgc"
+
+ printf("execute ident_name using :ivar1,:ivar2\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "ident_name",
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 63 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 63 "prepareas.pgc"
+
+ check_result_of_insert();
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 66 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 66 "prepareas.pgc"
+
+ printf("+++++ Test for PREPARE char_variable_normal_name FROM char_variable +++++\n");
+ printf("prepare :v_normal_name from :v_query\n");
+ { ECPGprepare(__LINE__, NULL, 0, v_normal_name, v_query);
+#line 69 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 69 "prepareas.pgc"
+
+ printf("execute :v_normal_name using :ivar1,:ivar2\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, v_normal_name,
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 71 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 71 "prepareas.pgc"
+
+ check_result_of_insert();
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 74 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 74 "prepareas.pgc"
+
+ printf("+++++ Test for PREPARE char_variable_inc_dq_name FROM char_variable +++++\n");
+ printf("prepare :v_include_dq_name from :v_query\n");
+ { ECPGprepare(__LINE__, NULL, 0, v_include_dq_name, v_query);
+#line 77 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 77 "prepareas.pgc"
+
+ printf("execute :v_include_dq_name using :ivar1,:ivar2\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, v_include_dq_name,
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 79 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 79 "prepareas.pgc"
+
+ check_result_of_insert();
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 82 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 82 "prepareas.pgc"
+
+ printf("+++++ Test for PREPARE char_variable_inc_ws_name FROM char_variable +++++\n");
+ printf("prepare :v_include_ws_name from :v_query\n");
+ { ECPGprepare(__LINE__, NULL, 0, v_include_ws_name, v_query);
+#line 85 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 85 "prepareas.pgc"
+
+ printf("execute :v_include_ws_name using :ivar1,:ivar2\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, v_include_ws_name,
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 87 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 87 "prepareas.pgc"
+
+ check_result_of_insert();
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 90 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 90 "prepareas.pgc"
+
+ printf("+++++ Test for PREPARE CString_inc_ws_name FROM char_variable +++++\n");
+ printf("prepare \"include_ _name\" from :v_query\n");
+ { ECPGprepare(__LINE__, NULL, 0, "include_ _name", v_query);
+#line 93 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 93 "prepareas.pgc"
+
+ printf("exec sql execute \"include_ _name\" using :ivar1,:ivar2\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "include_ _name",
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 95 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 95 "prepareas.pgc"
+
+ check_result_of_insert();
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 98 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 98 "prepareas.pgc"
+
+ printf("+++++ Test for PREPARE CString_normal_name FROM char_variable +++++\n");
+ printf("prepare \"norma_name\" from :v_query\n");
+ { ECPGprepare(__LINE__, NULL, 0, "normal_name", v_query);
+#line 101 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 101 "prepareas.pgc"
+
+ printf("exec sql execute \"normal_name\" using :ivar1,:ivar2\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "normal_name",
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 103 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 103 "prepareas.pgc"
+
+ check_result_of_insert();
+
+ /*
+ * PREPARE AS
+ */
+ { ECPGdeallocate(__LINE__, 0, NULL, "ident_name");
+#line 109 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 109 "prepareas.pgc"
+
+ { ECPGdeallocate(__LINE__, 0, NULL, "normal_name");
+#line 110 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 110 "prepareas.pgc"
+
+ { ECPGdeallocate(__LINE__, 0, NULL, "include_ _name");
+#line 111 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 111 "prepareas.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 113 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 113 "prepareas.pgc"
+
+ printf("+++++ Test for PREPARE ident(typelist) AS +++++\n");
+ printf("prepare ident_name(int,int) as insert into test values($1,$2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepare, "prepare $0 ( int , int ) as insert into test values ( $1 , $2 )",
+ ECPGt_const,"ident_name",(long)10,(long)1,strlen("ident_name"),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 116 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 116 "prepareas.pgc"
+
+ printf("execute ident_name(:ivar1,:ivar2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
+ ECPGt_const,"ident_name",(long)10,(long)1,strlen("ident_name"),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 118 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 118 "prepareas.pgc"
+
+ check_result_of_insert();
+ { ECPGdeallocate(__LINE__, 0, NULL, "ident_name");
+#line 120 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 120 "prepareas.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 122 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 122 "prepareas.pgc"
+
+ printf("+++++ Test for PREPARE CString_normal_name(typelist) AS +++++\n");
+ printf("prepare \"normal_name\"(int,int) as insert into test values($1,$2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepare, "prepare $0 ( int , int ) as insert into test values ( $1 , $2 )",
+ ECPGt_const,"normal_name",(long)11,(long)1,strlen("normal_name"),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 125 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 125 "prepareas.pgc"
+
+ printf("execute \"normal_name\"(:ivar1,:ivar2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
+ ECPGt_const,"normal_name",(long)11,(long)1,strlen("normal_name"),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 127 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 127 "prepareas.pgc"
+
+ check_result_of_insert();
+ { ECPGdeallocate(__LINE__, 0, NULL, "normal_name");
+#line 129 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 129 "prepareas.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 131 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 131 "prepareas.pgc"
+
+ printf("+++++ Test for PREPARE CString_include_ws_name(typelist) AS +++++\n");
+ printf("prepare \"include_ _name\"(int,int) as insert into test values($1,$2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepare, "prepare $0 ( int , int ) as insert into test values ( $1 , $2 )",
+ ECPGt_const,"include_ _name",(long)14,(long)1,strlen("include_ _name"),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 134 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 134 "prepareas.pgc"
+
+ printf("execute \"include_ _name\"(:ivar1,:ivar2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
+ ECPGt_const,"include_ _name",(long)14,(long)1,strlen("include_ _name"),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 136 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 136 "prepareas.pgc"
+
+ check_result_of_insert();
+ { ECPGdeallocate(__LINE__, 0, NULL, "include_ _name");
+#line 138 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 138 "prepareas.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 140 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 140 "prepareas.pgc"
+
+ printf("+++++ Test for PREPARE char_variable_normal_name(typelist) AS +++++\n");
+ printf("prepare :v_normal_name(int,int) as insert into test values($1,$2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepare, "prepare $0 ( int , int ) as insert into test values ( $1 , $2 )",
+ ECPGt_char,(v_normal_name),(long)16,(long)1,(16)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 143 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 143 "prepareas.pgc"
+
+ printf("execute :v_normal_name(:ivar1,:ivar2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
+ ECPGt_char,(v_normal_name),(long)16,(long)1,(16)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 145 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 145 "prepareas.pgc"
+
+ check_result_of_insert();
+ { ECPGdeallocate(__LINE__, 0, NULL, "normal_name");
+#line 147 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 147 "prepareas.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 149 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 149 "prepareas.pgc"
+
+ printf("+++++ Test for PREPARE char_variable_include_ws_name(typelist) AS +++++\n");
+ printf("prepare :v_include_ws_name(int,int) as insert into test values($1,$2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_prepare, "prepare $0 ( int , int ) as insert into test values ( $1 , $2 )",
+ ECPGt_char,(v_include_ws_name),(long)16,(long)1,(16)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 152 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 152 "prepareas.pgc"
+
+ printf("execute :v_include_ws_name(:ivar1,:ivar2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
+ ECPGt_char,(v_include_ws_name),(long)16,(long)1,(16)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 154 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 154 "prepareas.pgc"
+
+ check_result_of_insert();
+ { ECPGdeallocate(__LINE__, 0, NULL, "include_ _name");
+#line 156 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 156 "prepareas.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 158 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 158 "prepareas.pgc"
+
+ printf("+++++ Test for EXECUTE :v_normal_name(const,const) +++++\n");
+ printf("prepare :v_normal_name from :v_query\n");
+ { ECPGprepare(__LINE__, NULL, 0, v_normal_name, v_query);
+#line 161 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 161 "prepareas.pgc"
+
+ printf("execute :v_normal_name(1,2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( 1 , 2 )",
+ ECPGt_char,(v_normal_name),(long)16,(long)1,(16)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 163 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 163 "prepareas.pgc"
+
+ check_result_of_insert();
+ { ECPGdeallocate(__LINE__, 0, NULL, "normal_name");
+#line 165 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 165 "prepareas.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 167 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 167 "prepareas.pgc"
+
+ printf("+++++ Test for EXECUTE :v_normal_name(expr,expr) +++++\n");
+ printf("prepare :v_normal_name from :v_query\n");
+ { ECPGprepare(__LINE__, NULL, 0, v_normal_name, v_query);
+#line 170 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 170 "prepareas.pgc"
+
+ printf("execute :v_normal_name(0+1,1+1)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( 0 + 1 , 1 + 1 )",
+ ECPGt_char,(v_normal_name),(long)16,(long)1,(16)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 172 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 172 "prepareas.pgc"
+
+ check_result_of_insert();
+ { ECPGdeallocate(__LINE__, 0, NULL, "normal_name");
+#line 174 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 174 "prepareas.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 176 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 176 "prepareas.pgc"
+
+ printf("+++++ Test for combination PREPARE FROM and EXECUTE ident(typelist) +++++\n");
+ printf("prepare ident_name from :v_query\n");
+ { ECPGprepare(__LINE__, NULL, 0, "ident_name", v_query);
+#line 179 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 179 "prepareas.pgc"
+
+ printf("execute ident_name(:ivar1,:ivar2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
+ ECPGt_const,"ident_name",(long)10,(long)1,strlen("ident_name"),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 181 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 181 "prepareas.pgc"
+
+ check_result_of_insert();
+ { ECPGdeallocate(__LINE__, 0, NULL, "ident_name");
+#line 183 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 183 "prepareas.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "truncate test", ECPGt_EOIT, ECPGt_EORT);
+#line 185 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 185 "prepareas.pgc"
+
+ printf("+++++ Test for combination PREPARE FROM and EXECUTE CString_include_ws_name(typelist) +++++\n");
+ printf("prepare \"include_ _name\" from :v_query\n");
+ { ECPGprepare(__LINE__, NULL, 0, "include_ _name", v_query);
+#line 188 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 188 "prepareas.pgc"
+
+ printf("execute \"include_ _name\"(:ivar1,:ivar2)\n");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_with_exprlist, "execute $0 ( $1 , $2 )",
+ ECPGt_const,"include_ _name",(long)14,(long)1,strlen("include_ _name"),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar1),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(ivar2),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 190 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 190 "prepareas.pgc"
+
+ check_result_of_insert();
+ { ECPGdeallocate(__LINE__, 0, NULL, "include_ _name");
+#line 192 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 192 "prepareas.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
+#line 194 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 194 "prepareas.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit work");
+#line 195 "prepareas.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 195 "prepareas.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-prepareas.stderr b/src/interfaces/ecpg/test/expected/sql-prepareas.stderr
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-prepareas.stderr
diff --git a/src/interfaces/ecpg/test/expected/sql-prepareas.stdout b/src/interfaces/ecpg/test/expected/sql-prepareas.stdout
new file mode 100644
index 0000000..d875442
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-prepareas.stdout
@@ -0,0 +1,66 @@
++++++ Test for prepnormal +++++
+insert into test values(:ivar1,:ivar2)
+1 2
++++++ Test for execute immediate +++++
+execute immediate "insert into test values(1,2)"
+1 2
++++++ Test for PREPARE ident FROM CString +++++
+prepare ident_name from "insert into test values(?,?)"
+execute ident_name using :ivar1,:ivar2
+1 2
++++++ Test for PREPARE char_variable_normal_name FROM char_variable +++++
+prepare :v_normal_name from :v_query
+execute :v_normal_name using :ivar1,:ivar2
+1 2
++++++ Test for PREPARE char_variable_inc_dq_name FROM char_variable +++++
+prepare :v_include_dq_name from :v_query
+execute :v_include_dq_name using :ivar1,:ivar2
+1 2
++++++ Test for PREPARE char_variable_inc_ws_name FROM char_variable +++++
+prepare :v_include_ws_name from :v_query
+execute :v_include_ws_name using :ivar1,:ivar2
+1 2
++++++ Test for PREPARE CString_inc_ws_name FROM char_variable +++++
+prepare "include_ _name" from :v_query
+exec sql execute "include_ _name" using :ivar1,:ivar2
+1 2
++++++ Test for PREPARE CString_normal_name FROM char_variable +++++
+prepare "norma_name" from :v_query
+exec sql execute "normal_name" using :ivar1,:ivar2
+1 2
++++++ Test for PREPARE ident(typelist) AS +++++
+prepare ident_name(int,int) as insert into test values($1,$2)
+execute ident_name(:ivar1,:ivar2)
+1 2
++++++ Test for PREPARE CString_normal_name(typelist) AS +++++
+prepare "normal_name"(int,int) as insert into test values($1,$2)
+execute "normal_name"(:ivar1,:ivar2)
+1 2
++++++ Test for PREPARE CString_include_ws_name(typelist) AS +++++
+prepare "include_ _name"(int,int) as insert into test values($1,$2)
+execute "include_ _name"(:ivar1,:ivar2)
+1 2
++++++ Test for PREPARE char_variable_normal_name(typelist) AS +++++
+prepare :v_normal_name(int,int) as insert into test values($1,$2)
+execute :v_normal_name(:ivar1,:ivar2)
+1 2
++++++ Test for PREPARE char_variable_include_ws_name(typelist) AS +++++
+prepare :v_include_ws_name(int,int) as insert into test values($1,$2)
+execute :v_include_ws_name(:ivar1,:ivar2)
+1 2
++++++ Test for EXECUTE :v_normal_name(const,const) +++++
+prepare :v_normal_name from :v_query
+execute :v_normal_name(1,2)
+1 2
++++++ Test for EXECUTE :v_normal_name(expr,expr) +++++
+prepare :v_normal_name from :v_query
+execute :v_normal_name(0+1,1+1)
+1 2
++++++ Test for combination PREPARE FROM and EXECUTE ident(typelist) +++++
+prepare ident_name from :v_query
+execute ident_name(:ivar1,:ivar2)
+1 2
++++++ Test for combination PREPARE FROM and EXECUTE CString_include_ws_name(typelist) +++++
+prepare "include_ _name" from :v_query
+execute "include_ _name"(:ivar1,:ivar2)
+1 2
diff --git a/src/interfaces/ecpg/test/expected/sql-quote.c b/src/interfaces/ecpg/test/expected/sql-quote.c
new file mode 100644
index 0000000..05841bd
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-quote.c
@@ -0,0 +1,230 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "quote.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 5 "quote.pgc"
+
+
+int main() {
+ /* exec sql begin declare section */
+
+
+
+#line 9 "quote.pgc"
+ char var [ 25 ] ;
+
+#line 10 "quote.pgc"
+ int i , loopcount ;
+/* exec sql end declare section */
+#line 11 "quote.pgc"
+
+
+ ECPGdebug(1, stderr);
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 14 "quote.pgc"
+
+
+ { ECPGsetcommit(__LINE__, "on", NULL);}
+#line 16 "quote.pgc"
+
+ /* exec sql whenever sql_warning sqlprint ; */
+#line 17 "quote.pgc"
+
+ /* exec sql whenever sqlerror stop ; */
+#line 18 "quote.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table \"My_Table\" ( Item1 int , Item2 text )", ECPGt_EOIT, ECPGt_EORT);
+#line 20 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 20 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 20 "quote.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set standard_conforming_strings to off", ECPGt_EOIT, ECPGt_EORT);
+#line 22 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 22 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 22 "quote.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show standard_conforming_strings", ECPGt_EOIT,
+ ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 24 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 24 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 24 "quote.pgc"
+
+ printf("Standard conforming strings: %s\n", var);
+
+ /* this is a\\b actually */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into \"My_Table\" values ( 1 , 'a\\\\\\\\b' )", ECPGt_EOIT, ECPGt_EORT);
+#line 28 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 28 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 28 "quote.pgc"
+
+ /* this is a\\b */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into \"My_Table\" values ( 1 , E'a\\\\\\\\b' )", ECPGt_EOIT, ECPGt_EORT);
+#line 30 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 30 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 30 "quote.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set standard_conforming_strings to on", ECPGt_EOIT, ECPGt_EORT);
+#line 32 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 32 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 32 "quote.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show standard_conforming_strings", ECPGt_EOIT,
+ ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 34 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 34 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 34 "quote.pgc"
+
+ printf("Standard conforming strings: %s\n", var);
+
+ /* this is a\\\\b actually */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into \"My_Table\" values ( 2 , 'a\\\\\\\\b' )", ECPGt_EOIT, ECPGt_EORT);
+#line 38 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 38 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 38 "quote.pgc"
+
+ /* this is a\\b */
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into \"My_Table\" values ( 2 , E'a\\\\\\\\b' )", ECPGt_EOIT, ECPGt_EORT);
+#line 40 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 40 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 40 "quote.pgc"
+
+
+ { ECPGtrans(__LINE__, NULL, "begin");
+#line 42 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 42 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 42 "quote.pgc"
+
+ /* declare C cursor for select * from \"My_Table\" */
+#line 43 "quote.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare C cursor for select * from \"My_Table\"", ECPGt_EOIT, ECPGt_EORT);
+#line 45 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 45 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 45 "quote.pgc"
+
+
+ /* exec sql whenever not found break ; */
+#line 47 "quote.pgc"
+
+
+ for (loopcount = 0; loopcount < 100; loopcount++)
+ {
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch C", ECPGt_EOIT,
+ ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 51 "quote.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+#line 51 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 51 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 51 "quote.pgc"
+
+ printf("value: %d %s\n", i, var);
+ }
+
+ { ECPGtrans(__LINE__, NULL, "rollback");
+#line 55 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 55 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 55 "quote.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table \"My_Table\"", ECPGt_EOIT, ECPGt_EORT);
+#line 56 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 56 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 56 "quote.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 58 "quote.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 58 "quote.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 58 "quote.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-quote.stderr b/src/interfaces/ecpg/test/expected/sql-quote.stderr
new file mode 100644
index 0000000..3df8702
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-quote.stderr
@@ -0,0 +1,135 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGsetcommit on line 16: action "on"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: query: create table "My_Table" ( Item1 int , Item2 text ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 20: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 22: query: set standard_conforming_strings to off; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 22: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 22: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: query: show standard_conforming_strings; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 24: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 24: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 24: RESULT: off offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 28: query: insert into "My_Table" values ( 1 , 'a\\\\b' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGnoticeReceiver: nonstandard use of \\ in a string literal
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 0
+[NO_PID]: sqlca: code: 0, state: 22P06
+[NO_PID]: ecpg_execute on line 28: using PQexec
+[NO_PID]: sqlca: code: 0, state: 22P06
+[NO_PID]: ecpg_process_output on line 28: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 22P06
+SQL error: nonstandard use of \\ in a string literal
+[NO_PID]: ecpg_execute on line 30: query: insert into "My_Table" values ( 1 , E'a\\\\b' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 30: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: query: set standard_conforming_strings to on; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 32: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 32: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: query: show standard_conforming_strings; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 34: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 34: RESULT: on offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: query: insert into "My_Table" values ( 2 , 'a\\\\b' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 38: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: query: insert into "My_Table" values ( 2 , E'a\\\\b' ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 40: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 40: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 42: action "begin"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 45: query: declare C cursor for select * from "My_Table"; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 45: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 45: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 51: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 51: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 51: RESULT: a\\b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 51: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 51: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 51: RESULT: a\\b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 51: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 51: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 51: RESULT: a\\\\b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 51: correctly got 1 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 51: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 51: RESULT: a\\b offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: query: fetch C; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 51: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 51: correctly got 0 tuples with 2 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 51: no data found on line 51
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ECPGtrans on line 55: action "rollback"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 56: query: drop table "My_Table"; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 56: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 56: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-quote.stdout b/src/interfaces/ecpg/test/expected/sql-quote.stdout
new file mode 100644
index 0000000..2f92f99
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-quote.stdout
@@ -0,0 +1,6 @@
+Standard conforming strings: off
+Standard conforming strings: on
+value: 1 a\\b
+value: 1 a\\b
+value: 2 a\\\\b
+value: 2 a\\b
diff --git a/src/interfaces/ecpg/test/expected/sql-show.c b/src/interfaces/ecpg/test/expected/sql-show.c
new file mode 100644
index 0000000..1b52d5e
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-show.c
@@ -0,0 +1,170 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "show.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 5 "show.pgc"
+
+
+int main() {
+ /* exec sql begin declare section */
+
+
+#line 9 "show.pgc"
+ char var [ 25 ] = "public" ;
+/* exec sql end declare section */
+#line 10 "show.pgc"
+
+
+ ECPGdebug(1, stderr);
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 13 "show.pgc"
+
+
+ /* exec sql whenever sql_warning sqlprint ; */
+#line 15 "show.pgc"
+
+ /* exec sql whenever sqlerror sqlprint ; */
+#line 16 "show.pgc"
+
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set search_path to $0",
+ ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 18 "show.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 18 "show.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 18 "show.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show search_path", ECPGt_EOIT,
+ ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 19 "show.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 19 "show.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 19 "show.pgc"
+
+ printf("Var: Search path: %s\n", var);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set search_path to 'public'", ECPGt_EOIT, ECPGt_EORT);
+#line 22 "show.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 22 "show.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 22 "show.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show search_path", ECPGt_EOIT,
+ ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 23 "show.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 23 "show.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 23 "show.pgc"
+
+ printf("Var: Search path: %s\n", var);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set standard_conforming_strings to off", ECPGt_EOIT, ECPGt_EORT);
+#line 26 "show.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 26 "show.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 26 "show.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show standard_conforming_strings", ECPGt_EOIT,
+ ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 27 "show.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 27 "show.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 27 "show.pgc"
+
+ printf("Var: Standard conforming strings: %s\n", var);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set time zone PST8PDT", ECPGt_EOIT, ECPGt_EORT);
+#line 30 "show.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 30 "show.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 30 "show.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show time zone", ECPGt_EOIT,
+ ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 31 "show.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 31 "show.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 31 "show.pgc"
+
+ printf("Time Zone: %s\n", var);
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set transaction isolation level read committed", ECPGt_EOIT, ECPGt_EORT);
+#line 34 "show.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 34 "show.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 34 "show.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show transaction isolation level", ECPGt_EOIT,
+ ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 35 "show.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 35 "show.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 35 "show.pgc"
+
+ printf("Transaction isolation level: %s\n", var);
+
+ { ECPGdisconnect(__LINE__, "ALL");
+#line 38 "show.pgc"
+
+if (sqlca.sqlwarn[0] == 'W') sqlprint();
+#line 38 "show.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 38 "show.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-show.stderr b/src/interfaces/ecpg/test/expected/sql-show.stderr
new file mode 100644
index 0000000..c303a84
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-show.stderr
@@ -0,0 +1,76 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 18: query: set search_path to public; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 18: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 18: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 19: query: show search_path; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 19: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 19: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 19: RESULT: public offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 22: query: set search_path to 'public'; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 22: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 22: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: query: show search_path; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 23: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 23: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 23: RESULT: public offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: query: set standard_conforming_strings to off; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 26: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 26: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 27: query: show standard_conforming_strings; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 27: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 27: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 27: RESULT: off offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: query: set time zone PST8PDT; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 30: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 30: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: query: show time zone; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 31: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 31: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 31: RESULT: PST8PDT offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: query: set transaction isolation level read committed; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 34: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 34: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: query: show transaction isolation level; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 35: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 35: correctly got 1 tuples with 1 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 35: RESULT: read committed offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-show.stdout b/src/interfaces/ecpg/test/expected/sql-show.stdout
new file mode 100644
index 0000000..9319c5d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-show.stdout
@@ -0,0 +1,5 @@
+Var: Search path: public
+Var: Search path: public
+Var: Standard conforming strings: off
+Time Zone: PST8PDT
+Transaction isolation level: read committed
diff --git a/src/interfaces/ecpg/test/expected/sql-sqlda.c b/src/interfaces/ecpg/test/expected/sql-sqlda.c
new file mode 100644
index 0000000..d474bd3
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-sqlda.c
@@ -0,0 +1,545 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "sqlda.pgc"
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include "ecpg_config.h"
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 6 "sqlda.pgc"
+
+
+#line 1 "sqlda.h"
+#ifndef ECPG_SQLDA_H
+#define ECPG_SQLDA_H
+
+#ifdef _ECPG_INFORMIX_H
+
+#include "sqlda-compat.h"
+typedef struct sqlvar_compat sqlvar_t;
+typedef struct sqlda_compat sqlda_t;
+
+#else
+
+#include "sqlda-native.h"
+typedef struct sqlvar_struct sqlvar_t;
+typedef struct sqlda_struct sqlda_t;
+
+#endif
+
+#endif /* ECPG_SQLDA_H */
+
+#line 7 "sqlda.pgc"
+
+
+#line 1 "pgtypes_numeric.h"
+#ifndef PGTYPES_NUMERIC
+#define PGTYPES_NUMERIC
+
+#include <pgtypes.h>
+
+#define NUMERIC_POS 0x0000
+#define NUMERIC_NEG 0x4000
+#define NUMERIC_NAN 0xC000
+#define NUMERIC_NULL 0xF000
+#define NUMERIC_MAX_PRECISION 1000
+#define NUMERIC_MAX_DISPLAY_SCALE NUMERIC_MAX_PRECISION
+#define NUMERIC_MIN_DISPLAY_SCALE 0
+#define NUMERIC_MIN_SIG_DIGITS 16
+
+#define DECSIZE 30
+
+typedef unsigned char NumericDigit;
+typedef struct
+{
+ int ndigits; /* number of digits in digits[] - can be 0! */
+ int weight; /* weight of first digit */
+ int rscale; /* result scale */
+ int dscale; /* display scale */
+ int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */
+ NumericDigit *buf; /* start of alloc'd space for digits[] */
+ NumericDigit *digits; /* decimal digits */
+} numeric;
+
+typedef struct
+{
+ int ndigits; /* number of digits in digits[] - can be 0! */
+ int weight; /* weight of first digit */
+ int rscale; /* result scale */
+ int dscale; /* display scale */
+ int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */
+ NumericDigit digits[DECSIZE]; /* decimal digits */
+} decimal;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+numeric *PGTYPESnumeric_new(void);
+decimal *PGTYPESdecimal_new(void);
+void PGTYPESnumeric_free(numeric *);
+void PGTYPESdecimal_free(decimal *);
+numeric *PGTYPESnumeric_from_asc(char *, char **);
+char *PGTYPESnumeric_to_asc(numeric *, int);
+int PGTYPESnumeric_add(numeric *, numeric *, numeric *);
+int PGTYPESnumeric_sub(numeric *, numeric *, numeric *);
+int PGTYPESnumeric_mul(numeric *, numeric *, numeric *);
+int PGTYPESnumeric_div(numeric *, numeric *, numeric *);
+int PGTYPESnumeric_cmp(numeric *, numeric *);
+int PGTYPESnumeric_from_int(signed int, numeric *);
+int PGTYPESnumeric_from_long(signed long int, numeric *);
+int PGTYPESnumeric_copy(numeric *, numeric *);
+int PGTYPESnumeric_from_double(double, numeric *);
+int PGTYPESnumeric_to_double(numeric *, double *);
+int PGTYPESnumeric_to_int(numeric *, int *);
+int PGTYPESnumeric_to_long(numeric *, long *);
+int PGTYPESnumeric_to_decimal(numeric *, decimal *);
+int PGTYPESnumeric_from_decimal(decimal *, numeric *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PGTYPES_NUMERIC */
+
+#line 8 "sqlda.pgc"
+
+
+/* exec sql whenever sqlerror stop ; */
+#line 10 "sqlda.pgc"
+
+
+/* These shouldn't be under DECLARE SECTION */
+sqlda_t *inp_sqlda, *outp_sqlda, *outp_sqlda1;
+
+static void
+dump_sqlda(sqlda_t *sqlda)
+{
+ int i;
+
+ if (sqlda == NULL)
+ {
+ printf("dump_sqlda called with NULL sqlda\n");
+ return;
+ }
+
+ for (i = 0; i < sqlda->sqld; i++)
+ {
+ if (sqlda->sqlvar[i].sqlind && *(sqlda->sqlvar[i].sqlind) == -1)
+ printf("name sqlda descriptor: '%s' value NULL'\n", sqlda->sqlvar[i].sqlname.data);
+ else
+ switch (sqlda->sqlvar[i].sqltype)
+ {
+ case ECPGt_char:
+ printf("name sqlda descriptor: '%s' value '%s'\n", sqlda->sqlvar[i].sqlname.data, sqlda->sqlvar[i].sqldata);
+ break;
+ case ECPGt_int:
+ printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname.data, *(int *)sqlda->sqlvar[i].sqldata);
+ break;
+ case ECPGt_long:
+ printf("name sqlda descriptor: '%s' value %ld\n", sqlda->sqlvar[i].sqlname.data, *(long int *)sqlda->sqlvar[i].sqldata);
+ break;
+ case ECPGt_long_long:
+ printf(
+#ifdef _WIN32
+ "name sqlda descriptor: '%s' value %I64d\n",
+#else
+ "name sqlda descriptor: '%s' value %lld\n",
+#endif
+ sqlda->sqlvar[i].sqlname.data, *(long long int *)sqlda->sqlvar[i].sqldata);
+ break;
+ case ECPGt_double:
+ printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
+ break;
+ case ECPGt_numeric:
+ {
+ char *val;
+
+ val = PGTYPESnumeric_to_asc((numeric*)sqlda->sqlvar[i].sqldata, -1);
+ printf("name sqlda descriptor: '%s' value NUMERIC '%s'\n", sqlda->sqlvar[i].sqlname.data, val);
+ PGTYPESchar_free(val);
+ break;
+ }
+ }
+ }
+}
+
+int
+main (void)
+{
+/* exec sql begin declare section */
+
+
+
+
+
+#line 71 "sqlda.pgc"
+ char * stmt1 = "SELECT * FROM t1" ;
+
+#line 72 "sqlda.pgc"
+ char * stmt2 = "SELECT * FROM t1 WHERE id = ?" ;
+
+#line 73 "sqlda.pgc"
+ int rec ;
+
+#line 74 "sqlda.pgc"
+ int id ;
+/* exec sql end declare section */
+#line 75 "sqlda.pgc"
+
+
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "regress1", 0);
+#line 82 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 82 "sqlda.pgc"
+
+
+ strcpy(msg, "set");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+#line 85 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 85 "sqlda.pgc"
+
+
+ strcpy(msg, "create");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table t1 ( id integer , t text , d1 numeric , d2 float8 , c char ( 10 ) , big bigint )", ECPGt_EOIT, ECPGt_EORT);
+#line 95 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 95 "sqlda.pgc"
+
+
+ strcpy(msg, "insert");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' , 1111111111111111111 ) , ( 2 , null , null , null , null , null ) , ( 3 , 'c' , 0.0 , 3 , 'c' , 3333333333333333333 ) , ( 4 , 'd' , 'NaN' , 4 , 'd' , 4444444444444444444 ) , ( 5 , 'e' , 0.001234 , 5 , 'e' , 5555555555555555555 )", ECPGt_EOIT, ECPGt_EORT);
+#line 103 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 103 "sqlda.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 106 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 106 "sqlda.pgc"
+
+
+ /* SQLDA test for getting all records from a table */
+
+ outp_sqlda = NULL;
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, NULL, 0, "st_id1", stmt1);
+#line 113 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 113 "sqlda.pgc"
+
+
+ strcpy(msg, "declare");
+ /* declare mycur1 cursor for $1 */
+#line 116 "sqlda.pgc"
+
+
+ strcpy(msg, "open");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare mycur1 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id1", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 119 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 119 "sqlda.pgc"
+
+
+ /* exec sql whenever not found break ; */
+#line 121 "sqlda.pgc"
+
+
+ rec = 0;
+ while (1)
+ {
+ strcpy(msg, "fetch");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 from mycur1", ECPGt_EOIT,
+ ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 127 "sqlda.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+#line 127 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 127 "sqlda.pgc"
+
+
+ printf("FETCH RECORD %d\n", ++rec);
+ dump_sqlda(outp_sqlda);
+ }
+
+ /* exec sql whenever not found continue ; */
+#line 133 "sqlda.pgc"
+
+
+ strcpy(msg, "close");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close mycur1", ECPGt_EOIT, ECPGt_EORT);
+#line 136 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 136 "sqlda.pgc"
+
+
+ strcpy(msg, "deallocate");
+ { ECPGdeallocate(__LINE__, 0, NULL, "st_id1");
+#line 139 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 139 "sqlda.pgc"
+
+
+ free(outp_sqlda);
+
+ /* SQLDA test for getting ALL records into the sqlda list */
+
+ outp_sqlda = NULL;
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, NULL, 0, "st_id2", stmt1);
+#line 148 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 148 "sqlda.pgc"
+
+
+ strcpy(msg, "declare");
+ /* declare mycur2 cursor for $1 */
+#line 151 "sqlda.pgc"
+
+
+ strcpy(msg, "open");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare mycur2 cursor for $1",
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id2", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 154 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 154 "sqlda.pgc"
+
+
+ strcpy(msg, "fetch");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch all from mycur2", ECPGt_EOIT,
+ ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 157 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 157 "sqlda.pgc"
+
+
+ outp_sqlda1 = outp_sqlda;
+ rec = 0;
+ while (outp_sqlda1)
+ {
+ sqlda_t *ptr;
+ printf("FETCH RECORD %d\n", ++rec);
+ dump_sqlda(outp_sqlda1);
+
+ ptr = outp_sqlda1;
+ outp_sqlda1 = outp_sqlda1->desc_next;
+ free(ptr);
+ }
+
+ strcpy(msg, "close");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close mycur2", ECPGt_EOIT, ECPGt_EORT);
+#line 173 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 173 "sqlda.pgc"
+
+
+ strcpy(msg, "deallocate");
+ { ECPGdeallocate(__LINE__, 0, NULL, "st_id2");
+#line 176 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 176 "sqlda.pgc"
+
+
+ /* SQLDA test for getting one record using an input descriptor */
+
+ /*
+ * Input sqlda has to be built manually
+ * sqlda_t contains 1 sqlvar_t structure already.
+ */
+ inp_sqlda = (sqlda_t *)malloc(sizeof(sqlda_t));
+ memset(inp_sqlda, 0, sizeof(sqlda_t));
+ inp_sqlda->sqln = 1;
+
+ inp_sqlda->sqlvar[0].sqltype = ECPGt_int;
+ inp_sqlda->sqlvar[0].sqldata = (char *)&id;
+
+ printf("EXECUTE RECORD 4\n");
+
+ id = 4;
+
+ outp_sqlda = NULL;
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, NULL, 0, "st_id3", stmt2);
+#line 198 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 198 "sqlda.pgc"
+
+
+ strcpy(msg, "execute");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "st_id3",
+ ECPGt_sqlda, &inp_sqlda, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 201 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 201 "sqlda.pgc"
+
+
+ dump_sqlda(outp_sqlda);
+
+ strcpy(msg, "deallocate");
+ { ECPGdeallocate(__LINE__, 0, NULL, "st_id3");
+#line 206 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 206 "sqlda.pgc"
+
+
+ free(inp_sqlda);
+ free(outp_sqlda);
+
+ /* SQLDA test for getting one record using an input descriptor
+ * on a named connection
+ */
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "con2", 0);
+#line 215 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 215 "sqlda.pgc"
+
+
+ /*
+ * Input sqlda has to be built manually
+ * sqlda_t contains 1 sqlvar_t structure already.
+ */
+ inp_sqlda = (sqlda_t *)malloc(sizeof(sqlda_t));
+ memset(inp_sqlda, 0, sizeof(sqlda_t));
+ inp_sqlda->sqln = 1;
+
+ inp_sqlda->sqlvar[0].sqltype = ECPGt_int;
+ inp_sqlda->sqlvar[0].sqldata = (char *)&id;
+
+ printf("EXECUTE RECORD 4\n");
+
+ id = 4;
+
+ outp_sqlda = NULL;
+
+ strcpy(msg, "prepare");
+ { ECPGprepare(__LINE__, "con2", 0, "st_id4", stmt2);
+#line 235 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 235 "sqlda.pgc"
+
+
+ strcpy(msg, "execute");
+ { ECPGdo(__LINE__, 0, 1, "con2", 0, ECPGst_execute, "st_id4",
+ ECPGt_sqlda, &inp_sqlda, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 238 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 238 "sqlda.pgc"
+
+
+ dump_sqlda(outp_sqlda);
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, "con2", "commit");
+#line 243 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 243 "sqlda.pgc"
+
+
+ strcpy(msg, "deallocate");
+ { ECPGdeallocate(__LINE__, 0, NULL, "st_id4");
+#line 246 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 246 "sqlda.pgc"
+
+
+ free(inp_sqlda);
+ free(outp_sqlda);
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "con2");
+#line 252 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 252 "sqlda.pgc"
+
+
+ /* End test */
+
+ strcpy(msg, "drop");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT);
+#line 257 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 257 "sqlda.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 260 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 260 "sqlda.pgc"
+
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 263 "sqlda.pgc"
+
+if (sqlca.sqlcode < 0) exit (1);}
+#line 263 "sqlda.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-sqlda.stderr b/src/interfaces/ecpg/test/expected/sql-sqlda.stderr
new file mode 100644
index 0000000..dfe6b13
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-sqlda.stderr
@@ -0,0 +1,460 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 85: query: set datestyle to iso; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 85: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 85: OK: SET
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 88: query: create table t1 ( id integer , t text , d1 numeric , d2 float8 , c char ( 10 ) , big bigint ); with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 88: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 88: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 98: query: insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' , 1111111111111111111 ) , ( 2 , null , null , null , null , null ) , ( 3 , 'c' , 0.0 , 3 , 'c' , 3333333333333333333 ) , ( 4 , 'd' , 'NaN' , 4 , 'd' , 4444444444444444444 ) , ( 5 , 'e' , 0.001234 , 5 , 'e' , 5555555555555555555 ); with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 98: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 98: OK: INSERT 0 5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 106: action "commit"; connection "regress1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 113: name st_id1; query: "SELECT * FROM t1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 119: query: declare mycur1 cursor for SELECT * FROM t1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 119: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 119: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 127: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 127: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: correctly got 1 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 127 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 5 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: 1111111111111111111 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 127: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 127: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: correctly got 1 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 127 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 1 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 2 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 3 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 4 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 5 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 127: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 127: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: correctly got 1 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 127 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: c offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: c offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 5 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: 3333333333333333333 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 127: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 127: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: correctly got 1 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 127 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 5 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: 4444444444444444444 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 127: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 127: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: correctly got 1 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 127 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: 5 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: e offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: 5 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: e offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 127 row 0 col 5 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 127: RESULT: 5555555555555555555 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 127: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 127: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 127: correctly got 0 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 127: no data found on line 127
+[NO_PID]: sqlca: code: 100, state: 02000
+[NO_PID]: ecpg_execute on line 136: query: close mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 136: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 136: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 139: name st_id1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 148: name st_id2; query: "SELECT * FROM t1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 154: query: declare mycur2 cursor for SELECT * FROM t1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 154: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 154: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 157: query: fetch all from mycur2; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 157: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 157: correctly got 5 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 157 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 157: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 4 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 5 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 4 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: e offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 4 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 4 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 5 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 4 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: e offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 4 col 5 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 5555555555555555555 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 157: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 157 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 157: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 3 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 3 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 3 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 3 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 3 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 3 col 5 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 4444444444444444444 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 157: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 157 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 157: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 2 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 2 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: c offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 2 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 2 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 3 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 2 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: c offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 2 col 5 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 3333333333333333333 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 157: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 157 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 157: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 1 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 2 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 1 col 1 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 1 col 2 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 1 col 3 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 1 col 4 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 1 col 5 IS NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 157: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 157 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 157: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 1 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: a offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 157 row 0 col 5 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 157: RESULT: 1111111111111111111 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 157: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 173: query: close mycur2; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 173: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 173: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 176: name st_id2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 198: name st_id3; query: "SELECT * FROM t1 WHERE id = $1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 201: query: SELECT * FROM t1 WHERE id = $1; with 1 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 201: using PQexecPrepared for "SELECT * FROM t1 WHERE id = $1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 201: parameter 1 = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 201: correctly got 1 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 201 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 201: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 201 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 201: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 201 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 201: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 201 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 201 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 201: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 201 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 201: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 201 row 0 col 5 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 201: RESULT: 4444444444444444444 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 201: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 206: name st_id3
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 235: name st_id4; query: "SELECT * FROM t1 WHERE id = $1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 238: query: SELECT * FROM t1 WHERE id = $1; with 1 parameter(s) on connection con2
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 238: using PQexecPrepared for "SELECT * FROM t1 WHERE id = $1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_free_params on line 238: parameter 1 = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 238: correctly got 1 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 238 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 238: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 238 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 238: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 238 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 238: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 238 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 238 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 238: RESULT: 4 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 238 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 238: RESULT: d offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 238 row 0 col 5 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 238: RESULT: 4444444444444444444 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 238: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 243: action "commit"; connection "con2"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 246: name st_id4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection con2 closed
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 257: query: drop table t1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 257: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 257: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 260: 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/sql-sqlda.stdout b/src/interfaces/ecpg/test/expected/sql-sqlda.stdout
new file mode 100644
index 0000000..e3b1a64
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-sqlda.stdout
@@ -0,0 +1,84 @@
+FETCH RECORD 1
+name sqlda descriptor: 'id' value 1
+name sqlda descriptor: 't' value 'a'
+name sqlda descriptor: 'd1' value NUMERIC '1.0'
+name sqlda descriptor: 'd2' value 1.000000
+name sqlda descriptor: 'c' value 'a '
+name sqlda descriptor: 'big' value 1111111111111111111
+FETCH RECORD 2
+name sqlda descriptor: 'id' value 2
+name sqlda descriptor: 't' value NULL'
+name sqlda descriptor: 'd1' value NULL'
+name sqlda descriptor: 'd2' value NULL'
+name sqlda descriptor: 'c' value NULL'
+name sqlda descriptor: 'big' value NULL'
+FETCH RECORD 3
+name sqlda descriptor: 'id' value 3
+name sqlda descriptor: 't' value 'c'
+name sqlda descriptor: 'd1' value NUMERIC '0.0'
+name sqlda descriptor: 'd2' value 3.000000
+name sqlda descriptor: 'c' value 'c '
+name sqlda descriptor: 'big' value 3333333333333333333
+FETCH RECORD 4
+name sqlda descriptor: 'id' value 4
+name sqlda descriptor: 't' value 'd'
+name sqlda descriptor: 'd1' value NUMERIC 'NaN'
+name sqlda descriptor: 'd2' value 4.000000
+name sqlda descriptor: 'c' value 'd '
+name sqlda descriptor: 'big' value 4444444444444444444
+FETCH RECORD 5
+name sqlda descriptor: 'id' value 5
+name sqlda descriptor: 't' value 'e'
+name sqlda descriptor: 'd1' value NUMERIC '0.001234'
+name sqlda descriptor: 'd2' value 5.000000
+name sqlda descriptor: 'c' value 'e '
+name sqlda descriptor: 'big' value 5555555555555555555
+FETCH RECORD 1
+name sqlda descriptor: 'id' value 1
+name sqlda descriptor: 't' value 'a'
+name sqlda descriptor: 'd1' value NUMERIC '1.0'
+name sqlda descriptor: 'd2' value 1.000000
+name sqlda descriptor: 'c' value 'a '
+name sqlda descriptor: 'big' value 1111111111111111111
+FETCH RECORD 2
+name sqlda descriptor: 'id' value 2
+name sqlda descriptor: 't' value NULL'
+name sqlda descriptor: 'd1' value NULL'
+name sqlda descriptor: 'd2' value NULL'
+name sqlda descriptor: 'c' value NULL'
+name sqlda descriptor: 'big' value NULL'
+FETCH RECORD 3
+name sqlda descriptor: 'id' value 3
+name sqlda descriptor: 't' value 'c'
+name sqlda descriptor: 'd1' value NUMERIC '0.0'
+name sqlda descriptor: 'd2' value 3.000000
+name sqlda descriptor: 'c' value 'c '
+name sqlda descriptor: 'big' value 3333333333333333333
+FETCH RECORD 4
+name sqlda descriptor: 'id' value 4
+name sqlda descriptor: 't' value 'd'
+name sqlda descriptor: 'd1' value NUMERIC 'NaN'
+name sqlda descriptor: 'd2' value 4.000000
+name sqlda descriptor: 'c' value 'd '
+name sqlda descriptor: 'big' value 4444444444444444444
+FETCH RECORD 5
+name sqlda descriptor: 'id' value 5
+name sqlda descriptor: 't' value 'e'
+name sqlda descriptor: 'd1' value NUMERIC '0.001234'
+name sqlda descriptor: 'd2' value 5.000000
+name sqlda descriptor: 'c' value 'e '
+name sqlda descriptor: 'big' value 5555555555555555555
+EXECUTE RECORD 4
+name sqlda descriptor: 'id' value 4
+name sqlda descriptor: 't' value 'd'
+name sqlda descriptor: 'd1' value NUMERIC 'NaN'
+name sqlda descriptor: 'd2' value 4.000000
+name sqlda descriptor: 'c' value 'd '
+name sqlda descriptor: 'big' value 4444444444444444444
+EXECUTE RECORD 4
+name sqlda descriptor: 'id' value 4
+name sqlda descriptor: 't' value 'd'
+name sqlda descriptor: 'd1' value NUMERIC 'NaN'
+name sqlda descriptor: 'd2' value 4.000000
+name sqlda descriptor: 'c' value 'd '
+name sqlda descriptor: 'big' value 4444444444444444444
diff --git a/src/interfaces/ecpg/test/expected/sql-twophase.c b/src/interfaces/ecpg/test/expected/sql-twophase.c
new file mode 100644
index 0000000..20b54d3
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-twophase.c
@@ -0,0 +1,114 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "twophase.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 5 "twophase.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 7 "twophase.pgc"
+
+
+int main(void)
+{
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 16 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 16 "twophase.pgc"
+
+ { ECPGsetcommit(__LINE__, "off", NULL);
+#line 17 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 17 "twophase.pgc"
+
+
+ strcpy(msg, "create");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table t1 ( c int )", ECPGt_EOIT, ECPGt_EORT);
+#line 20 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 20 "twophase.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 23 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 23 "twophase.pgc"
+
+
+ strcpy(msg, "begin");
+ { ECPGtrans(__LINE__, NULL, "begin");
+#line 26 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 26 "twophase.pgc"
+
+
+ strcpy(msg, "insert");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 values ( 1 )", ECPGt_EOIT, ECPGt_EORT);
+#line 29 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 29 "twophase.pgc"
+
+
+ strcpy(msg, "prepare transaction");
+ { ECPGtrans(__LINE__, NULL, "prepare transaction 'gxid'");
+#line 32 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 32 "twophase.pgc"
+
+
+ strcpy(msg, "commit prepared");
+ { ECPGtrans(__LINE__, NULL, "commit prepared 'gxid'");
+#line 35 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 35 "twophase.pgc"
+
+
+ strcpy(msg, "drop");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT);
+#line 38 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 38 "twophase.pgc"
+
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 41 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 41 "twophase.pgc"
+
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-twophase.stderr b/src/interfaces/ecpg/test/expected/sql-twophase.stderr
new file mode 100644
index 0000000..18415ff
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-twophase.stderr
@@ -0,0 +1,34 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGsetcommit on line 17: action "off"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: query: create table t1 ( c int ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 20: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 23: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 26: action "begin"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: query: insert into t1 values ( 1 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 29: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 32: action "prepare transaction 'gxid'"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 35: action "commit prepared 'gxid'"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: query: drop table t1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 38: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-twophase.stdout b/src/interfaces/ecpg/test/expected/sql-twophase.stdout
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-twophase.stdout
diff --git a/src/interfaces/ecpg/test/expected/thread-alloc.c b/src/interfaces/ecpg/test/expected/thread-alloc.c
new file mode 100644
index 0000000..37ef44e
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-alloc.c
@@ -0,0 +1,218 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "alloc.pgc"
+#include <stdint.h>
+#include <stdlib.h>
+#include "ecpg_config.h"
+
+#ifndef ENABLE_THREAD_SAFETY
+int
+main(void)
+{
+ printf("No threading enabled.\n");
+ return 0;
+}
+#else
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <process.h>
+#include <locale.h>
+#else
+#include <pthread.h>
+#endif
+#include <stdio.h>
+
+#define THREADS 16
+#define REPEATS 50
+
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 26 "alloc.pgc"
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 27 "alloc.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 29 "alloc.pgc"
+
+/* exec sql whenever not found sqlprint ; */
+#line 30 "alloc.pgc"
+
+
+#ifdef WIN32
+static unsigned __stdcall fn(void* arg)
+#else
+static void* fn(void* arg)
+#endif
+{
+ int i;
+
+ /* exec sql begin declare section */
+
+
+
+
+#line 41 "alloc.pgc"
+ int value ;
+
+#line 42 "alloc.pgc"
+ char name [ 100 ] ;
+
+#line 43 "alloc.pgc"
+ char ** r = NULL ;
+/* exec sql end declare section */
+#line 44 "alloc.pgc"
+
+
+ value = (intptr_t) arg;
+ sprintf(name, "Connection: %d", value);
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , name, 0);
+#line 49 "alloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 49 "alloc.pgc"
+
+ { ECPGsetcommit(__LINE__, "on", NULL);
+#line 50 "alloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 50 "alloc.pgc"
+
+ for (i = 1; i <= REPEATS; ++i)
+ {
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select relname from pg_class where relname = 'pg_class'", ECPGt_EOIT,
+ ECPGt_char,&(r),(long)0,(long)0,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+#line 53 "alloc.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 53 "alloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 53 "alloc.pgc"
+
+ free(r);
+ r = NULL;
+ }
+ { ECPGdisconnect(__LINE__, name);
+#line 57 "alloc.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 57 "alloc.pgc"
+
+
+ return 0;
+}
+
+int main ()
+{
+ intptr_t i;
+#ifdef WIN32
+ HANDLE threads[THREADS];
+#else
+ pthread_t threads[THREADS];
+#endif
+
+#ifdef WIN32
+ for (i = 0; i < THREADS; ++i)
+ {
+ unsigned id;
+ threads[i] = (HANDLE)_beginthreadex(NULL, 0, fn, (void*)i, 0, &id);
+ }
+
+ WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE);
+ for (i = 0; i < THREADS; ++i)
+ CloseHandle(threads[i]);
+#else
+ for (i = 0; i < THREADS; ++i)
+ pthread_create(&threads[i], NULL, fn, (void *) i);
+ for (i = 0; i < THREADS; ++i)
+ pthread_join(threads[i], NULL);
+#endif
+
+ return 0;
+}
+#endif
diff --git a/src/interfaces/ecpg/test/expected/thread-alloc.stderr b/src/interfaces/ecpg/test/expected/thread-alloc.stderr
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-alloc.stderr
diff --git a/src/interfaces/ecpg/test/expected/thread-alloc.stdout b/src/interfaces/ecpg/test/expected/thread-alloc.stdout
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-alloc.stdout
diff --git a/src/interfaces/ecpg/test/expected/thread-alloc_2.stdout b/src/interfaces/ecpg/test/expected/thread-alloc_2.stdout
new file mode 100644
index 0000000..75fe16b
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-alloc_2.stdout
@@ -0,0 +1 @@
+No threading enabled.
diff --git a/src/interfaces/ecpg/test/expected/thread-descriptor.c b/src/interfaces/ecpg/test/expected/thread-descriptor.c
new file mode 100644
index 0000000..f56cc25
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-descriptor.c
@@ -0,0 +1,161 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "descriptor.pgc"
+#ifdef ENABLE_THREAD_SAFETY
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <process.h>
+#include <locale.h>
+#else
+#include <pthread.h>
+#endif
+#endif
+#include <stdio.h>
+
+#define THREADS 16
+#define REPEATS 50000
+
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 16 "descriptor.pgc"
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 17 "descriptor.pgc"
+
+/* exec sql whenever not found sqlprint ; */
+#line 18 "descriptor.pgc"
+
+
+#if defined(ENABLE_THREAD_SAFETY) && defined(WIN32)
+static unsigned __stdcall fn(void* arg)
+#else
+static void* fn(void* arg)
+#endif
+{
+ int i;
+
+ for (i = 1; i <= REPEATS; ++i)
+ {
+ ECPGallocate_desc(__LINE__, "mydesc");
+#line 30 "descriptor.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();
+#line 30 "descriptor.pgc"
+
+ ECPGdeallocate_desc(__LINE__, "mydesc");
+#line 31 "descriptor.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();
+#line 31 "descriptor.pgc"
+
+ }
+
+ return 0;
+}
+
+int main ()
+{
+#ifdef ENABLE_THREAD_SAFETY
+ int i;
+#ifdef WIN32
+ HANDLE threads[THREADS];
+#else
+ pthread_t threads[THREADS];
+#endif
+
+#ifdef WIN32
+ for (i = 0; i < THREADS; ++i)
+ {
+ unsigned id;
+ threads[i] = (HANDLE)_beginthreadex(NULL, 0, fn, NULL, 0, &id);
+ }
+
+ WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE);
+ for (i = 0; i < THREADS; ++i)
+ CloseHandle(threads[i]);
+#else
+ for (i = 0; i < THREADS; ++i)
+ pthread_create(&threads[i], NULL, fn, NULL);
+ for (i = 0; i < THREADS; ++i)
+ pthread_join(threads[i], NULL);
+#endif
+#else
+ fn(NULL);
+#endif
+
+ return 0;
+}
diff --git a/src/interfaces/ecpg/test/expected/thread-descriptor.stderr b/src/interfaces/ecpg/test/expected/thread-descriptor.stderr
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-descriptor.stderr
diff --git a/src/interfaces/ecpg/test/expected/thread-descriptor.stdout b/src/interfaces/ecpg/test/expected/thread-descriptor.stdout
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-descriptor.stdout
diff --git a/src/interfaces/ecpg/test/expected/thread-prep.c b/src/interfaces/ecpg/test/expected/thread-prep.c
new file mode 100644
index 0000000..7cdf250
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-prep.c
@@ -0,0 +1,259 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "prep.pgc"
+#include <stdint.h>
+#include <stdlib.h>
+#include "ecpg_config.h"
+
+#ifndef ENABLE_THREAD_SAFETY
+int
+main(void)
+{
+ printf("No threading enabled.\n");
+ return 0;
+}
+#else
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <process.h>
+#include <locale.h>
+#else
+#include <pthread.h>
+#endif
+#include <stdio.h>
+
+#define THREADS 16
+#define REPEATS 50
+
+
+#line 1 "sqlca.h"
+#ifndef POSTGRES_SQLCA_H
+#define POSTGRES_SQLCA_H
+
+#ifndef PGDLLIMPORT
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PGDLLIMPORT __declspec (dllimport)
+#else
+#define PGDLLIMPORT
+#endif /* __CYGWIN__ */
+#endif /* PGDLLIMPORT */
+
+#define SQLERRMC_LEN 150
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct sqlca_t
+{
+ char sqlcaid[8];
+ long sqlabc;
+ long sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[SQLERRMC_LEN];
+ } sqlerrm;
+ char sqlerrp[8];
+ long sqlerrd[6];
+ /* Element 0: empty */
+ /* 1: OID of processed tuple if applicable */
+ /* 2: number of rows processed */
+ /* after an INSERT, UPDATE or */
+ /* DELETE statement */
+ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ char sqlwarn[8];
+ /* Element 0: set to 'W' if at least one other is 'W' */
+ /* 1: if 'W' at least one character string */
+ /* value was truncated when it was */
+ /* stored into a host variable. */
+
+ /*
+ * 2: if 'W' a (hopefully) non-fatal notice occurred
+ */ /* 3: empty */
+ /* 4: empty */
+ /* 5: empty */
+ /* 6: empty */
+ /* 7: empty */
+
+ char sqlstate[5];
+};
+
+struct sqlca_t *ECPGget_sqlca(void);
+
+#ifndef POSTGRES_ECPG_INTERNAL
+#define sqlca (*ECPGget_sqlca())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#line 26 "prep.pgc"
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 27 "prep.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 29 "prep.pgc"
+
+/* exec sql whenever not found sqlprint ; */
+#line 30 "prep.pgc"
+
+
+#ifdef WIN32
+static unsigned __stdcall fn(void* arg)
+#else
+static void* fn(void* arg)
+#endif
+{
+ int i;
+
+ /* exec sql begin declare section */
+
+
+
+
+#line 41 "prep.pgc"
+ int value ;
+
+#line 42 "prep.pgc"
+ char name [ 100 ] ;
+
+#line 43 "prep.pgc"
+ char query [ 256 ] = "INSERT INTO T VALUES ( ? )" ;
+/* exec sql end declare section */
+#line 44 "prep.pgc"
+
+
+ value = (intptr_t) arg;
+ sprintf(name, "Connection: %d", value);
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , name, 0);
+#line 49 "prep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 49 "prep.pgc"
+
+ { ECPGsetcommit(__LINE__, "on", NULL);
+#line 50 "prep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 50 "prep.pgc"
+
+ for (i = 1; i <= REPEATS; ++i)
+ {
+ { ECPGprepare(__LINE__, NULL, 0, "i", query);
+#line 53 "prep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 53 "prep.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "i",
+ ECPGt_int,&(value),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 54 "prep.pgc"
+
+if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
+#line 54 "prep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 54 "prep.pgc"
+
+ }
+ { ECPGdeallocate(__LINE__, 0, NULL, "i");
+#line 56 "prep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 56 "prep.pgc"
+
+ { ECPGdisconnect(__LINE__, name);
+#line 57 "prep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 57 "prep.pgc"
+
+
+ return 0;
+}
+
+int main ()
+{
+ intptr_t i;
+#ifdef WIN32
+ HANDLE threads[THREADS];
+#else
+ pthread_t threads[THREADS];
+#endif
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 71 "prep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 71 "prep.pgc"
+
+ { ECPGsetcommit(__LINE__, "on", NULL);
+#line 72 "prep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 72 "prep.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table if exists T", ECPGt_EOIT, ECPGt_EORT);
+#line 73 "prep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 73 "prep.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table T ( i int )", ECPGt_EOIT, ECPGt_EORT);
+#line 74 "prep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 74 "prep.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 75 "prep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 75 "prep.pgc"
+
+
+#ifdef WIN32
+ for (i = 0; i < THREADS; ++i)
+ {
+ unsigned id;
+ threads[i] = (HANDLE)_beginthreadex(NULL, 0, fn, (void*)i, 0, &id);
+ }
+
+ WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE);
+ for (i = 0; i < THREADS; ++i)
+ CloseHandle(threads[i]);
+#else
+ for (i = 0; i < THREADS; ++i)
+ pthread_create(&threads[i], NULL, fn, (void *) i);
+ for (i = 0; i < THREADS; ++i)
+ pthread_join(threads[i], NULL);
+#endif
+
+ return 0;
+}
+#endif
diff --git a/src/interfaces/ecpg/test/expected/thread-prep.stderr b/src/interfaces/ecpg/test/expected/thread-prep.stderr
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-prep.stderr
diff --git a/src/interfaces/ecpg/test/expected/thread-prep.stdout b/src/interfaces/ecpg/test/expected/thread-prep.stdout
new file mode 100644
index 0000000..75fe16b
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-prep.stdout
@@ -0,0 +1 @@
+No threading enabled.
diff --git a/src/interfaces/ecpg/test/expected/thread-prep_2.stdout b/src/interfaces/ecpg/test/expected/thread-prep_2.stdout
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-prep_2.stdout
diff --git a/src/interfaces/ecpg/test/expected/thread-thread.c b/src/interfaces/ecpg/test/expected/thread-thread.c
new file mode 100644
index 0000000..0e75c47
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-thread.c
@@ -0,0 +1,216 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "thread.pgc"
+/*
+ * Thread test program
+ * by Philip Yarra & Lee Kindness.
+ */
+#include <stdint.h>
+#include <stdlib.h>
+#include "ecpg_config.h"
+
+#ifndef ENABLE_THREAD_SAFETY
+int
+main(void)
+{
+ printf("No threading enabled.\n");
+ return 0;
+}
+#else
+#ifndef WIN32
+#include <pthread.h>
+#else
+#include <windows.h>
+#include <locale.h>
+#endif
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 24 "thread.pgc"
+
+
+void *test_thread(void *arg);
+
+int nthreads = 10;
+int iterations = 20;
+
+int main()
+{
+#ifndef WIN32
+ pthread_t *threads;
+#else
+ HANDLE *threads;
+#endif
+ intptr_t n;
+ /* exec sql begin declare section */
+
+
+#line 40 "thread.pgc"
+ int l_rows ;
+/* exec sql end declare section */
+#line 41 "thread.pgc"
+
+
+ /* Do not switch on debug output for regression tests. The threads get executed in
+ * more or less random order */
+ /* ECPGdebug(1, stderr); */
+
+ /* setup test_thread table */
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 48 "thread.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test_thread", ECPGt_EOIT, ECPGt_EORT);}
+#line 49 "thread.pgc"
+ /* DROP might fail */
+ { ECPGtrans(__LINE__, NULL, "commit");}
+#line 50 "thread.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test_thread ( tstamp timestamp not null default cast ( timeofday ( ) as timestamp ) , thread text not null , iteration integer not null , primary key ( thread , iteration ) )", ECPGt_EOIT, ECPGt_EORT);}
+#line 55 "thread.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");}
+#line 56 "thread.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 57 "thread.pgc"
+
+
+ /* create, and start, threads */
+ threads = calloc(nthreads, sizeof(threads[0]));
+ if( threads == NULL )
+ {
+ fprintf(stderr, "Cannot alloc memory\n");
+ return 1;
+ }
+ for( n = 0; n < nthreads; n++ )
+ {
+#ifndef WIN32
+ pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
+#else
+ threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) (void (*) (void)) test_thread, (void *) (n + 1), 0, NULL);
+#endif
+ }
+
+ /* wait for thread completion */
+#ifndef WIN32
+ for( n = 0; n < nthreads; n++ )
+ {
+ pthread_join(threads[n], NULL);
+ }
+#else
+ WaitForMultipleObjects(nthreads, threads, TRUE, INFINITE);
+#endif
+ free(threads);
+
+ /* and check results */
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 87 "thread.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from test_thread", ECPGt_EOIT,
+ ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 88 "thread.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");}
+#line 89 "thread.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 90 "thread.pgc"
+
+ if( l_rows == (nthreads * iterations) )
+ printf("Success.\n");
+ else
+ printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows);
+
+ return 0;
+}
+
+void *test_thread(void *arg)
+{
+ long threadnum = (intptr_t) arg;
+
+ /* exec sql begin declare section */
+
+
+
+#line 104 "thread.pgc"
+ int l_i ;
+
+#line 105 "thread.pgc"
+ char l_connection [ 128 ] ;
+/* exec sql end declare section */
+#line 106 "thread.pgc"
+
+
+ /* build up connection name, and connect to database */
+#ifndef _MSC_VER
+ snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
+#else
+ _snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
+#endif
+ /* exec sql whenever sqlerror sqlprint ; */
+#line 114 "thread.pgc"
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , l_connection, 0);
+#line 115 "thread.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 115 "thread.pgc"
+
+ if( sqlca.sqlcode != 0 )
+ {
+ printf("%s: ERROR: cannot connect to database!\n", l_connection);
+ return NULL;
+ }
+ { ECPGtrans(__LINE__, l_connection, "begin");
+#line 121 "thread.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 121 "thread.pgc"
+
+
+ /* insert into test_thread table */
+ for( l_i = 1; l_i <= iterations; l_i++ )
+ {
+ { ECPGdo(__LINE__, 0, 1, l_connection, 0, ECPGst_normal, "insert into test_thread ( thread , iteration ) values ( $1 , $2 )",
+ ECPGt_char,(l_connection),(long)128,(long)1,(128)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 126 "thread.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 126 "thread.pgc"
+
+ if( sqlca.sqlcode != 0 )
+ printf("%s: ERROR: insert failed!\n", l_connection);
+ }
+
+ /* all done */
+ { ECPGtrans(__LINE__, l_connection, "commit");
+#line 132 "thread.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 132 "thread.pgc"
+
+ { ECPGdisconnect(__LINE__, l_connection);
+#line 133 "thread.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 133 "thread.pgc"
+
+ return NULL;
+}
+#endif /* ENABLE_THREAD_SAFETY */
diff --git a/src/interfaces/ecpg/test/expected/thread-thread.stderr b/src/interfaces/ecpg/test/expected/thread-thread.stderr
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-thread.stderr
diff --git a/src/interfaces/ecpg/test/expected/thread-thread.stdout b/src/interfaces/ecpg/test/expected/thread-thread.stdout
new file mode 100644
index 0000000..75fe16b
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-thread.stdout
@@ -0,0 +1 @@
+No threading enabled.
diff --git a/src/interfaces/ecpg/test/expected/thread-thread_2.stdout b/src/interfaces/ecpg/test/expected/thread-thread_2.stdout
new file mode 100644
index 0000000..a9d787c
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-thread_2.stdout
@@ -0,0 +1 @@
+Success.
diff --git a/src/interfaces/ecpg/test/expected/thread-thread_implicit.c b/src/interfaces/ecpg/test/expected/thread-thread_implicit.c
new file mode 100644
index 0000000..0df2794
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-thread_implicit.c
@@ -0,0 +1,216 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "thread_implicit.pgc"
+/*
+ * Thread test program
+ * by Lee Kindness.
+ */
+#include <stdint.h>
+#include <stdlib.h>
+#include "ecpg_config.h"
+
+#ifndef ENABLE_THREAD_SAFETY
+int
+main(void)
+{
+ printf("No threading enabled.\n");
+ return 0;
+}
+#else
+#ifndef WIN32
+#include <pthread.h>
+#else
+#include <windows.h>
+#include <locale.h>
+#endif
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 24 "thread_implicit.pgc"
+
+
+void *test_thread(void *arg);
+
+int nthreads = 10;
+int iterations = 20;
+
+int main()
+{
+#ifndef WIN32
+ pthread_t *threads;
+#else
+ HANDLE *threads;
+#endif
+ intptr_t n;
+ /* exec sql begin declare section */
+
+
+#line 40 "thread_implicit.pgc"
+ int l_rows ;
+/* exec sql end declare section */
+#line 41 "thread_implicit.pgc"
+
+
+ /* Do not switch on debug output for regression tests. The threads get executed in
+ * more or less random order */
+ /* ECPGdebug(1, stderr); */
+
+ /* setup test_thread table */
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 48 "thread_implicit.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test_thread", ECPGt_EOIT, ECPGt_EORT);}
+#line 49 "thread_implicit.pgc"
+ /* DROP might fail */
+ { ECPGtrans(__LINE__, NULL, "commit");}
+#line 50 "thread_implicit.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test_thread ( tstamp timestamp not null default cast ( timeofday ( ) as timestamp ) , thread text not null , iteration integer not null , primary key ( thread , iteration ) )", ECPGt_EOIT, ECPGt_EORT);}
+#line 55 "thread_implicit.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");}
+#line 56 "thread_implicit.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 57 "thread_implicit.pgc"
+
+
+ /* create, and start, threads */
+ threads = calloc(nthreads, sizeof(threads[0]));
+ if( threads == NULL )
+ {
+ fprintf(stderr, "Cannot alloc memory\n");
+ return 1;
+ }
+ for( n = 0; n < nthreads; n++ )
+ {
+#ifndef WIN32
+ pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
+#else
+ threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) (void (*) (void)) test_thread, (void *) (n+1), 0, NULL);
+#endif
+ }
+
+ /* wait for thread completion */
+#ifndef WIN32
+ for( n = 0; n < nthreads; n++ )
+ {
+ pthread_join(threads[n], NULL);
+ }
+#else
+ WaitForMultipleObjects(nthreads, threads, TRUE, INFINITE);
+#endif
+ free(threads);
+
+ /* and check results */
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
+#line 87 "thread_implicit.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from test_thread", ECPGt_EOIT,
+ ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
+#line 88 "thread_implicit.pgc"
+
+ { ECPGtrans(__LINE__, NULL, "commit");}
+#line 89 "thread_implicit.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 90 "thread_implicit.pgc"
+
+ if( l_rows == (nthreads * iterations) )
+ printf("Success.\n");
+ else
+ printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows);
+
+ return 0;
+}
+
+void *test_thread(void *arg)
+{
+ long threadnum = (intptr_t) arg;
+
+ /* exec sql begin declare section */
+
+
+
+#line 104 "thread_implicit.pgc"
+ int l_i ;
+
+#line 105 "thread_implicit.pgc"
+ char l_connection [ 128 ] ;
+/* exec sql end declare section */
+#line 106 "thread_implicit.pgc"
+
+
+ /* build up connection name, and connect to database */
+#ifndef _MSC_VER
+ snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
+#else
+ _snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
+#endif
+ /* exec sql whenever sqlerror sqlprint ; */
+#line 114 "thread_implicit.pgc"
+
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , l_connection, 0);
+#line 115 "thread_implicit.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 115 "thread_implicit.pgc"
+
+ if( sqlca.sqlcode != 0 )
+ {
+ printf("%s: ERROR: cannot connect to database!\n", l_connection);
+ return NULL;
+ }
+ { ECPGtrans(__LINE__, NULL, "begin");
+#line 121 "thread_implicit.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 121 "thread_implicit.pgc"
+
+
+ /* insert into test_thread table */
+ for( l_i = 1; l_i <= iterations; l_i++ )
+ {
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test_thread ( thread , iteration ) values ( $1 , $2 )",
+ ECPGt_char,(l_connection),(long)128,(long)1,(128)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+#line 126 "thread_implicit.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 126 "thread_implicit.pgc"
+
+ if( sqlca.sqlcode != 0 )
+ printf("%s: ERROR: insert failed!\n", l_connection);
+ }
+
+ /* all done */
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 132 "thread_implicit.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 132 "thread_implicit.pgc"
+
+ { ECPGdisconnect(__LINE__, l_connection);
+#line 133 "thread_implicit.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 133 "thread_implicit.pgc"
+
+ return NULL;
+}
+#endif /* ENABLE_THREAD_SAFETY */
diff --git a/src/interfaces/ecpg/test/expected/thread-thread_implicit.stderr b/src/interfaces/ecpg/test/expected/thread-thread_implicit.stderr
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-thread_implicit.stderr
diff --git a/src/interfaces/ecpg/test/expected/thread-thread_implicit.stdout b/src/interfaces/ecpg/test/expected/thread-thread_implicit.stdout
new file mode 100644
index 0000000..75fe16b
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-thread_implicit.stdout
@@ -0,0 +1 @@
+No threading enabled.
diff --git a/src/interfaces/ecpg/test/expected/thread-thread_implicit_2.stdout b/src/interfaces/ecpg/test/expected/thread-thread_implicit_2.stdout
new file mode 100644
index 0000000..a9d787c
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/thread-thread_implicit_2.stdout
@@ -0,0 +1 @@
+Success.