27.patch

text/x-patch

Filename: 27.patch
Type: text/x-patch
Part: 0
Message: Followup patches for ECPG readahead, was: Re: ECPG FETCH readahead

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
doc/src/sgml/ecpg.sgml 4 1
src/interfaces/ecpg/ecpglib/cursor.c 40 3
src/interfaces/ecpg/include/ecpglib.h 1 1
src/interfaces/ecpg/preproc/ecpg.addons 5 1
src/interfaces/ecpg/preproc/ecpg.trailer 4 0
src/interfaces/ecpg/preproc/output.c 2 2
src/interfaces/ecpg/preproc/type.h 1 0
src/interfaces/ecpg/test/expected/compat_informix-sqlda.c 2 2
src/interfaces/ecpg/test/expected/compat_informix-test_informix.c 1 1
src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c 3 3
src/interfaces/ecpg/test/expected/preproc-autoprep.c 2 2
src/interfaces/ecpg/test/expected/preproc-cursor.c 5 5
src/interfaces/ecpg/test/expected/preproc-outofscope.c 1 1
src/interfaces/ecpg/test/expected/preproc-variable.c 1 1
src/interfaces/ecpg/test/expected/sql-binary.c 3 3
src/interfaces/ecpg/test/expected/sql-cursor-ra-fetch.c 10 10
src/interfaces/ecpg/test/expected/sql-cursor-ra-move.c 6 6
src/interfaces/ecpg/test/expected/sql-cursor-ra-swdir.c 1 1
src/interfaces/ecpg/test/expected/sql-cursorsubxact.c 7 7
src/interfaces/ecpg/test/expected/sql-desc.c 2 2
src/interfaces/ecpg/test/expected/sql-dyntest.c 1 1
src/interfaces/ecpg/test/expected/sql-execute.c 2 2
src/interfaces/ecpg/test/expected/sql-fetch.c 2 2
src/interfaces/ecpg/test/expected/sql-oldexec.c 2 2
src/interfaces/ecpg/test/expected/sql-quote.c 1 1
src/interfaces/ecpg/test/expected/sql-sqlda.c 2 2
commit c6ba221f6a83f193303aa40e55ff917ec57e6967
Author: Böszörményi Zoltán <zb@cybertec.at>
Date:   Wed Nov 20 13:37:45 2013 +0100

    ECPG: Allow overriding the cursor readahead window size using
    an environment variable for cursors where READAHEAD N was not
    explicitly specified. Preprocessed C source of some regression
    tests have changed.

diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml
index bdea033..1c8ebe9 100644
--- a/doc/src/sgml/ecpg.sgml
+++ b/doc/src/sgml/ecpg.sgml
@@ -463,7 +463,10 @@ EXEC SQL COMMIT;
    Option <option>-r readahead=number</option> on the ECPG command line modifies
    the default readahead window size for all cursors. Explicit
    <literal>READAHEAD number</literal> sets the readahead window size for
-   the specified cursor.
+   the specified cursor. If this clause is not explicitly specified for a cursor
+   (option <option>-r readahead=number</option> is considered implicit), then
+   setting the <literal>ECPGFETCHSZ</literal> environment variable overrides
+   the readahead window size for all such cursors.
   </para>
 
   <para>
diff --git a/src/interfaces/ecpg/ecpglib/cursor.c b/src/interfaces/ecpg/ecpglib/cursor.c
index 7084752..88f7d2c 100644
--- a/src/interfaces/ecpg/ecpglib/cursor.c
+++ b/src/interfaces/ecpg/ecpglib/cursor.c
@@ -15,6 +15,12 @@
 #include "ecpgerrno.h"
 #include "extern.h"
 
+static bool	envvars_read = false;	/* the variables below are already
+					   initialized */
+static int	default_fetch_size = -1;/* use this value instead of the
+					   passed-in per-cursor window size.
+					   -1 means unset. */
+
 static char *ecpg_cursor_direction_sql_name[] = {
 	"absolute",
 	"relative",
@@ -25,7 +31,7 @@ static char *ecpg_cursor_direction_sql_name[] = {
 	"forward",
 	"backward"
 };
- 
+
 static bool ecpg_cursor_do_move_all(struct statement *stmt,
 					struct cursor_descriptor *cur,
 					enum ECPG_cursor_direction direction,
@@ -291,7 +297,7 @@ bool
 ECPGopen(const int lineno, const int compat, const int force_indicator,
 			const char *connection_name, const bool questionmarks,
 			const bool with_hold, enum ECPG_cursor_scroll scrollable,
-			long readahead,
+			long readahead, const bool allow_ra_override,
 			const char *curname, const int st, const char *query, ...)
 {
 	struct connection *con = ecpg_get_connection(connection_name);
@@ -371,6 +377,35 @@ ECPGopen(const int lineno, const int compat, const int force_indicator,
 
 	ecpg_do_epilogue(stmt);
 
+	/* Process the environment variables only once */
+	if (!envvars_read)
+	{
+		char	   *tmp, *endptr;
+		long		fetch_size_env;
+
+		/*
+		 * If ECPGFETCHSZ is set, interpret it.
+		 * - If invalid or unset, ignore. Leave default_fetch_size == -1
+		 * - If ECPGFETCHSZ <= 0, caching is disabled (readahead = 1)
+		 * - Otherwise use the actual number
+		 */
+		tmp = getenv("ECPGFETCHSZ");
+		if (tmp)
+		{
+			fetch_size_env = strtol(tmp, &endptr, 10);
+			if (*endptr)
+				fetch_size_env = -1;
+			else
+			{
+				/* Readahead disabled */
+				if (fetch_size_env <= 0)
+					fetch_size_env = 1;
+			}
+			default_fetch_size = fetch_size_env;
+		}
+		envvars_read = true;
+	}
+
 	/* Finally add the cursor to the connection. */
 	if (con->subxact_desc)
 		subxact_level = con->subxact_desc->level;
@@ -378,7 +413,9 @@ ECPGopen(const int lineno, const int compat, const int force_indicator,
 		subxact_level =
 			(PQtransactionStatus(con->connection) != PQTRANS_IDLE ?
 										1 : 0);
-	add_cursor(lineno, con, curname, subxact_level, with_hold, scrollable, readahead);
+	add_cursor(lineno, con, curname, subxact_level, with_hold, scrollable,
+					(allow_ra_override && default_fetch_size >= 1 ?
+						default_fetch_size : readahead));
 
 	return true;
 }
diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h
index 76735a0..6fb7755 100644
--- a/src/interfaces/ecpg/include/ecpglib.h
+++ b/src/interfaces/ecpg/include/ecpglib.h
@@ -65,7 +65,7 @@ char	   *ECPGerrmsg(void);
 
 /* Cursor functions */
 bool		ECPGopen(const int, const int, const int, const char *, const bool, const bool,
-				enum ECPG_cursor_scroll, long readahead,
+				enum ECPG_cursor_scroll, long, const bool,
 				const char *, const int, const char *, ...);
 bool		ECPGfetch(const int, const int, const int, const char *, const bool,
 				enum ECPG_cursor_direction, const char *, bool,
diff --git a/src/interfaces/ecpg/preproc/ecpg.addons b/src/interfaces/ecpg/preproc/ecpg.addons
index d3f47aa..96d9c56 100644
--- a/src/interfaces/ecpg/preproc/ecpg.addons
+++ b/src/interfaces/ecpg/preproc/ecpg.addons
@@ -535,14 +535,18 @@ ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsopt_readaheadCURSORopt_ho
 		this->with_hold = (strncmp($6, "with ", 5) == 0);
 		this->scrollable = current_cursor_scrollable;
 		if (strcmp($4, "default") == 0)
+		{
+			this->allow_ra_override = true;
 			this->fetch_readahead = fetch_readahead;
+		}
 		else
 		{
 			int	this_readahead = atoi($4);
 
 			if (this_readahead < 1)
 				mmerror(PARSE_ERROR, ET_ERROR, "cursor readahead cannot be less than 1");
-			this->fetch_readahead = atoi($4);
+			this->allow_ra_override = false;
+			this->fetch_readahead = this_readahead;
 		}
 		this->vartype = current_cursor_vartype;
 		this->command =  cat_str(7, mm_strdup("declare"), cursor_marker, $3, mm_strdup("cursor"), $6, mm_strdup("for"), $8);
diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer b/src/interfaces/ecpg/preproc/ecpg.trailer
index fa6b5e6..99dd117 100644
--- a/src/interfaces/ecpg/preproc/ecpg.trailer
+++ b/src/interfaces/ecpg/preproc/ecpg.trailer
@@ -319,13 +319,17 @@ ECPGCursorStmt:	DECLARE cursor_name cursor_options opt_readahead CURSOR opt_hold
 			this->with_hold = (strncmp($6, "with ", 5) == 0);
 			this->scrollable = current_cursor_scrollable;
 			if (strcmp($4, "default") == 0)
+			{
+				this->allow_ra_override = true;
 				this->fetch_readahead = fetch_readahead;
+			}
 			else
 			{
 				int	this_readahead = atoi($4);
 
 				if (this_readahead < 1)
 					mmerror(PARSE_ERROR, ET_ERROR, "cursor readahead cannot be less than 1");
+				this->allow_ra_override = false;
 				this->fetch_readahead = this_readahead;
 			}
 			this->vartype = current_cursor_vartype;
diff --git a/src/interfaces/ecpg/preproc/output.c b/src/interfaces/ecpg/preproc/output.c
index 8d0c3a5..5a206cc 100644
--- a/src/interfaces/ecpg/preproc/output.c
+++ b/src/interfaces/ecpg/preproc/output.c
@@ -243,10 +243,10 @@ output_open_statement(char *stmt, int whenever_mode, enum ECPG_statement_type st
 {
 	struct cursor *ptr = get_cursor(current_cursor);
 
-	fprintf(yyout, "{ ECPGopen(__LINE__, %d, %d, %s, %d, %d, %s, %ld, ",
+	fprintf(yyout, "{ ECPGopen(__LINE__, %d, %d, %s, %d, %d, %s, %ld, %d, ",
 						compat, force_indicator, connection ? connection : "NULL", questionmarks,
 						ptr->with_hold, ecpg_cursor_scroll_name[ptr->scrollable],
-						ptr->fetch_readahead);
+						ptr->fetch_readahead, ptr->allow_ra_override);
 	output_cursor_name(ptr);
 	output_statement_epilogue(stmt, whenever_mode, st);
 }
diff --git a/src/interfaces/ecpg/preproc/type.h b/src/interfaces/ecpg/preproc/type.h
index 50a6057..be93397 100644
--- a/src/interfaces/ecpg/preproc/type.h
+++ b/src/interfaces/ecpg/preproc/type.h
@@ -130,6 +130,7 @@ struct cursor
 	char	   *connection;
 	bool		opened;
 	bool		with_hold;
+	bool		allow_ra_override;
 	long		fetch_readahead;
 	enum ECPGttype	vartype;
 	enum ECPG_cursor_scroll scrollable;
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
index 61c1027..2650987 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
@@ -241,7 +241,7 @@ if (sqlca.sqlcode < 0) exit (1);}
 
 
 	strcpy(msg, "open");
-	{ ECPGopen(__LINE__, 1, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "mycur1", ECPGst_normal, "declare mycur1 cursor for $1", 
+	{ ECPGopen(__LINE__, 1, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "mycur1", 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"
@@ -316,7 +316,7 @@ if (sqlca.sqlcode < 0) exit (1);}
 
 
 	strcpy(msg, "open");
-	{ ECPGopen(__LINE__, 1, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "mycur2", ECPGst_normal, "declare mycur2 cursor for $1", 
+	{ ECPGopen(__LINE__, 1, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "mycur2", 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"
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
index 650c9b1..7085780 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
@@ -244,7 +244,7 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
 
 static void openit(void)
 {
-	{ ECPGopen(__LINE__, 1, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "c", ECPGst_normal, "declare c cursor for select * from test where i <= $1 ", 
+	{ ECPGopen(__LINE__, 1, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "c", 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 95 "test_informix.pgc"
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c b/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
index 0cfa63a..f81edd2 100644
--- a/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
@@ -82,7 +82,7 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
 	/* declare cur cursor for select id , d , d from nantest1 */
 #line 33 "nan_test.pgc"
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "cur", ECPGst_normal, "declare cur cursor for select id , d , d from nantest1", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "cur", ECPGst_normal, "declare cur cursor for select id , d , d from nantest1", ECPGt_EOIT, ECPGt_EORT);
 #line 34 "nan_test.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint ( );}
@@ -137,7 +137,7 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
 #line 48 "nan_test.pgc"
 
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "cur", ECPGst_normal, "declare cur cursor for select id , d , d from nantest1", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "cur", ECPGst_normal, "declare cur cursor for select id , d , d from nantest1", ECPGt_EOIT, ECPGt_EORT);
 #line 50 "nan_test.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint ( );}
@@ -221,7 +221,7 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
 	/* declare cur1 cursor for select id , d , d from nantest2 */
 #line 75 "nan_test.pgc"
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "cur1", ECPGst_normal, "declare cur1 cursor for select id , d , d from nantest2", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "cur1", ECPGst_normal, "declare cur1 cursor for select id , d , d from nantest2", ECPGt_EOIT, ECPGt_EORT);
 #line 76 "nan_test.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint ( );}
diff --git a/src/interfaces/ecpg/test/expected/preproc-autoprep.c b/src/interfaces/ecpg/test/expected/preproc-autoprep.c
index 3e13351..8230135 100644
--- a/src/interfaces/ecpg/test/expected/preproc-autoprep.c
+++ b/src/interfaces/ecpg/test/expected/preproc-autoprep.c
@@ -133,7 +133,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 #line 35 "autoprep.pgc"
 
 
-  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "C", ECPGst_normal, "declare C cursor for select Item1 from T", ECPGt_EOIT, ECPGt_EORT);
+  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "C", ECPGst_normal, "declare C cursor for select Item1 from T", ECPGt_EOIT, ECPGt_EORT);
 #line 37 "autoprep.pgc"
 
 if (sqlca.sqlwarn[0] == 'W') sqlprint();
@@ -180,7 +180,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 #line 46 "autoprep.pgc"
 
 
-  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "cur1", ECPGst_normal, "declare cur1 cursor for $1", 
+  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "cur1", 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"
diff --git a/src/interfaces/ecpg/test/expected/preproc-cursor.c b/src/interfaces/ecpg/test/expected/preproc-cursor.c
index ed07e09..18acd70 100644
--- a/src/interfaces/ecpg/test/expected/preproc-cursor.c
+++ b/src/interfaces/ecpg/test/expected/preproc-cursor.c
@@ -187,7 +187,7 @@ if (sqlca.sqlcode < 0) exit (1);}
 
 
 	strcpy(msg, "open");
-	{ ECPGopen(__LINE__, 0, 1, "test1", 0, 0, ECPGcs_unspecified, 1, curname1, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
+	{ ECPGopen(__LINE__, 0, 1, "test1", 0, 0, ECPGcs_unspecified, 1, 1, curname1, 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"
@@ -323,7 +323,7 @@ if (sqlca.sqlcode < 0) exit (1);}
 
 
 	strcpy(msg, "open");
-	{ ECPGopen(__LINE__, 0, 1, "test1", 0, 0, ECPGcs_unspecified, 1, curname2, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
+	{ ECPGopen(__LINE__, 0, 1, "test1", 0, 0, ECPGcs_unspecified, 1, 1, curname2, 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), 
@@ -483,7 +483,7 @@ if (sqlca.sqlcode < 0) exit (1);}
 
 
 	strcpy(msg, "open");
-	{ ECPGopen(__LINE__, 0, 1, "test1", 0, 0, ECPGcs_unspecified, 1, curname3, ECPGst_normal, "declare $0 cursor for $1", 
+	{ ECPGopen(__LINE__, 0, 1, "test1", 0, 0, ECPGcs_unspecified, 1, 1, curname3, 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), 
@@ -493,7 +493,7 @@ if (sqlca.sqlcode < 0) exit (1);}
 if (sqlca.sqlcode < 0) exit (1);}
 #line 153 "cursor.pgc"
 
-	{ ECPGopen(__LINE__, 0, 1, "test2", 0, 0, ECPGcs_unspecified, 1, curname5, ECPGst_normal, "declare $0 cursor for $1", 
+	{ ECPGopen(__LINE__, 0, 1, "test2", 0, 0, ECPGcs_unspecified, 1, 1, curname5, 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), 
@@ -663,7 +663,7 @@ if (sqlca.sqlcode < 0) exit (1);}
 
 
 	strcpy(msg, "open");
-	{ ECPGopen(__LINE__, 0, 1, "test1", 0, 0, ECPGcs_unspecified, 1, curname4.arr, ECPGst_normal, "declare $0 cursor for $1", 
+	{ ECPGopen(__LINE__, 0, 1, "test1", 0, 0, ECPGcs_unspecified, 1, 1, curname4.arr, 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), 
diff --git a/src/interfaces/ecpg/test/expected/preproc-outofscope.c b/src/interfaces/ecpg/test/expected/preproc-outofscope.c
index 59bb7de..8979c44 100644
--- a/src/interfaces/ecpg/test/expected/preproc-outofscope.c
+++ b/src/interfaces/ecpg/test/expected/preproc-outofscope.c
@@ -201,7 +201,7 @@ get_var1(MYTYPE **myvar0, MYNULLTYPE **mynullvar0)
 static void
 open_cur1(void)
 {
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "mycur", ECPGst_normal, "declare mycur cursor for select * from a1", ECPGt_EOIT, 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "mycur", ECPGst_normal, "declare mycur cursor for select * from a1", ECPGt_EOIT, 
 	ECPGt_int,&((*( MYTYPE  *)(ECPGget_var( 0)) ).id),(long)1,(long)1,sizeof(int), 
 	ECPGt_int,&((*( MYNULLTYPE  *)(ECPGget_var( 1)) ).id),(long)1,(long)1,sizeof(int), 
 	ECPGt_char,&((*( MYTYPE  *)(ECPGget_var( 0)) ).t),(long)64,(long)1,(64)*sizeof(char), 
diff --git a/src/interfaces/ecpg/test/expected/preproc-variable.c b/src/interfaces/ecpg/test/expected/preproc-variable.c
index 81b4ac3..d0b921f 100644
--- a/src/interfaces/ecpg/test/expected/preproc-variable.c
+++ b/src/interfaces/ecpg/test/expected/preproc-variable.c
@@ -190,7 +190,7 @@ if (sqlca.sqlcode < 0) exit (1);}
 
 
 	strcpy(msg, "open");
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "cur", ECPGst_normal, "declare cur cursor for select name , born , age , married , children from family", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "cur", 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);}
diff --git a/src/interfaces/ecpg/test/expected/sql-binary.c b/src/interfaces/ecpg/test/expected/sql-binary.c
index 94c2b05..8874e24 100644
--- a/src/interfaces/ecpg/test/expected/sql-binary.c
+++ b/src/interfaces/ecpg/test/expected/sql-binary.c
@@ -111,7 +111,7 @@ main (void)
  /* declare C cursor for select name , accs , byte from empl where idnum = $1  */
 #line 58 "binary.pgc"
 
-  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "C", ECPGst_normal, "declare C cursor for select name , accs , byte from empl where idnum = $1 ", 
+  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "C", 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 59 "binary.pgc"
@@ -142,7 +142,7 @@ main (void)
  /* declare B binary cursor for select name , accs , byte from empl where idnum = $1  */
 #line 72 "binary.pgc"
 
-  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "B", ECPGst_normal, "declare B binary cursor for select name , accs , byte from empl where idnum = $1 ", 
+  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "B", 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 73 "binary.pgc"
@@ -176,7 +176,7 @@ main (void)
  /* declare A binary cursor for select byte from empl where idnum = $1  */
 #line 89 "binary.pgc"
 
-  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "A", ECPGst_normal, "declare A binary cursor for select byte from empl where idnum = $1 ", 
+  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "A", 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 90 "binary.pgc"
diff --git a/src/interfaces/ecpg/test/expected/sql-cursor-ra-fetch.c b/src/interfaces/ecpg/test/expected/sql-cursor-ra-fetch.c
index 800da8f..47ded6b 100644
--- a/src/interfaces/ecpg/test/expected/sql-cursor-ra-fetch.c
+++ b/src/interfaces/ecpg/test/expected/sql-cursor-ra-fetch.c
@@ -83,7 +83,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("test scroll_cur for move absolute n (every 4th tuple forward, positive positions)\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, 0, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 38 "cursor-ra-fetch.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -150,7 +150,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("\ntest scroll_cur for move absolute n (every 4th tuple backward, negative positions)\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, 0, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 73 "cursor-ra-fetch.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -217,7 +217,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("\ntest scroll_cur for fetch relative 4 (positive positions)\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, 0, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 108 "cursor-ra-fetch.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -290,7 +290,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("\ntest scroll_cur for fetch relative -4 (negative positions)\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, 0, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 153 "cursor-ra-fetch.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -380,7 +380,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("\ntest scroll_cur for fetch forward 4 (positive positions)\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, 0, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 205 "cursor-ra-fetch.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -453,7 +453,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("\ntest scroll_cur for fetch forward -4 (negative positions)\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, 0, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 250 "cursor-ra-fetch.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -544,7 +544,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("\ntest scroll_cur4 for move absolute n (every 5th tuple forward, positive positions)\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 4, "scroll_cur4", ECPGst_normal, "declare scroll_cur4 scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 4, 0, "scroll_cur4", ECPGst_normal, "declare scroll_cur4 scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 303 "cursor-ra-fetch.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -655,7 +655,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("\ntest scroll_cur4 for move absolute n (every 5th tuple backward, negative positions)\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 4, "scroll_cur4", ECPGst_normal, "declare scroll_cur4 scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 4, 0, "scroll_cur4", ECPGst_normal, "declare scroll_cur4 scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 364 "cursor-ra-fetch.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -767,7 +767,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("\ntest scroll_cur4 for fetch relative 5 (positive positions)\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 4, "scroll_cur4", ECPGst_normal, "declare scroll_cur4 scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 4, 0, "scroll_cur4", ECPGst_normal, "declare scroll_cur4 scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 426 "cursor-ra-fetch.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -889,7 +889,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("\ntest scroll_cur4 for move relative -5 (negative positions)\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 4, "scroll_cur4", ECPGst_normal, "declare scroll_cur4 scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 4, 0, "scroll_cur4", ECPGst_normal, "declare scroll_cur4 scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 497 "cursor-ra-fetch.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
diff --git a/src/interfaces/ecpg/test/expected/sql-cursor-ra-move.c b/src/interfaces/ecpg/test/expected/sql-cursor-ra-move.c
index a8d01a3..47d71b1 100644
--- a/src/interfaces/ecpg/test/expected/sql-cursor-ra-move.c
+++ b/src/interfaces/ecpg/test/expected/sql-cursor-ra-move.c
@@ -76,7 +76,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("test scroll_cur for move absolute -1\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, 0, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 35 "cursor-ra-move.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -105,7 +105,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("test noscroll_cur for move absolute -1\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_no_scroll, 8, "noscroll_cur", ECPGst_normal, "declare noscroll_cur no scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_no_scroll, 8, 0, "noscroll_cur", ECPGst_normal, "declare noscroll_cur no scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 49 "cursor-ra-move.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -134,7 +134,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("test unspec_cur1 for move absolute -1\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 8, "unspec_cur1", ECPGst_normal, "declare unspec_cur1 cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 8, 0, "unspec_cur1", ECPGst_normal, "declare unspec_cur1 cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 63 "cursor-ra-move.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -163,7 +163,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("test unspec_cur2 for move absolute -1\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 8, "unspec_cur2", ECPGst_normal, "declare unspec_cur2 cursor for select t1 . id , t1 . t , t2 . id , t2 . t from t1 join t1 as t2 on ( t1 . id = 27 - t2 . id ) order by t1 . id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 8, 0, "unspec_cur2", ECPGst_normal, "declare unspec_cur2 cursor for select t1 . id , t1 . t , t2 . id , t2 . t from t1 join t1 as t2 on ( t1 . id = 27 - t2 . id ) order by t1 . id", ECPGt_EOIT, ECPGt_EORT);
 #line 77 "cursor-ra-move.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -194,7 +194,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("test scroll_cur for move relative 8\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, 0, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 93 "cursor-ra-move.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
@@ -248,7 +248,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	printf("test scroll_cur for move forward 8\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_scroll, 8, 0, "scroll_cur", ECPGst_normal, "declare scroll_cur scroll cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 127 "cursor-ra-move.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
diff --git a/src/interfaces/ecpg/test/expected/sql-cursor-ra-swdir.c b/src/interfaces/ecpg/test/expected/sql-cursor-ra-swdir.c
index c2959ee..852fee0 100644
--- a/src/interfaces/ecpg/test/expected/sql-cursor-ra-swdir.c
+++ b/src/interfaces/ecpg/test/expected/sql-cursor-ra-swdir.c
@@ -157,7 +157,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 #line 70 "cursor-ra-swdir.pgc"
 
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 4, "mycur", ECPGst_normal, "declare mycur cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 4, 0, "mycur", ECPGst_normal, "declare mycur cursor for select id , t from t1 order by id", ECPGt_EOIT, ECPGt_EORT);
 #line 72 "cursor-ra-swdir.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint();}
diff --git a/src/interfaces/ecpg/test/expected/sql-cursorsubxact.c b/src/interfaces/ecpg/test/expected/sql-cursorsubxact.c
index 4fce79b..a25348e 100644
--- a/src/interfaces/ecpg/test/expected/sql-cursorsubxact.c
+++ b/src/interfaces/ecpg/test/expected/sql-cursorsubxact.c
@@ -92,7 +92,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 #line 39 "cursorsubxact.pgc"
 
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
 	ECPGt_char,&(curname),(long)0,(long)1,(1)*sizeof(char), 
 	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
 #line 41 "cursorsubxact.pgc"
@@ -129,7 +129,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 	curname = QUOTED_CURNAME;
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
 	ECPGt_char,&(curname),(long)0,(long)1,(1)*sizeof(char), 
 	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
 #line 64 "cursorsubxact.pgc"
@@ -196,7 +196,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 #line 98 "cursorsubxact.pgc"
 
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
 	ECPGt_char,&(curname),(long)0,(long)1,(1)*sizeof(char), 
 	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
 #line 100 "cursorsubxact.pgc"
@@ -255,7 +255,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 	else
 		printf("\"savepoint a\" succeeded\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
 	ECPGt_char,&(curname),(long)0,(long)1,(1)*sizeof(char), 
 	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
 #line 130 "cursorsubxact.pgc"
@@ -413,7 +413,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 	else
 		printf("\"savepoint a\" succeeded\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
 	ECPGt_char,&(curname),(long)0,(long)1,(1)*sizeof(char), 
 	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
 #line 220 "cursorsubxact.pgc"
@@ -473,7 +473,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 	else
 		printf("fetch from %s (case sensitive) unexpectedly succeeded (expected 34000)\n", curname);
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
 	ECPGt_char,&(curname),(long)0,(long)1,(1)*sizeof(char), 
 	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
 #line 246 "cursorsubxact.pgc"
@@ -497,7 +497,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 	else
 		printf("\"rollback to a\" succeeded\n");
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, curname, ECPGst_normal, "declare $0 cursor for select id , t from t1", 
 	ECPGt_char,&(curname),(long)0,(long)1,(1)*sizeof(char), 
 	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
 #line 258 "cursorsubxact.pgc"
diff --git a/src/interfaces/ecpg/test/expected/sql-desc.c b/src/interfaces/ecpg/test/expected/sql-desc.c
index 5624774..de0ab8a 100644
--- a/src/interfaces/ecpg/test/expected/sql-desc.c
+++ b/src/interfaces/ecpg/test/expected/sql-desc.c
@@ -245,7 +245,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 	/* declare c1 cursor for $1 */
 #line 57 "desc.pgc"
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "c1", ECPGst_normal, "declare c1 cursor for $1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "c1", 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", 0L, 0L, 0L, 
@@ -295,7 +295,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 	/* declare c2 cursor for $1 */
 #line 69 "desc.pgc"
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "c2", ECPGst_normal, "declare c2 cursor for $1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "c2", 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", 0L, 0L, 0L, 
diff --git a/src/interfaces/ecpg/test/expected/sql-dyntest.c b/src/interfaces/ecpg/test/expected/sql-dyntest.c
index 1ca75a6..deb1bb2 100644
--- a/src/interfaces/ecpg/test/expected/sql-dyntest.c
+++ b/src/interfaces/ecpg/test/expected/sql-dyntest.c
@@ -261,7 +261,7 @@ if (sqlca.sqlcode < 0) error ( );}
 #line 58 "dyntest.pgc"
 
 
-  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "MYCURS", ECPGst_normal, "declare MYCURS cursor for $1", 
+  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "MYCURS", 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"
diff --git a/src/interfaces/ecpg/test/expected/sql-execute.c b/src/interfaces/ecpg/test/expected/sql-execute.c
index d81dd77..638628d 100644
--- a/src/interfaces/ecpg/test/expected/sql-execute.c
+++ b/src/interfaces/ecpg/test/expected/sql-execute.c
@@ -140,7 +140,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 #line 50 "execute.pgc"
 
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "CUR", ECPGst_normal, "declare CUR cursor for $1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "CUR", 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"
@@ -205,7 +205,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 #line 72 "execute.pgc"
 
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "CUR2", ECPGst_normal, "declare CUR2 cursor for $1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "CUR2", 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"), 
diff --git a/src/interfaces/ecpg/test/expected/sql-fetch.c b/src/interfaces/ecpg/test/expected/sql-fetch.c
index 900d96e..8b6117d 100644
--- a/src/interfaces/ecpg/test/expected/sql-fetch.c
+++ b/src/interfaces/ecpg/test/expected/sql-fetch.c
@@ -99,7 +99,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 #line 26 "fetch.pgc"
 
 
-  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "C", ECPGst_normal, "declare C cursor for select * from My_Table", ECPGt_EOIT, ECPGt_EORT);
+  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "C", ECPGst_normal, "declare C cursor for select * from My_Table", ECPGt_EOIT, ECPGt_EORT);
 #line 28 "fetch.pgc"
 
 if (sqlca.sqlwarn[0] == 'W') sqlprint();
@@ -176,7 +176,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 #line 44 "fetch.pgc"
 
 
-  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "D", ECPGst_normal, "declare D cursor for select * from My_Table where Item1 = $1", 
+  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "D", 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"
diff --git a/src/interfaces/ecpg/test/expected/sql-oldexec.c b/src/interfaces/ecpg/test/expected/sql-oldexec.c
index 69a6c57..ea5f4cc 100644
--- a/src/interfaces/ecpg/test/expected/sql-oldexec.c
+++ b/src/interfaces/ecpg/test/expected/sql-oldexec.c
@@ -140,7 +140,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 #line 50 "oldexec.pgc"
 
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 1, 0, ECPGcs_unspecified, 1, "CUR", ECPGst_normal, "declare CUR cursor for $1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 1, 0, ECPGcs_unspecified, 1, 1, "CUR", 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 "oldexec.pgc"
@@ -199,7 +199,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 #line 71 "oldexec.pgc"
 
 
-	{ ECPGopen(__LINE__, 0, 1, NULL, 1, 0, ECPGcs_unspecified, 1, "CUR3", ECPGst_normal, "declare CUR3 cursor for $1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 1, 0, ECPGcs_unspecified, 1, 1, "CUR3", 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"), 
diff --git a/src/interfaces/ecpg/test/expected/sql-quote.c b/src/interfaces/ecpg/test/expected/sql-quote.c
index 91a7501..a2eba0d 100644
--- a/src/interfaces/ecpg/test/expected/sql-quote.c
+++ b/src/interfaces/ecpg/test/expected/sql-quote.c
@@ -162,7 +162,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 #line 43 "quote.pgc"
 
 
-  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "C", ECPGst_normal, "declare C cursor for select * from \"My_Table\"", ECPGt_EOIT, ECPGt_EORT);
+  { ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "C", ECPGst_normal, "declare C cursor for select * from \"My_Table\"", ECPGt_EOIT, ECPGt_EORT);
 #line 45 "quote.pgc"
 
 if (sqlca.sqlwarn[0] == 'W') sqlprint();
diff --git a/src/interfaces/ecpg/test/expected/sql-sqlda.c b/src/interfaces/ecpg/test/expected/sql-sqlda.c
index 927540a..eb3384e 100644
--- a/src/interfaces/ecpg/test/expected/sql-sqlda.c
+++ b/src/interfaces/ecpg/test/expected/sql-sqlda.c
@@ -251,7 +251,7 @@ if (sqlca.sqlcode < 0) exit (1);}
 
 
 	strcpy(msg, "open");
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "mycur1", ECPGst_normal, "declare mycur1 cursor for $1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "mycur1", 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 103 "sqlda.pgc"
@@ -324,7 +324,7 @@ if (sqlca.sqlcode < 0) exit (1);}
 
 
 	strcpy(msg, "open");
-	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, "mycur2", ECPGst_normal, "declare mycur2 cursor for $1", 
+	{ ECPGopen(__LINE__, 0, 1, NULL, 0, 0, ECPGcs_unspecified, 1, 1, "mycur2", 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"