2-pg85-sqlda-18-ctxdiff.patch

text/x-patch

Filename: 2-pg85-sqlda-18-ctxdiff.patch
Type: text/x-patch
Part: 0
Message: Re: ECPG patch 2, SQLDA support

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: context
File+
src/interfaces/ecpg/ecpglib/execute.c 109 0
src/interfaces/ecpg/ecpglib/extern.h 5 0
src/interfaces/ecpg/ecpglib/Makefile 1 1
src/interfaces/ecpg/ecpglib/sqlda.c 387 0
src/interfaces/ecpg/ecpglib/typename.c 40 0
src/interfaces/ecpg/include/ecpgtype.h 2 1
src/interfaces/ecpg/include/Makefile 3 2
src/interfaces/ecpg/include/sqlda.h 46 0
src/interfaces/ecpg/include/sqltypes.h 27 0
src/interfaces/ecpg/preproc/descriptor.c 19 0
src/interfaces/ecpg/preproc/ecpg.addons 5 5
src/interfaces/ecpg/preproc/ecpg.trailer 29 6
src/interfaces/ecpg/preproc/ecpg.type 2 1
src/interfaces/ecpg/preproc/extern.h 1 0
src/interfaces/ecpg/preproc/type.c 5 0
src/interfaces/ecpg/test/compat_informix/Makefile 4 0
src/interfaces/ecpg/test/compat_informix/sqlda.pgc 248 0
src/interfaces/ecpg/test/ecpg_schedule 2 0
src/interfaces/ecpg/test/ecpg_schedule_tcp 2 0
src/interfaces/ecpg/test/expected/compat_informix-sqlda.c 561 0
src/interfaces/ecpg/test/expected/compat_informix-sqlda.stderr 584 0
src/interfaces/ecpg/test/expected/compat_informix-sqlda.stdout 60 0
src/interfaces/ecpg/test/expected/sql-sqlda.c 569 0
src/interfaces/ecpg/test/expected/sql-sqlda.stderr 574 0
src/interfaces/ecpg/test/expected/sql-sqlda.stdout 60 0
src/interfaces/ecpg/test/sql/desc.pgc 6 6
src/interfaces/ecpg/test/sql/dynalloc2.pgc 1 1
src/interfaces/ecpg/test/sql/dynalloc.pgc 1 1
src/interfaces/ecpg/test/sql/Makefile 1 0
src/interfaces/ecpg/test/sql/sqlda.pgc 257 0
diff -dcrpN pgsql.orig/src/interfaces/ecpg/ecpglib/execute.c pgsql.2/src/interfaces/ecpg/ecpglib/execute.c
*** pgsql.orig/src/interfaces/ecpg/ecpglib/execute.c	2009-09-03 14:37:34.000000000 +0200
--- pgsql.2/src/interfaces/ecpg/ecpglib/execute.c	2009-12-16 14:03:43.000000000 +0100
***************
*** 25,30 ****
--- 25,31 ----
  #include "ecpgerrno.h"
  #include "extern.h"
  #include "sqlca.h"
+ #include "sqlda.h"
  #include "sql3types.h"
  #include "pgtypes_numeric.h"
  #include "pgtypes_date.h"
*************** ecpg_store_input(const int lineno, const
*** 1033,1038 ****
--- 1034,1040 ----
  				break;
  
  			case ECPGt_descriptor:
+ 			case ECPGt_sqlda:
  				break;
  
  			default:
*************** ecpg_execute(struct statement * stmt)
*** 1172,1177 ****
--- 1174,1234 ----
  			if (desc->count == desc_counter)
  				desc_counter = 0;
  		}
+ 		else if (var->type == ECPGt_sqlda)
+ 		{
+ 			pg_sqlda_t	   *sqlda = *(pg_sqlda_t **)var->pointer;
+ 			struct variable	desc_inlist;
+ 			int		i;
+ 
+ 			if (sqlda == NULL)
+ 				return false;
+ 
+ 			desc_counter++;
+ 			for (i = 0; i < sqlda->sqld; i++)
+ 			{
+ 				if (i + 1 == desc_counter)
+ 				{
+ 					desc_inlist.type = sqlda->sqlvar[i].sqltype;
+ 					desc_inlist.value = sqlda->sqlvar[i].sqldata;
+ 					desc_inlist.pointer = &(sqlda->sqlvar[i].sqldata);
+ 					switch (desc_inlist.type)
+ 					{
+ 						case ECPGt_char:
+ 						case ECPGt_varchar:
+ 							desc_inlist.varcharsize = strlen(sqlda->sqlvar[i].sqldata);
+ 							break;
+ 						default:
+ 							desc_inlist.varcharsize = 0;
+ 							break;
+ 					}
+ 					desc_inlist.arrsize = 1;
+ 					desc_inlist.offset = 0;
+ 					if (sqlda->sqlvar[i].sqlind)
+ 					{
+ 						desc_inlist.ind_type = ECPGt_short;
+ 						/* ECPG expects indicator value < 0 */
+ 						if (*(sqlda->sqlvar[i].sqlind))
+ 							*(sqlda->sqlvar[i].sqlind) = -1;
+ 						desc_inlist.ind_value = sqlda->sqlvar[i].sqlind;
+ 						desc_inlist.ind_pointer = &(sqlda->sqlvar[i].sqlind);
+ 						desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = 1;
+ 						desc_inlist.ind_offset = 0;
+ 					}
+ 					else
+ 					{
+ 						desc_inlist.ind_type = ECPGt_NO_INDICATOR;
+ 						desc_inlist.ind_value = desc_inlist.ind_pointer = NULL;
+ 						desc_inlist.ind_varcharsize = desc_inlist.ind_arrsize = desc_inlist.ind_offset = 0;
+ 					}
+ 					if (!ecpg_store_input(stmt->lineno, stmt->force_indicator, &desc_inlist, &tobeinserted, false))
+ 						return false;
+ 
+ 					break;
+ 				}
+ 			}
+ 			if (sqlda->sqld == desc_counter)
+ 				desc_counter = 0;
+ 		}
  		else
  		{
  			if (!ecpg_store_input(stmt->lineno, stmt->force_indicator, var, &tobeinserted, false))
*************** ecpg_execute(struct statement * stmt)
*** 1353,1358 ****
--- 1410,1467 ----
  				}
  				var = var->next;
  			}
+ 			else if (var != NULL && var->type == ECPGt_sqlda)
+ 			{
+ 				pg_sqlda_t	  **_sqlda = (pg_sqlda_t **)var->pointer;
+ 				pg_sqlda_t	   *sqlda = *_sqlda;
+ 				pg_sqlda_t	   *sqlda_new;
+ 				int		i;
+ 
+ 				/* If we are passed in a previously existing sqlda (chain) then free it. */
+ 				while (sqlda)
+ 				{
+ 					sqlda_new = sqlda->desc_next;
+ 					free(sqlda);
+ 					sqlda = sqlda_new;
+ 				}
+ 				*_sqlda = sqlda = sqlda_new = NULL;
+ 				for (i = ntuples - 1; i >= 0; i--)
+ 				{
+ 					/* Build a new sqlda structure. Note that only fetching 1 record is supported */
+ 					sqlda_new = ecpg_build_sqlda_for_PGresult(stmt->lineno, results, i, stmt->compat);
+ 
+ 					if (!sqlda_new)
+ 					{
+ 						/* cleanup all SQLDAs we created up */
+ 						while (sqlda)
+ 						{
+ 							sqlda_new = sqlda->desc_next;
+ 							free(sqlda);
+ 							sqlda = sqlda_new;
+ 						}
+ 						*_sqlda = NULL;
+ 
+ 						ecpg_log("ecpg_execute on line %d: out of memory allocating a new sqlda\n", stmt->lineno);
+ 						status = false;
+ 						break;
+ 					}
+ 					else
+ 					{
+ 						ecpg_log("ecpg_execute on line %d: new sqlda was built\n", stmt->lineno);
+ 
+ 						*_sqlda = sqlda_new;
+ 
+ 						ecpg_set_sqlda_from_PGresult(stmt->lineno, _sqlda, results, i, stmt->compat);
+ 						ecpg_log("ecpg_execute on line %d: putting result (1 tuple %d fields) into sqlda descriptor\n",
+ 								stmt->lineno, PQnfields(results));
+ 
+ 						sqlda_new->desc_next = sqlda;
+ 						sqlda = sqlda_new;
+ 					}
+ 				}
+ 
+ 				var = var->next;
+ 			}
  			else
  				for (act_field = 0; act_field < nfields && status; act_field++)
  				{
diff -dcrpN pgsql.orig/src/interfaces/ecpg/ecpglib/extern.h pgsql.2/src/interfaces/ecpg/ecpglib/extern.h
*** pgsql.orig/src/interfaces/ecpg/ecpglib/extern.h	2009-05-25 12:08:48.000000000 +0200
--- pgsql.2/src/interfaces/ecpg/ecpglib/extern.h	2009-12-16 14:03:43.000000000 +0100
***************
*** 6,11 ****
--- 6,12 ----
  #include "postgres_fe.h"
  #include "libpq-fe.h"
  #include "sqlca.h"
+ #include "sqlda.h"
  #include "ecpg_config.h"
  #ifndef CHAR_BIT
  #include <limits.h>
*************** bool		ecpg_init(const struct connection 
*** 129,134 ****
--- 130,136 ----
  char	   *ecpg_strdup(const char *, int);
  const char *ecpg_type_name(enum ECPGttype);
  int			ecpg_dynamic_type(Oid);
+ int			sqlda_dynamic_type(Oid, enum COMPAT_MODE);
  void		ecpg_free_auto_mem(void);
  void		ecpg_clear_auto_mem(void);
  
*************** void		ecpg_log(const char *format,...);
*** 149,154 ****
--- 151,159 ----
  bool		ecpg_auto_prepare(int, const char *, const int, char **, const char *);
  void		ecpg_init_sqlca(struct sqlca_t * sqlca);
  
+ pg_sqlda_t *ecpg_build_sqlda_for_PGresult(int, PGresult *, int, enum COMPAT_MODE);
+ void		ecpg_set_sqlda_from_PGresult(int, pg_sqlda_t **, const PGresult *, int, enum COMPAT_MODE);
+ 
  /* SQLSTATE values generated or processed by ecpglib (intentionally
   * not exported -- users should refer to the codes directly) */
  
diff -dcrpN pgsql.orig/src/interfaces/ecpg/ecpglib/Makefile pgsql.2/src/interfaces/ecpg/ecpglib/Makefile
*** pgsql.orig/src/interfaces/ecpg/ecpglib/Makefile	2009-07-13 11:16:41.000000000 +0200
--- pgsql.2/src/interfaces/ecpg/ecpglib/Makefile	2009-12-16 14:03:43.000000000 +0100
*************** override CFLAGS += $(PTHREAD_CFLAGS)
*** 24,30 ****
  # Need to recompile any libpgport object files
  LIBS := $(filter-out -lpgport, $(LIBS))
  
! OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
  	connect.o misc.o path.o pgstrcasecmp.o \
  	$(filter snprintf.o strlcpy.o, $(LIBOBJS))
  
--- 24,30 ----
  # Need to recompile any libpgport object files
  LIBS := $(filter-out -lpgport, $(LIBS))
  
! OBJS= execute.o typename.o descriptor.o sqlda.o data.o error.o prepare.o memory.o \
  	connect.o misc.o path.o pgstrcasecmp.o \
  	$(filter snprintf.o strlcpy.o, $(LIBOBJS))
  
diff -dcrpN pgsql.orig/src/interfaces/ecpg/ecpglib/sqlda.c pgsql.2/src/interfaces/ecpg/ecpglib/sqlda.c
*** pgsql.orig/src/interfaces/ecpg/ecpglib/sqlda.c	1970-01-01 01:00:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/ecpglib/sqlda.c	2009-12-16 14:03:43.000000000 +0100
***************
*** 0 ****
--- 1,387 ----
+ /*
+  * SQLDA support routines
+  *
+  * The allocated memory area pointed by an sqlda pointer
+  * contains both the metadata and the data, so freeing up
+  * is a simple free(sqlda) as expected by the ESQL/C examples.
+  */
+ 
+ #define POSTGRES_ECPG_INTERNAL
+ #include "postgres_fe.h"
+ #include "pg_type.h"
+ 
+ #include <inttypes.h>
+ #include <dlfcn.h>
+ 
+ #include "ecpg-pthread-win32.h"
+ #include "decimal.h"
+ #include "ecpgtype.h"
+ #include "ecpglib.h"
+ #include "ecpgerrno.h"
+ #include "extern.h"
+ #include "sqlca.h"
+ #include "sqlda.h"
+ 
+ /*
+  * Compute the next variable's offset with
+  * the current variable's size and alignment.
+  * 
+  *
+  * Returns:
+  * - the current variable's offset in *current
+  * - the next variable's offset in *next
+  */
+ static void
+ ecpg_sqlda_align_add_size(long offset, int alignment, int size, long *current, long *next)
+ {
+ 	if (offset % alignment)
+ 		offset += alignment - (offset % alignment);
+ 	if (current)
+ 		*current = offset;
+ 	offset += size;
+ 	if (next)
+ 		*next = offset;
+ }
+ 
+ static long
+ ecpg_sqlda_empty_size(const PGresult *res)
+ {
+ 	long	offset;
+ 	int	i;
+ 	int	sqld = PQnfields(res);
+ 
+ 	/* Initial size to store main structure and field structures */
+ 	offset = sizeof(pg_sqlda_t) + sqld * sizeof(pg_sqlvar_t);
+ 
+ 	/* Add space for field names */
+ 	for (i = 0; i < sqld; i++)
+ 		offset += strlen(PQfname(res, i)) + 1;
+ 
+ 	/* Add padding to the first field value */
+ 	ecpg_sqlda_align_add_size(offset, sizeof(int), 0, &offset, NULL);
+ 
+ 	return offset;
+ }
+ 
+ static long
+ ecpg_sqlda_total_size(const PGresult *res, int row, enum COMPAT_MODE compat)
+ {
+ 	int	i;
+ 	int	sqld = PQnfields(res);
+ 	long	offset, next_offset;
+ 
+ 	offset = ecpg_sqlda_empty_size(res);
+ 
+ 	if (row < 0)
+ 		return offset;
+ 
+ 	/* Add space for the field values */
+ 	for (i = 0; i < sqld; i++)
+ 	{
+ 		enum ECPGttype type = sqlda_dynamic_type(PQftype(res, i), compat);
+ 		switch (type)
+ 		{
+ 			case ECPGt_short:
+ 			case ECPGt_unsigned_short:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(short), sizeof(short), &offset, &next_offset);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 				break;
+ 			case ECPGt_int:
+ 			case ECPGt_unsigned_int:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(int), sizeof(int), &offset, &next_offset);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 				break;
+ 			case ECPGt_long:
+ 			case ECPGt_unsigned_long:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(long), sizeof(long), &offset, &next_offset);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 				break;
+ 			case ECPGt_long_long:
+ 			case ECPGt_unsigned_long_long:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(long long), sizeof(long long), &offset, &next_offset);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 				break;
+ 			case ECPGt_bool:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(bool), sizeof(bool), &offset, &next_offset);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 				break;
+ 			case ECPGt_float:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(float), sizeof(float), &offset, &next_offset);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 				break;
+ 			case ECPGt_double:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(double), sizeof(double), &offset, &next_offset);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 				break;
+ 			case ECPGt_decimal:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(int), sizeof(decimal), &offset, &next_offset);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 				break;
+ 			case ECPGt_numeric:
+ 				/*
+ 				 * Let's align both the numeric struct and the digits array to int
+ 				 * Unfortunately we need to do double work here to compute the size
+ 				 * of the space needed for the numeric structure.
+ 				 */
+ 				ecpg_sqlda_align_add_size(offset, sizeof(int), sizeof(numeric), &offset, &next_offset);
+ 				ecpg_log("%s type %s offset1 %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 				if (!PQgetisnull(res, row, i))
+ 				{
+ 					char	   *val = PQgetvalue(res, row, i);
+ 					numeric	   *num;
+ 
+ 					num = PGTYPESnumeric_from_asc(val, NULL);
+ 					if (!num)
+ 						break;
+ 					ecpg_sqlda_align_add_size(next_offset, sizeof(int), num->ndigits + 1, &offset, &next_offset);
+ 					ecpg_log("%s type %s offset2 %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 					PGTYPESnumeric_free(num);
+ 				}
+ 				break;
+ 			case ECPGt_date:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(int), sizeof(date), &offset, &next_offset);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 				break;
+ 			case ECPGt_timestamp:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(int), sizeof(timestamp), &offset, &next_offset);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 				break;
+ 			case ECPGt_interval:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(int), sizeof(interval), &offset, &next_offset);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 				break;
+ 			case ECPGt_char:
+ 			case ECPGt_unsigned_char:
+ 			case ECPGt_string:
+ 			default:
+ 			{
+ 				long	datalen = strlen(PQgetvalue(res, row, i)) + 1;
+ 				ecpg_sqlda_align_add_size(offset, sizeof(int), datalen, &offset, &next_offset);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(type), offset);
+ 				break;
+ 			}
+ 		}
+ 		offset = next_offset;
+ 	}
+ 	return offset;
+ }
+ 
+ /*
+  * Build pg_sqlda_t (metadata only) from PGresult
+  * leaving enough space for the field values in
+  * the given row number
+  */
+ pg_sqlda_t *
+ ecpg_build_sqlda_for_PGresult(int line, PGresult *res, int row, enum COMPAT_MODE compat)
+ {
+ 	pg_sqlda_t *sqlda;
+ 	pg_sqlvar_t*sqlvar;
+ 	char	   *fname;
+ 	long		size;
+ 	int		sqld;
+ 	int		i;
+ 
+ 	size = ecpg_sqlda_total_size(res, row, compat);
+ 	sqlda = (pg_sqlda_t *)ecpg_alloc(size, line);
+ 	if (!sqlda)
+ 		return NULL;
+ 
+ 	memset(sqlda, 0, size);
+ 	sqlvar = (pg_sqlvar_t *)(sqlda + 1);
+ 	sqld = PQnfields(res);
+ 	fname = (char *)(sqlvar + sqld);
+ 
+ 	sqlda->sqld = sqld;
+ 	sqlda->desc_occ = size; /* cheat here, keep the full allocated size */
+ 	sqlda->sqlvar = sqlvar;
+ 
+ 	for (i = 0; i < sqlda->sqld; i++)
+ 	{
+ 		sqlda->sqlvar[i].sqltype = sqlda_dynamic_type(PQftype(res, i), compat);
+ 		strcpy(fname, PQfname(res, i));
+ 		sqlda->sqlvar[i].sqlname = fname;
+ 		fname += strlen(sqlda->sqlvar[i].sqlname) + 1;
+ 		sqlda->sqlvar[i].sqlformat = (char *)(long)PQfformat(res, i);
+ 		sqlda->sqlvar[i].sqlxid = PQftype(res, i);
+ 		sqlda->sqlvar[i].sqltypelen = PQfsize(res, i);
+ 	}
+ 
+ 	return sqlda;
+ }
+ 
+ /*
+  * Sets values from PGresult.
+  */
+ static int2	value_is_null = -1;
+ static int2	value_is_not_null = 0;
+ 
+ void
+ ecpg_set_sqlda_from_PGresult(int lineno, pg_sqlda_t **_sqlda, const PGresult *res, int row, enum COMPAT_MODE compat)
+ {
+ 	pg_sqlda_t *sqlda = (*_sqlda);
+ 	int		i;
+ 	long		offset, next_offset;
+ 
+ 	/* Offset for the first field value */
+ 	offset = ecpg_sqlda_empty_size(res);
+ 
+ 	if (row < 0)
+ 		return;
+ 
+ 	/*
+ 	 * Set sqlvar[i]->sqldata pointers and convert values to correct format
+ 	 */
+ 	for (i = 0; i < sqlda->sqld; i++)
+ 	{
+ 		int	isnull;
+ 		int	datalen;
+ 		bool	set_data = true;
+ 
+ 		switch (sqlda->sqlvar[i].sqltype)
+ 		{
+ 			case ECPGt_short:
+ 			case ECPGt_unsigned_short:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(short), sizeof(short), &offset, &next_offset);
+ 				sqlda->sqlvar[i].sqldata = (char *)sqlda + offset;
+ 				sqlda->sqlvar[i].sqllen = sizeof(short);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 				break;
+ 			case ECPGt_int:
+ 			case ECPGt_unsigned_int:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(int), sizeof(int), &offset, &next_offset);
+ 				sqlda->sqlvar[i].sqldata = (char *)sqlda + offset;
+ 				sqlda->sqlvar[i].sqllen = sizeof(int);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 				break;
+ 			case ECPGt_long:
+ 			case ECPGt_unsigned_long:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(long), sizeof(long), &offset, &next_offset);
+ 				sqlda->sqlvar[i].sqldata = (char *)sqlda + offset;
+ 				sqlda->sqlvar[i].sqllen = sizeof(long);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 				break;
+ 			case ECPGt_long_long:
+ 			case ECPGt_unsigned_long_long:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(long long), sizeof(long long), &offset, &next_offset);
+ 				sqlda->sqlvar[i].sqldata = (char *)sqlda + offset;
+ 				sqlda->sqlvar[i].sqllen = sizeof(long long);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 				break;
+ 			case ECPGt_bool:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(bool), sizeof(bool), &offset, &next_offset);
+ 				sqlda->sqlvar[i].sqldata = (char *)sqlda + offset;
+ 				sqlda->sqlvar[i].sqllen = sizeof(bool);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 				break;
+ 			case ECPGt_float:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(float), sizeof(float), &offset, &next_offset);
+ 				sqlda->sqlvar[i].sqldata = (char *)sqlda + offset;
+ 				sqlda->sqlvar[i].sqllen = sizeof(float);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 				break;
+ 			case ECPGt_double:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(double), sizeof(double), &offset, &next_offset);
+ 				sqlda->sqlvar[i].sqldata = (char *)sqlda + offset;
+ 				sqlda->sqlvar[i].sqllen = sizeof(double);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 				break;
+ 			case ECPGt_decimal:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(int), sizeof(decimal), &offset, &next_offset);
+ 				sqlda->sqlvar[i].sqldata = (char *)sqlda + offset;
+ 				sqlda->sqlvar[i].sqllen = sizeof(decimal);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 				break;
+ 			case ECPGt_numeric:
+ 			{
+ 				numeric	   *num;
+ 				char	   *val;
+ 
+ 				set_data = false;
+ 
+ 				ecpg_sqlda_align_add_size(offset, sizeof(int), sizeof(numeric), &offset, &next_offset);
+ 				sqlda->sqlvar[i].sqldata = (char *)sqlda + offset;
+ 				sqlda->sqlvar[i].sqllen = sizeof(numeric);
+ 				ecpg_log("%s type %s offset1 %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 
+ 				if (PQgetisnull(res, row, i))
+ 				{
+ 					ECPGset_noind_null(ECPGt_numeric, sqlda->sqlvar[i].sqldata);
+ 					break;
+ 				}
+ 
+ 				val = PQgetvalue(res, row, i);
+ 				num = PGTYPESnumeric_from_asc(val, NULL);
+ 				if (!num)
+ 				{
+ 					ECPGset_noind_null(ECPGt_numeric, sqlda->sqlvar[i].sqldata);
+ 					break;
+ 				}
+ 
+ 				memcpy(sqlda->sqlvar[i].sqldata, num, sizeof(numeric));
+ 
+ 				ecpg_sqlda_align_add_size(next_offset, sizeof(int), num->ndigits + 1, &offset, &next_offset);
+ 				memcpy((char *)sqlda + offset, num->buf, num->ndigits + 1);
+ 				ecpg_log("%s type %s offset2 %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 
+ 				((numeric *)sqlda->sqlvar[i].sqldata)->buf = (NumericDigit *)sqlda + offset;
+ 				((numeric *)sqlda->sqlvar[i].sqldata)->digits = (NumericDigit *)sqlda + offset + (num->digits - num->buf);
+ 
+ 				PGTYPESnumeric_free(num);
+ 
+ 				break;
+ 			}
+ 			case ECPGt_date:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(date), sizeof(date), &offset, &next_offset);
+ 				sqlda->sqlvar[i].sqldata = (char *)sqlda + offset;
+ 				sqlda->sqlvar[i].sqllen = sizeof(date);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 				break;
+ 			case ECPGt_timestamp:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(timestamp), sizeof(timestamp), &offset, &next_offset);
+ 				sqlda->sqlvar[i].sqldata = (char *)sqlda + offset;
+ 				sqlda->sqlvar[i].sqllen = sizeof(timestamp);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 				break;
+ 			case ECPGt_interval:
+ 				ecpg_sqlda_align_add_size(offset, sizeof(int64_t), sizeof(interval), &offset, &next_offset);
+ 				sqlda->sqlvar[i].sqldata = (char *)sqlda + offset;
+ 				sqlda->sqlvar[i].sqllen = sizeof(interval);
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 				break;
+ 			case ECPGt_char:
+ 			case ECPGt_unsigned_char:
+ 			case ECPGt_string:
+ 			default:
+ 				datalen = strlen(PQgetvalue(res, row, i)) + 1;
+ 				ecpg_sqlda_align_add_size(offset, sizeof(int), datalen, &offset, &next_offset);
+ 				sqlda->sqlvar[i].sqldata = (char *)sqlda + offset;
+ 				sqlda->sqlvar[i].sqllen = datalen;
+ 				if (datalen > 32768)
+ 					sqlda->sqlvar[i].sqlilongdata = sqlda->sqlvar[i].sqldata;
+ 				ecpg_log("%s type %s offset %d\n", __FUNCTION__, ecpg_type_name(sqlda->sqlvar[i].sqltype), offset);
+ 				break;
+ 		}
+ 
+ 		isnull = PQgetisnull(res, row, i);
+ 		ecpg_log("%s row %d col %d %s\n", __FUNCTION__, row, i, isnull ? "IS NULL" : "IS NOT NULL");
+ 		sqlda->sqlvar[i].sqlind = isnull ? &value_is_null : &value_is_not_null;
+ 		sqlda->sqlvar[i].sqlitype = ECPGt_short;
+ 		sqlda->sqlvar[i].sqlilen = sizeof(short);
+ 		if (!isnull)
+ 		{
+ 			if (set_data)
+ 				ecpg_get_data(res, row, i, lineno,
+ 						sqlda->sqlvar[i].sqltype, ECPGt_NO_INDICATOR,
+ 						sqlda->sqlvar[i].sqldata, NULL, 0, 0, 0,
+ 						ECPG_ARRAY_NONE, ECPG_COMPAT_INFORMIX, false);
+ 		}
+ 		else
+ 		{
+ 			if (INFORMIX_MODE(compat))
+ 				ECPGset_noind_null(sqlda->sqlvar[i].sqltype, sqlda->sqlvar[i].sqldata);
+ 		}
+ 
+ 		offset = next_offset;
+ 	}
+ }
+ 
diff -dcrpN pgsql.orig/src/interfaces/ecpg/ecpglib/typename.c pgsql.2/src/interfaces/ecpg/ecpglib/typename.c
*** pgsql.orig/src/interfaces/ecpg/ecpglib/typename.c	2009-08-07 13:06:28.000000000 +0200
--- pgsql.2/src/interfaces/ecpg/ecpglib/typename.c	2009-12-16 14:03:43.000000000 +0100
***************
*** 7,12 ****
--- 7,13 ----
  #include "ecpgtype.h"
  #include "ecpglib.h"
  #include "extern.h"
+ #include "sqltypes.h"
  #include "sql3types.h"
  #include "pg_type.h"
  
*************** ecpg_dynamic_type(Oid type)
*** 100,102 ****
--- 101,142 ----
  			return -(int) type;
  	}
  }
+ 
+ int
+ sqlda_dynamic_type(Oid type, enum COMPAT_MODE compat)
+ {
+ 	switch (type)
+ 	{
+ 		case CHAROID:
+ 		case VARCHAROID:
+ 		case BPCHAROID:
+ 		case TEXTOID:
+ 			return ECPGt_char;
+ 		case INT2OID:
+ 			return ECPGt_short;
+ 		case INT4OID:
+ 			return ECPGt_int;
+ 		case FLOAT8OID:
+ 			return ECPGt_double;
+ 		case FLOAT4OID:
+ 			return ECPGt_float;
+ 		case NUMERICOID:
+ 			return INFORMIX_MODE(compat) ? ECPGt_decimal : ECPGt_numeric;
+ 		case DATEOID:
+ 			return ECPGt_date;
+ 		case TIMESTAMPOID:
+ 		case TIMESTAMPTZOID:
+ 			return ECPGt_timestamp;
+ 		case INTERVALOID:
+ 			return ECPGt_interval;
+ 		case INT8OID:
+ #ifdef HAVE_LONG_LONG_INT_64
+ 			return ECPGt_long_long;
+ #endif
+ #ifdef HAVE_LONG_INT_64
+ 			return ECPGt_long;
+ #endif
+ 		default:
+ 			return (-type);
+ 	}
+ }
diff -dcrpN pgsql.orig/src/interfaces/ecpg/include/ecpgtype.h pgsql.2/src/interfaces/ecpg/include/ecpgtype.h
*** pgsql.orig/src/interfaces/ecpg/include/ecpgtype.h	2009-08-07 13:06:28.000000000 +0200
--- pgsql.2/src/interfaces/ecpg/include/ecpgtype.h	2009-12-16 14:03:43.000000000 +0100
*************** enum ECPGttype
*** 62,68 ****
  	ECPGt_EOIT,					/* End of insert types. */
  	ECPGt_EORT,					/* End of result types. */
  	ECPGt_NO_INDICATOR,			/* no indicator */
! 	ECPGt_string                            /* trimmed (char *) type */
  };
  
   /* descriptor items */
--- 62,69 ----
  	ECPGt_EOIT,					/* End of insert types. */
  	ECPGt_EORT,					/* End of result types. */
  	ECPGt_NO_INDICATOR,			/* no indicator */
! 	ECPGt_string,				/* trimmed (char *) type */
! 	ECPGt_sqlda				/* C struct descriptor */
  };
  
   /* descriptor items */
diff -dcrpN pgsql.orig/src/interfaces/ecpg/include/Makefile pgsql.2/src/interfaces/ecpg/include/Makefile
*** pgsql.orig/src/interfaces/ecpg/include/Makefile	2009-10-27 20:36:17.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/include/Makefile	2009-12-16 14:03:43.000000000 +0100
*************** install: all installdirs install-headers
*** 14,21 ****
  
  .PHONY: install-headers
  ecpg_headers = ecpgerrno.h ecpglib.h ecpgtype.h sqlca.h sql3types.h ecpg_informix.h \
! 	pgtypes_error.h pgtypes_numeric.h pgtypes_timestamp.h pgtypes_date.h pgtypes_interval.h
! informix_headers = datetime.h decimal.h sqltypes.h sqlda.h
  
  install-headers: $(ecpg_headers) $(informix_headers)
  	$(INSTALL_DATA) $(addprefix $(srcdir)/,$(ecpg_headers)) '$(DESTDIR)$(includedir)/'
--- 14,22 ----
  
  .PHONY: install-headers
  ecpg_headers = ecpgerrno.h ecpglib.h ecpgtype.h sqlca.h sql3types.h ecpg_informix.h \
! 	pgtypes_error.h pgtypes_numeric.h pgtypes_timestamp.h pgtypes_date.h pgtypes_interval.h \
! 	sqlda.h
! informix_headers = datetime.h decimal.h sqltypes.h
  
  install-headers: $(ecpg_headers) $(informix_headers)
  	$(INSTALL_DATA) $(addprefix $(srcdir)/,$(ecpg_headers)) '$(DESTDIR)$(includedir)/'
diff -dcrpN pgsql.orig/src/interfaces/ecpg/include/sqlda.h pgsql.2/src/interfaces/ecpg/include/sqlda.h
*** pgsql.orig/src/interfaces/ecpg/include/sqlda.h	2009-06-13 18:25:05.000000000 +0200
--- pgsql.2/src/interfaces/ecpg/include/sqlda.h	2009-12-16 14:03:43.000000000 +0100
***************
*** 1,3 ****
--- 1,49 ----
  /*
   * $PostgreSQL: pgsql/src/interfaces/ecpg/include/sqlda.h,v 1.4 2009/06/11 14:49:13 momjian Exp $
   */
+ 
+ #ifndef POSTGRES_SQLDA_H
+ #define POSTGRES_SQLDA_H
+ 
+ #include "ecpglib.h"
+ 
+ typedef struct sqlvar_struct
+ {
+ 	short	sqltype;		/* variable type                */
+ 	int	sqllen;			/* length in bytes              */
+ 	char	   *sqldata;		/* pointer to data              */
+ 	short	   *sqlind;		/* pointer to indicator         */
+ 	char	   *sqlname;		/* variable name                */
+ 	char	   *sqlformat;		/* reserved for future use      */
+ 	short	sqlitype;		/* ind variable type            */
+ 	short	sqlilen;		/* ind length in bytes          */
+ 	char	   *sqlidata;		/* ind data pointer             */
+ 	int	sqlxid;			/* extended id type             */
+ 	char	   *sqltypename;	/* extended type name           */
+ 	short	sqltypelen;		/* length of extended type name */
+ 	short	sqlownerlen;		/* length of owner name         */
+ 	short	sqlsourcetype;		/* source type for distinct of built-ins */
+ 	char	   *sqlownername;	/* owner name                   */
+ 	int	sqlsourceid;		/* extended id of source type   */
+ 
+ 	/*
+ 	 * sqlilongdata is new.  It supports data that exceeds the 32k
+ 	 * limit.  sqlilen and sqlidata are for backward compatibility
+ 	 * and they have maximum value of <32K.
+ 	 */
+ 	char	   *sqlilongdata;	/* for data field beyond 32K    */
+ 	int	sqlflags;		/* for internal use only        */
+ 	void	   *sqlreserved;	/* reserved for future use      */
+ } pg_sqlvar_t;
+ 
+ typedef struct sqlda
+ {
+ 	short		sqld;
+ 	pg_sqlvar_t	   *sqlvar;
+ 	char		desc_name[19];	/* descriptor name              */
+ 	short		desc_occ;	/* size of sqlda structure      */
+ 	struct sqlda	   *desc_next;	/* pointer to next sqlda struct */
+ 	void		   *reserved;	/* reserved for future use */
+ } pg_sqlda_t;
+ 
+ #endif /* POSTGRES_SQLDA_H */
diff -dcrpN pgsql.orig/src/interfaces/ecpg/include/sqltypes.h pgsql.2/src/interfaces/ecpg/include/sqltypes.h
*** pgsql.orig/src/interfaces/ecpg/include/sqltypes.h	2009-06-13 18:25:05.000000000 +0200
--- pgsql.2/src/interfaces/ecpg/include/sqltypes.h	2009-12-16 14:03:43.000000000 +0100
***************
*** 4,9 ****
--- 4,11 ----
  #ifndef ECPG_SQLTYPES_H
  #define ECPG_SQLTYPES_H
  
+ #include <limits.h>
+ 
  #define CCHARTYPE	ECPGt_char
  #define CSHORTTYPE	ECPGt_short
  #define CINTTYPE	ECPGt_int
***************
*** 30,33 ****
--- 32,60 ----
  #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
+ #if (LONG_BIT == 64)
+ #define	SQLINT8		ECPGt_long
+ #define	SQLSERIAL8	ECPGt_long
+ #else
+ #define	SQLINT8		ECPGt_long_long
+ #define	SQLSERIAL8	ECPGt_long_long
+ #endif
+ 
  #endif   /* ndef ECPG_SQLTYPES_H */
diff -dcrpN pgsql.orig/src/interfaces/ecpg/preproc/descriptor.c pgsql.2/src/interfaces/ecpg/preproc/descriptor.c
*** pgsql.orig/src/interfaces/ecpg/preproc/descriptor.c	2009-01-30 17:28:46.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/preproc/descriptor.c	2009-12-16 14:03:43.000000000 +0100
*************** descriptor_variable(const char *name, in
*** 326,328 ****
--- 326,347 ----
  	strlcpy(descriptor_names[input], name, sizeof(descriptor_names[input]));
  	return (struct variable *) & varspace[input];
  }
+ 
+ struct variable *
+ sqlda_variable(const char *name)
+ {
+ 	struct variable *p = (struct variable *) mm_alloc(sizeof(struct variable));
+ 
+ 	p->name = mm_strdup(name);
+ 	p->type = (struct ECPGtype *) mm_alloc(sizeof(struct ECPGtype));
+ 	p->type->type = ECPGt_sqlda;
+ 	p->type->size = NULL;
+ 	p->type->struct_sizeof = NULL;
+ 	p->type->u.element = NULL;
+ 	p->type->lineno = 0;
+ 	p->brace_level = 0;
+ 	p->next = NULL;
+ 
+ 	return p;
+ }
+ 
diff -dcrpN pgsql.orig/src/interfaces/ecpg/preproc/ecpg.addons pgsql.2/src/interfaces/ecpg/preproc/ecpg.addons
*** pgsql.orig/src/interfaces/ecpg/preproc/ecpg.addons	2009-12-16 11:30:27.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/preproc/ecpg.addons	2009-12-16 14:03:43.000000000 +0100
*************** ECPG: VariableShowStmtSHOWALL block
*** 409,437 ****
  		$$ = EMPTY;
  	}
  ECPG: FetchStmtMOVEfetch_args rule
! 	| FETCH fetch_args ecpg_into
  	{
  		$$ = cat2_str(make_str("fetch"), $2);
  	}
! 	| FETCH FORWARD cursor_name opt_ecpg_into
  	{
  		char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3;
  		add_additional_variables($3, false);
  		$$ = cat_str(2, make_str("fetch forward"), cursor_marker);
  	}
! 	| FETCH FORWARD from_in cursor_name opt_ecpg_into
  	{
  		char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4;
  		add_additional_variables($4, false);
  		$$ = cat_str(2, make_str("fetch forward from"), cursor_marker);
  	}
! 	| FETCH BACKWARD cursor_name opt_ecpg_into
  	{
  		char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3;
  		add_additional_variables($3, false);
  		$$ = cat_str(2, make_str("fetch backward"), cursor_marker);
  	}
! 	| FETCH BACKWARD from_in cursor_name opt_ecpg_into
  	{
  		char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4;
  		add_additional_variables($4, false);
--- 409,437 ----
  		$$ = EMPTY;
  	}
  ECPG: FetchStmtMOVEfetch_args rule
! 	| FETCH fetch_args ecpg_fetch_into
  	{
  		$$ = cat2_str(make_str("fetch"), $2);
  	}
! 	| FETCH FORWARD cursor_name opt_ecpg_fetch_into
  	{
  		char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3;
  		add_additional_variables($3, false);
  		$$ = cat_str(2, make_str("fetch forward"), cursor_marker);
  	}
! 	| FETCH FORWARD from_in cursor_name opt_ecpg_fetch_into
  	{
  		char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4;
  		add_additional_variables($4, false);
  		$$ = cat_str(2, make_str("fetch forward from"), cursor_marker);
  	}
! 	| FETCH BACKWARD cursor_name opt_ecpg_fetch_into
  	{
  		char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3;
  		add_additional_variables($3, false);
  		$$ = cat_str(2, make_str("fetch backward"), cursor_marker);
  	}
! 	| FETCH BACKWARD from_in cursor_name opt_ecpg_fetch_into
  	{
  		char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4;
  		add_additional_variables($4, false);
diff -dcrpN pgsql.orig/src/interfaces/ecpg/preproc/ecpg.trailer pgsql.2/src/interfaces/ecpg/preproc/ecpg.trailer
*** pgsql.orig/src/interfaces/ecpg/preproc/ecpg.trailer	2009-11-26 18:57:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/preproc/ecpg.trailer	2009-12-16 14:03:43.000000000 +0100
*************** ecpg_using:	USING using_list 	{ $$ = EMP
*** 970,991 ****
  		| using_descriptor      { $$ = $1; }
  		;
  
! using_descriptor: USING opt_sql SQL_DESCRIPTOR quoted_ident_stringvar
  		{
  			add_variable_to_head(&argsinsert, descriptor_variable($4,0), &no_indicator);
  			$$ = EMPTY;
  		}
  		;
  
! into_descriptor: INTO opt_sql SQL_DESCRIPTOR quoted_ident_stringvar
  		{
  			add_variable_to_head(&argsresult, descriptor_variable($4,1), &no_indicator);
  			$$ = EMPTY;
  		}
  		;
  
- opt_sql: /*EMPTY*/ | SQL_SQL;
- 
  using_list: UsingValue | UsingValue ',' using_list;
  
  UsingValue: UsingConst
--- 970,999 ----
  		| using_descriptor      { $$ = $1; }
  		;
  
! using_descriptor: USING SQL_SQL SQL_DESCRIPTOR quoted_ident_stringvar
  		{
  			add_variable_to_head(&argsinsert, descriptor_variable($4,0), &no_indicator);
  			$$ = EMPTY;
  		}
+ 		| USING SQL_DESCRIPTOR name
+ 		{
+ 			add_variable_to_head(&argsinsert, sqlda_variable($3), &no_indicator);
+ 			$$ = EMPTY;
+ 		}
  		;
  
! into_descriptor: INTO SQL_SQL SQL_DESCRIPTOR quoted_ident_stringvar
  		{
  			add_variable_to_head(&argsresult, descriptor_variable($4,1), &no_indicator);
  			$$ = EMPTY;
  		}
+ 		| INTO SQL_DESCRIPTOR name
+ 		{
+ 			add_variable_to_head(&argsresult, sqlda_variable($3), &no_indicator);
+ 			$$ = EMPTY;
+ 		}
  		;
  
  using_list: UsingValue | UsingValue ',' using_list;
  
  UsingValue: UsingConst
*************** ecpg_into: INTO into_list	{ $$ = EMPTY; 
*** 1806,1813 ****
          | into_descriptor	{ $$ = $1; }
  	;
  
! opt_ecpg_into:	/* EMPTY */	{ $$ = EMPTY; }
! 	| ecpg_into		{ $$ = $1; }
  	;
  
  %%
--- 1814,1836 ----
          | into_descriptor	{ $$ = $1; }
  	;
  
! ecpg_fetch_into: ecpg_into	{ $$ = $1; }
! 	| using_descriptor
! 	{
! 		struct variable *var;
! 
! 		if (!INFORMIX_MODE)
! 			mmerror(PARSE_ERROR, ET_ERROR, "Not in Informix compatibility mode");
! 
! 		var = argsinsert->variable;
! 		remove_variable_from_list(&argsinsert, var);
! 		add_variable_to_head(&argsresult, var, &no_indicator);
! 		$$ = $1;
! 	}
! 	;
! 
! opt_ecpg_fetch_into:	/* EMPTY */	{ $$ = EMPTY; }
! 	| ecpg_fetch_into		{ $$ = $1; }
  	;
  
  %%
diff -dcrpN pgsql.orig/src/interfaces/ecpg/preproc/ecpg.type pgsql.2/src/interfaces/ecpg/preproc/ecpg.type
*** pgsql.orig/src/interfaces/ecpg/preproc/ecpg.type	2009-11-26 18:57:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/preproc/ecpg.type	2009-12-16 14:03:43.000000000 +0100
***************
*** 61,66 ****
--- 61,67 ----
  %type <str> ecpg_ident
  %type <str> ecpg_interval
  %type <str> ecpg_into
+ %type <str> ecpg_fetch_into
  %type <str> ecpg_param
  %type <str> ecpg_sconst
  %type <str> ecpg_using
***************
*** 76,82 ****
  %type <str> opt_bit_field
  %type <str> opt_connection_name
  %type <str> opt_database_name
! %type <str> opt_ecpg_into
  %type <str> opt_ecpg_using
  %type <str> opt_initializer
  %type <str> opt_options
--- 77,83 ----
  %type <str> opt_bit_field
  %type <str> opt_connection_name
  %type <str> opt_database_name
! %type <str> opt_ecpg_fetch_into
  %type <str> opt_ecpg_using
  %type <str> opt_initializer
  %type <str> opt_options
diff -dcrpN pgsql.orig/src/interfaces/ecpg/preproc/extern.h pgsql.2/src/interfaces/ecpg/preproc/extern.h
*** pgsql.orig/src/interfaces/ecpg/preproc/extern.h	2009-11-26 18:57:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/preproc/extern.h	2009-12-16 14:03:43.000000000 +0100
*************** extern void add_descriptor(char *, char 
*** 88,93 ****
--- 88,94 ----
  extern void drop_descriptor(char *, char *);
  extern struct descriptor *lookup_descriptor(char *, char *);
  extern struct variable *descriptor_variable(const char *name, int input);
+ extern struct variable *sqlda_variable(const char *name);
  extern void add_variable_to_head(struct arguments **, struct variable *, struct variable *);
  extern void add_variable_to_tail(struct arguments **, struct variable *, struct variable *);
  extern void remove_variable_from_list(struct arguments ** list, struct variable * var);
diff -dcrpN pgsql.orig/src/interfaces/ecpg/preproc/type.c pgsql.2/src/interfaces/ecpg/preproc/type.c
*** pgsql.orig/src/interfaces/ecpg/preproc/type.c	2009-09-03 12:25:47.000000000 +0200
--- pgsql.2/src/interfaces/ecpg/preproc/type.c	2009-12-16 14:03:43.000000000 +0100
*************** get_type(enum ECPGttype type)
*** 194,199 ****
--- 194,202 ----
  		case ECPGt_descriptor:
  			return ("ECPGt_descriptor");
  			break;
+ 		case ECPGt_sqlda:
+ 			return ("ECPGt_sqlda");
+ 			break;
  		case ECPGt_date:
  			return ("ECPGt_date");
  			break;
*************** ECPGdump_a_simple(FILE *o, const char *n
*** 328,333 ****
--- 331,338 ----
  	else if (type == ECPGt_descriptor)
  		/* remember that name here already contains quotes (if needed) */
  		fprintf(o, "\n\tECPGt_descriptor, %s, 0L, 0L, 0L, ", name);
+ 	else if (type == ECPGt_sqlda)
+ 		fprintf(o, "\n\tECPGt_sqlda, &%s, 0L, 0L, 0L, ", name);
  	else
  	{
  		char	   *variable = (char *) mm_alloc(strlen(name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 4);
diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/compat_informix/Makefile pgsql.2/src/interfaces/ecpg/test/compat_informix/Makefile
*** pgsql.orig/src/interfaces/ecpg/test/compat_informix/Makefile	2006-09-19 17:36:08.000000000 +0200
--- pgsql.2/src/interfaces/ecpg/test/compat_informix/Makefile	2009-12-16 14:03:43.000000000 +0100
*************** TESTS = test_informix test_informix.c \
*** 16,21 ****
--- 16,22 ----
          rfmtdate rfmtdate.c \
          rfmtlong rfmtlong.c \
          rnull rnull.c \
+         sqlda sqlda.c \
          charfuncs charfuncs.c
  
  all: $(TESTS)
*************** test_informix.c: test_informix.pgc ../re
*** 26,31 ****
--- 27,35 ----
  test_informix2.c: test_informix2.pgc ../regression.h
  	$(ECPG) -o $@ -I$(srcdir) $<
  
+ sqlda.c: sqlda.pgc ../regression.h
+ 	$(ECPG) -o $@ -I$(srcdir) $<
+ 
  dec_test.c: dec_test.pgc ../regression.h
  	$(ECPG) -o $@ -I$(srcdir) $<
  
diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/compat_informix/sqlda.pgc pgsql.2/src/interfaces/ecpg/test/compat_informix/sqlda.pgc
*** pgsql.orig/src/interfaces/ecpg/test/compat_informix/sqlda.pgc	1970-01-01 01:00:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/test/compat_informix/sqlda.pgc	2009-12-16 14:03:43.000000000 +0100
***************
*** 0 ****
--- 1,248 ----
+ #include <stdlib.h>
+ #include <string.h>
+ #include <inttypes.h>
+ 
+ exec sql include ../regression;
+ 
+ exec sql include sqlda.h;
+ exec sql include sqltypes.h;
+ 
+ exec sql whenever sqlerror stop;
+ 
+ /* These shouldn't be under DECLARE SECTION */
+ pg_sqlda_t	*inp_sqlda, *outp_sqlda;
+ 
+ static void
+ dump_sqlda(pg_sqlda_t *sqlda)
+ {
+ 	int	i;
+ 
+ 	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 SQLINT8:
+ 			printf("name sqlda descriptor: '%s' value %" PRId64 "\n", sqlda->sqlvar[i].sqlname, *(int64_t *)sqlda->sqlvar[i].sqldata);
+ 			break;
+ 		case SQLFLOAT:
+ 			printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
+ 			break;
+ 		case SQLDECIMAL:
+ 			{
+ 				char    val[64];
+ 				dectoasc((dec_t *)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;
+ 	char	*stmt1 = "SELECT * FROM t1";
+ 	char	*stmt2 = "SELECT * FROM t1 WHERE id = ?";
+ 	int	rec;
+ 	int	id;
+ exec sql end declare section;
+ 
+ 	char msg[128];
+ 
+ 	ECPGdebug(1, stderr);
+ 
+ 	strcpy(msg, "connect");
+ 	exec sql connect to REGRESSDB1 as regress1;
+ 
+ 	strcpy(msg, "set");
+ 	exec sql set datestyle to iso;
+ 
+ 	strcpy(msg, "create");
+ 	exec sql create table t1(
+ 		id integer,
+ 		t text,
+ 		d1 numeric,
+ 		d2 float8,
+ 		c char(10));
+ 
+ 	strcpy(msg, "insert");
+ 	exec sql insert into t1 values
+ 		(1, 'a', 1.0, 1, 'a'),
+ 		(2, null, null, null, null),
+ 		(3, '"c"', -3, 'nan'::float8, 'c'),
+ 		(4, 'd', 4.0, 4, 'd');
+ 
+ 	strcpy(msg, "commit");
+ 	exec sql commit;
+ 
+ 	/* SQLDA test for getting all records from a table */
+ 
+ 	outp_sqlda = NULL;
+ 
+ 	strcpy(msg, "prepare");
+ 	exec sql prepare st_id1 from :stmt1;
+ 
+ 	strcpy(msg, "declare");
+ 	exec sql declare mycur1 cursor for st_id1;
+ 
+ 	strcpy(msg, "open");
+ 	exec sql open mycur1;
+ 
+ 	exec sql whenever not found do break;
+ 
+ 	rec = 0;
+ 	while (1)
+ 	{
+ 		strcpy(msg, "fetch");
+ 		exec sql fetch 1 from mycur1 into descriptor outp_sqlda; 
+ 
+ 		printf("FETCH RECORD %d\n", ++rec);
+ 		dump_sqlda(outp_sqlda);
+ 	}
+ 
+ 	exec sql whenever not found continue;
+ 
+ 	strcpy(msg, "close");
+ 	exec sql close mycur1;
+ 
+ 	strcpy(msg, "deallocate");
+ 	exec sql deallocate prepare st_id1;
+ 
+ 	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");
+ 	exec sql prepare st_id2 from :stmt1;
+ 
+ 	strcpy(msg, "declare");
+ 	exec sql declare mycur2 cursor for st_id2;
+ 
+ 	strcpy(msg, "open");
+ 	exec sql open mycur2;
+ 
+ 	exec sql whenever not found do break;
+ 
+ 	rec = 0;
+ 	while (1)
+ 	{
+ 		strcpy(msg, "fetch");
+ 		exec sql fetch from mycur2 using descriptor outp_sqlda;
+ 
+ 		printf("FETCH RECORD %d\n", ++rec);
+ 		dump_sqlda(outp_sqlda);
+ 	}
+ 
+ 	exec sql whenever not found continue;
+ 
+ 	strcpy(msg, "close");
+ 	exec sql close mycur2;
+ 
+ 	strcpy(msg, "deallocate");
+ 	exec sql deallocate prepare st_id2;
+ 
+ 	free(outp_sqlda);
+ 
+ 	/* SQLDA test for getting one record using an input descriptor */
+ 
+ 	/* Input sqlda has to be built manually */
+ 	inp_sqlda = (pg_sqlda_t *)malloc(sizeof(pg_sqlda_t));
+ 	memset(inp_sqlda, 0, sizeof(pg_sqlda_t));
+ 	inp_sqlda->sqld = 1;
+ 	inp_sqlda->sqlvar = malloc(sizeof(pg_sqlvar_t));
+ 	memset(inp_sqlda->sqlvar, 0, sizeof(pg_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");
+ 	exec sql prepare st_id3 FROM :stmt2;
+ 
+ 	strcpy(msg, "execute");
+ 	exec sql execute st_id3 using descriptor inp_sqlda into descriptor outp_sqlda;
+ 
+ 	dump_sqlda(outp_sqlda);
+ 
+ 	strcpy(msg, "deallocate");
+ 	exec sql deallocate prepare st_id3;
+ 
+ 	free(inp_sqlda->sqlvar);
+ 	free(inp_sqlda);
+ 	free(outp_sqlda);
+ 
+ 	/* SQLDA test for getting one record using an input descriptor
+ 	 * on a named connection
+ 	 */
+ 
+ 	exec sql connect to REGRESSDB1 as con2;
+ 
+ 	/* Input sqlda has to be built manually */
+ 	inp_sqlda = (pg_sqlda_t *)malloc(sizeof(pg_sqlda_t));
+ 	memset(inp_sqlda, 0, sizeof(pg_sqlda_t));
+ 	inp_sqlda->sqld = 1;
+ 	inp_sqlda->sqlvar = malloc(sizeof(pg_sqlvar_t));
+ 	memset(inp_sqlda->sqlvar, 0, sizeof(pg_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");
+ 	exec sql at con2 prepare st_id4 FROM :stmt2;
+ 
+ 	strcpy(msg, "execute");
+ 	exec sql at con2 execute st_id4 using descriptor inp_sqlda into descriptor outp_sqlda;
+ 
+ 	dump_sqlda(outp_sqlda);
+ 
+ 	strcpy(msg, "commit");
+ 	exec sql at con2 commit;
+ 
+ 	strcpy(msg, "deallocate");
+ 	exec sql deallocate prepare st_id4;
+ 
+ 	free(inp_sqlda->sqlvar);
+ 	free(inp_sqlda);
+ 	free(outp_sqlda);
+ 
+ 	strcpy(msg, "disconnect");
+ 	exec sql disconnect con2;
+ 
+ 	/* End test */
+ 
+ 	strcpy(msg, "drop");
+ 	exec sql drop table t1;
+ 
+ 	strcpy(msg, "commit");
+ 	exec sql commit;
+ 
+ 	strcpy(msg, "disconnect");
+ 	exec sql disconnect;
+ 
+ 	return (0);
+ }
diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/ecpg_schedule pgsql.2/src/interfaces/ecpg/test/ecpg_schedule
*** pgsql.orig/src/interfaces/ecpg/test/ecpg_schedule	2009-11-26 18:57:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/test/ecpg_schedule	2009-12-16 14:03:43.000000000 +0100
*************** test: compat_informix/charfuncs
*** 3,8 ****
--- 3,9 ----
  test: compat_informix/rfmtdate
  test: compat_informix/rfmtlong
  test: compat_informix/rnull
+ test: compat_informix/sqlda
  test: compat_informix/test_informix
  test: compat_informix/test_informix2
  test: connect/test2
*************** test: sql/code100
*** 29,34 ****
--- 30,36 ----
  test: sql/copystdout
  test: sql/define
  test: sql/desc
+ test: sql/sqlda
  test: sql/dynalloc
  test: sql/dynalloc2
  test: sql/dyntest
diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/ecpg_schedule_tcp pgsql.2/src/interfaces/ecpg/test/ecpg_schedule_tcp
*** pgsql.orig/src/interfaces/ecpg/test/ecpg_schedule_tcp	2009-11-26 18:57:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/test/ecpg_schedule_tcp	2009-12-16 14:03:43.000000000 +0100
*************** test: compat_informix/charfuncs
*** 3,8 ****
--- 3,9 ----
  test: compat_informix/rfmtdate
  test: compat_informix/rfmtlong
  test: compat_informix/rnull
+ test: compat_informix/sqlda
  test: compat_informix/test_informix
  test: compat_informix/test_informix2
  test: connect/test2
*************** test: sql/code100
*** 29,34 ****
--- 30,36 ----
  test: sql/copystdout
  test: sql/define
  test: sql/desc
+ test: sql/sqlda
  test: sql/dynalloc
  test: sql/dynalloc2
  test: sql/dyntest
diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c pgsql.2/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
*** pgsql.orig/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c	1970-01-01 01:00:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c	2009-12-16 14:12:11.000000000 +0100
***************
*** 0 ****
--- 1,561 ----
+ /* 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 <inttypes.h>
+ 
+ 
+ #line 1 "regression.h"
+ 
+ 
+ 
+ 
+ 
+ 
+ #line 5 "sqlda.pgc"
+ 
+ 
+ 
+ #line 1 "sqlda.h"
+ /*
+  * $PostgreSQL: pgsql/src/interfaces/ecpg/include/sqlda.h,v 1.4 2009/06/11 14:49:13 momjian Exp $
+  */
+ 
+ #ifndef POSTGRES_SQLDA_H
+ #define POSTGRES_SQLDA_H
+ 
+ #include "ecpglib.h"
+ 
+ typedef struct sqlvar_struct
+ {
+ 	short	sqltype;		/* variable type                */
+ 	int	sqllen;			/* length in bytes              */
+ 	char	   *sqldata;		/* pointer to data              */
+ 	short	   *sqlind;		/* pointer to indicator         */
+ 	char	   *sqlname;		/* variable name                */
+ 	char	   *sqlformat;		/* reserved for future use      */
+ 	short	sqlitype;		/* ind variable type            */
+ 	short	sqlilen;		/* ind length in bytes          */
+ 	char	   *sqlidata;		/* ind data pointer             */
+ 	int	sqlxid;			/* extended id type             */
+ 	char	   *sqltypename;	/* extended type name           */
+ 	short	sqltypelen;		/* length of extended type name */
+ 	short	sqlownerlen;		/* length of owner name         */
+ 	short	sqlsourcetype;		/* source type for distinct of built-ins */
+ 	char	   *sqlownername;	/* owner name                   */
+ 	int	sqlsourceid;		/* extended id of source type   */
+ 
+ 	/*
+ 	 * sqlilongdata is new.  It supports data that exceeds the 32k
+ 	 * limit.  sqlilen and sqlidata are for backward compatibility
+ 	 * and they have maximum value of <32K.
+ 	 */
+ 	char	   *sqlilongdata;	/* for data field beyond 32K    */
+ 	int	sqlflags;		/* for internal use only        */
+ 	void	   *sqlreserved;	/* reserved for future use      */
+ } pg_sqlvar_t;
+ 
+ typedef struct sqlda
+ {
+ 	short		sqld;
+ 	pg_sqlvar_t	   *sqlvar;
+ 	char		desc_name[19];	/* descriptor name              */
+ 	short		desc_occ;	/* size of sqlda structure      */
+ 	struct sqlda	   *desc_next;	/* pointer to next sqlda struct */
+ 	void		   *reserved;	/* reserved for future use */
+ } pg_sqlda_t;
+ 
+ #endif /* POSTGRES_SQLDA_H */
+ 
+ #line 7 "sqlda.pgc"
+ 
+ 
+ #line 1 "sqltypes.h"
+ /*
+  * $PostgreSQL: pgsql/src/interfaces/ecpg/include/sqltypes.h,v 1.9 2009/06/11 14:49:13 momjian Exp $
+  */
+ #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
+ #if (LONG_BIT == 64)
+ #define	SQLINT8		ECPGt_long
+ #define	SQLSERIAL8	ECPGt_long
+ #else
+ #define	SQLINT8		ECPGt_long_long
+ #define	SQLSERIAL8	ECPGt_long_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 */
+ pg_sqlda_t	*inp_sqlda, *outp_sqlda;
+ 
+ static void
+ dump_sqlda(pg_sqlda_t *sqlda)
+ {
+ 	int	i;
+ 
+ 	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 SQLINT8:
+ 			printf("name sqlda descriptor: '%s' value %" PRId64 "\n", sqlda->sqlvar[i].sqlname, *(int64_t *)sqlda->sqlvar[i].sqldata);
+ 			break;
+ 		case SQLFLOAT:
+ 			printf("name sqlda descriptor: '%s' value %lf\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 54 "sqlda.pgc"
+  char * stmt1 = "SELECT * FROM t1" ;
+  
+ #line 55 "sqlda.pgc"
+  char * stmt2 = "SELECT * FROM t1 WHERE id = ?" ;
+  
+ #line 56 "sqlda.pgc"
+  int rec ;
+  
+ #line 57 "sqlda.pgc"
+  int id ;
+ /* exec sql end declare section */
+ #line 58 "sqlda.pgc"
+ 
+ 
+ 	char msg[128];
+ 
+ 	ECPGdebug(1, stderr);
+ 
+ 	strcpy(msg, "connect");
+ 	{ ECPGconnect(__LINE__, 1, "regress1" , NULL, NULL , "regress1", 0); 
+ #line 65 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 65 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "set");
+ 	{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+ #line 68 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 68 "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 76 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 76 "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 ) , ( 3 , '\"c\"' , - 3 , 'nan' :: float8 , 'c' ) , ( 4 , 'd' , 4.0 , 4 , 'd' )", ECPGt_EOIT, ECPGt_EORT);
+ #line 83 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 83 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "commit");
+ 	{ ECPGtrans(__LINE__, NULL, "commit");
+ #line 86 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 86 "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 93 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 93 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "declare");
+ 	ECPG_informix_reset_sqlca(); /* declare mycur1 cursor for $1 */
+ #line 96 "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 99 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 99 "sqlda.pgc"
+ 
+ 
+ 	/* exec sql whenever not found  break ; */
+ #line 101 "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 107 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+ #line 107 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 107 "sqlda.pgc"
+  
+ 
+ 		printf("FETCH RECORD %d\n", ++rec);
+ 		dump_sqlda(outp_sqlda);
+ 	}
+ 
+ 	/* exec sql whenever not found  continue ; */
+ #line 113 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "close");
+ 	{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "close mycur1", ECPGt_EOIT, ECPGt_EORT);
+ #line 116 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 116 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "deallocate");
+ 	{ ECPGdeallocate(__LINE__, 1, NULL, "st_id1");
+ #line 119 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 119 "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 130 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 130 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "declare");
+ 	ECPG_informix_reset_sqlca(); /* declare mycur2 cursor for $1 */
+ #line 133 "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 136 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 136 "sqlda.pgc"
+ 
+ 
+ 	/* exec sql whenever not found  break ; */
+ #line 138 "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 144 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+ #line 144 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 144 "sqlda.pgc"
+ 
+ 
+ 		printf("FETCH RECORD %d\n", ++rec);
+ 		dump_sqlda(outp_sqlda);
+ 	}
+ 
+ 	/* exec sql whenever not found  continue ; */
+ #line 150 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "close");
+ 	{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "close mycur2", ECPGt_EOIT, ECPGt_EORT);
+ #line 153 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 153 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "deallocate");
+ 	{ ECPGdeallocate(__LINE__, 1, NULL, "st_id2");
+ #line 156 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 156 "sqlda.pgc"
+ 
+ 
+ 	free(outp_sqlda);
+ 
+ 	/* SQLDA test for getting one record using an input descriptor */
+ 
+ 	/* Input sqlda has to be built manually */
+ 	inp_sqlda = (pg_sqlda_t *)malloc(sizeof(pg_sqlda_t));
+ 	memset(inp_sqlda, 0, sizeof(pg_sqlda_t));
+ 	inp_sqlda->sqld = 1;
+ 	inp_sqlda->sqlvar = malloc(sizeof(pg_sqlvar_t));
+ 	memset(inp_sqlda->sqlvar, 0, sizeof(pg_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 179 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 179 "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 182 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 182 "sqlda.pgc"
+ 
+ 
+ 	dump_sqlda(outp_sqlda);
+ 
+ 	strcpy(msg, "deallocate");
+ 	{ ECPGdeallocate(__LINE__, 1, NULL, "st_id3");
+ #line 187 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 187 "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, "regress1" , NULL, NULL , "con2", 0); 
+ #line 197 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 197 "sqlda.pgc"
+ 
+ 
+ 	/* Input sqlda has to be built manually */
+ 	inp_sqlda = (pg_sqlda_t *)malloc(sizeof(pg_sqlda_t));
+ 	memset(inp_sqlda, 0, sizeof(pg_sqlda_t));
+ 	inp_sqlda->sqld = 1;
+ 	inp_sqlda->sqlvar = malloc(sizeof(pg_sqlvar_t));
+ 	memset(inp_sqlda->sqlvar, 0, sizeof(pg_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 216 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 216 "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 219 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 219 "sqlda.pgc"
+ 
+ 
+ 	dump_sqlda(outp_sqlda);
+ 
+ 	strcpy(msg, "commit");
+ 	{ ECPGtrans(__LINE__, "con2", "commit");
+ #line 224 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 224 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "deallocate");
+ 	{ ECPGdeallocate(__LINE__, 1, NULL, "st_id4");
+ #line 227 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 227 "sqlda.pgc"
+ 
+ 
+ 	free(inp_sqlda->sqlvar);
+ 	free(inp_sqlda);
+ 	free(outp_sqlda);
+ 
+ 	strcpy(msg, "disconnect");
+ 	{ ECPGdisconnect(__LINE__, "con2");
+ #line 234 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 234 "sqlda.pgc"
+ 
+ 
+ 	/* End test */
+ 
+ 	strcpy(msg, "drop");
+ 	{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT);
+ #line 239 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 239 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "commit");
+ 	{ ECPGtrans(__LINE__, NULL, "commit");
+ #line 242 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 242 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "disconnect");
+ 	{ ECPGdisconnect(__LINE__, "CURRENT");
+ #line 245 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 245 "sqlda.pgc"
+ 
+ 
+ 	return (0);
+ }
diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/expected/compat_informix-sqlda.stderr pgsql.2/src/interfaces/ecpg/test/expected/compat_informix-sqlda.stderr
*** pgsql.orig/src/interfaces/ecpg/test/expected/compat_informix-sqlda.stderr	1970-01-01 01:00:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/test/expected/compat_informix-sqlda.stderr	2009-12-16 14:03:43.000000000 +0100
***************
*** 0 ****
--- 1,584 ----
+ [NO_PID]: ECPGdebug: set to 1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>  
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 68: 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 68: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 68: OK: SET
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 71: 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 71: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 71: OK: CREATE TABLE
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 79: query: insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' ) , ( 2 , null , null , null , null ) , ( 3 , '"c"' , - 3 , 'nan' :: float8 , 'c' ) , ( 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 79: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 79: OK: INSERT 0 4
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGtrans on line 86: action "commit"; connection "regress1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGprepare on line 93: name st_id1; query: "SELECT * FROM t1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 99: 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 99: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 99: OK: DECLARE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: 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 107: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: 1 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: a offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: 1.0 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: 1 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: a          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: 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 107: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: 2 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: 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 107: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: 3 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: "c" offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: -3 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: NaN offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: c          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: 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 107: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: d offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: 4.0 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 107: RESULT: d          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: 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 107: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 107: correctly got 0 tuples with 5 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 116: query: close mycur1; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 116: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 116: OK: CLOSE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGdeallocate on line 119: name st_id1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGprepare on line 130: name st_id2; query: "SELECT * FROM t1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 136: 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 136: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 136: OK: DECLARE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: query: fetch from mycur2; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: 1 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: a offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: 1.0 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: 1 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: a          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: query: fetch from mycur2; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: 2 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: query: fetch from mycur2; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: 3 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: "c" offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: -3 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: NaN offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: c          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: query: fetch from mycur2; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: d offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: 4.0 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 144: RESULT: d          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: query: fetch from mycur2; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 144: correctly got 0 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: raising sqlcode 100 on line 144: no data found on line 144
+ [NO_PID]: sqlca: code: 100, state: 02000
+ [NO_PID]: ecpg_execute on line 153: query: close mycur2; with 0 parameter(s) on connection regress1
+ [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_execute on line 153: OK: CLOSE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGdeallocate on line 156: name st_id2
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGprepare on line 179: name st_id3; query: "SELECT * FROM t1 WHERE id = $1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 182: 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 182: using PQexecPrepared for "SELECT * FROM t1 WHERE id = $1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: free_params on line 182: parameter 1 = 4
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 182: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 182: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 182: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 182: RESULT: d offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 182: RESULT: 4.0 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 182: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 182: RESULT: d          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 182: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGdeallocate on line 187: name st_id3
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>  
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGprepare on line 216: name st_id4; query: "SELECT * FROM t1 WHERE id = $1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 219: 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 219: using PQexecPrepared for "SELECT * FROM t1 WHERE id = $1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: free_params on line 219: parameter 1 = 4
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 219: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 219: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 219: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 219: RESULT: d offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type decimal offset 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 219: RESULT: 4.0 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 219: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 744
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 219: RESULT: d          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 219: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGtrans on line 224: action "commit"; connection "con2"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGdeallocate on line 227: 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 239: query: drop table t1; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 239: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 239: OK: DROP TABLE
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGtrans on line 242: 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 -dcrpN pgsql.orig/src/interfaces/ecpg/test/expected/compat_informix-sqlda.stdout pgsql.2/src/interfaces/ecpg/test/expected/compat_informix-sqlda.stdout
*** pgsql.orig/src/interfaces/ecpg/test/expected/compat_informix-sqlda.stdout	1970-01-01 01:00:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/test/expected/compat_informix-sqlda.stdout	2009-12-16 14:03:43.000000000 +0100
***************
*** 0 ****
--- 1,60 ----
+ 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 3
+ name sqlda descriptor: 't' value '"c"'
+ name sqlda descriptor: 'd1' value DECIMAL '-3'
+ name sqlda descriptor: 'd2' value nan
+ name sqlda descriptor: 'c' value 'c         '
+ FETCH 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         '
+ 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 3
+ name sqlda descriptor: 't' value '"c"'
+ name sqlda descriptor: 'd1' value DECIMAL '-3'
+ name sqlda descriptor: 'd2' value nan
+ name sqlda descriptor: 'c' value 'c         '
+ FETCH 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         '
+ 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 -dcrpN pgsql.orig/src/interfaces/ecpg/test/expected/sql-sqlda.c pgsql.2/src/interfaces/ecpg/test/expected/sql-sqlda.c
*** pgsql.orig/src/interfaces/ecpg/test/expected/sql-sqlda.c	1970-01-01 01:00:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/test/expected/sql-sqlda.c	2009-12-16 14:12:23.000000000 +0100
***************
*** 0 ****
--- 1,569 ----
+ /* 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 <inttypes.h>
+ #include <limits.h>
+ 
+ 
+ #line 1 "regression.h"
+ 
+ 
+ 
+ 
+ 
+ 
+ #line 6 "sqlda.pgc"
+ 
+ 
+ 
+ #line 1 "sqlda.h"
+ /*
+  * $PostgreSQL: pgsql/src/interfaces/ecpg/include/sqlda.h,v 1.4 2009/06/11 14:49:13 momjian Exp $
+  */
+ 
+ #ifndef POSTGRES_SQLDA_H
+ #define POSTGRES_SQLDA_H
+ 
+ #include "ecpglib.h"
+ 
+ typedef struct sqlvar_struct
+ {
+ 	short	sqltype;		/* variable type                */
+ 	int	sqllen;			/* length in bytes              */
+ 	char	   *sqldata;		/* pointer to data              */
+ 	short	   *sqlind;		/* pointer to indicator         */
+ 	char	   *sqlname;		/* variable name                */
+ 	char	   *sqlformat;		/* reserved for future use      */
+ 	short	sqlitype;		/* ind variable type            */
+ 	short	sqlilen;		/* ind length in bytes          */
+ 	char	   *sqlidata;		/* ind data pointer             */
+ 	int	sqlxid;			/* extended id type             */
+ 	char	   *sqltypename;	/* extended type name           */
+ 	short	sqltypelen;		/* length of extended type name */
+ 	short	sqlownerlen;		/* length of owner name         */
+ 	short	sqlsourcetype;		/* source type for distinct of built-ins */
+ 	char	   *sqlownername;	/* owner name                   */
+ 	int	sqlsourceid;		/* extended id of source type   */
+ 
+ 	/*
+ 	 * sqlilongdata is new.  It supports data that exceeds the 32k
+ 	 * limit.  sqlilen and sqlidata are for backward compatibility
+ 	 * and they have maximum value of <32K.
+ 	 */
+ 	char	   *sqlilongdata;	/* for data field beyond 32K    */
+ 	int	sqlflags;		/* for internal use only        */
+ 	void	   *sqlreserved;	/* reserved for future use      */
+ } pg_sqlvar_t;
+ 
+ typedef struct sqlda
+ {
+ 	short		sqld;
+ 	pg_sqlvar_t	   *sqlvar;
+ 	char		desc_name[19];	/* descriptor name              */
+ 	short		desc_occ;	/* size of sqlda structure      */
+ 	struct sqlda	   *desc_next;	/* pointer to next sqlda struct */
+ 	void		   *reserved;	/* reserved for future use */
+ } pg_sqlda_t;
+ 
+ #endif /* POSTGRES_SQLDA_H */
+ 
+ #line 8 "sqlda.pgc"
+ 
+ 
+ #line 1 "pgtypes_numeric.h"
+ /* $PostgreSQL: pgsql/src/interfaces/ecpg/include/pgtypes_numeric.h,v 1.16 2006/08/09 07:30:56 meskes Exp $ */
+ 
+ #ifndef PGTYPES_NUMERIC
+ #define PGTYPES_NUMERIC
+ 
+ #define NUMERIC_POS						0x0000
+ #define NUMERIC_NEG						0x4000
+ #define NUMERIC_NAN						0xC000
+ #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 9 "sqlda.pgc"
+ 
+ 
+ /* exec sql whenever sqlerror  stop ; */
+ #line 11 "sqlda.pgc"
+ 
+ 
+ /* These shouldn't be under DECLARE SECTION */
+ pg_sqlda_t	*inp_sqlda, *outp_sqlda, *outp_sqlda1;
+ 
+ static void
+ dump_sqlda(pg_sqlda_t *sqlda)
+ {
+ 	int	i;
+ 
+ 	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 ECPGt_char:
+ 			printf("name sqlda descriptor: '%s' value '%s'\n", sqlda->sqlvar[i].sqlname, sqlda->sqlvar[i].sqldata);
+ 			break;
+ 		case ECPGt_int:
+ 			printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname, *(int *)sqlda->sqlvar[i].sqldata);
+ 			break;
+ #if (LONG_BIT == 64) /* Defined via <limits.h> */
+ 		case ECPGt_long:
+ #else
+ # if (LONG_BIT = 32)
+ 		case ECPGt_long_long:
+ # else
+ #  error Neither "long" nor "long long" are 64-bit
+ # endif
+ #endif
+ 			printf("name sqlda descriptor: '%s' value %" PRId64 "\n", sqlda->sqlvar[i].sqlname, *(int64_t *)sqlda->sqlvar[i].sqldata);
+ 			break;
+ 		case ECPGt_double:
+ 			printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname, *(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, val);
+ 				free(val);
+ 				break;
+ 			}
+ 		}
+ 	}
+ }
+ 
+ int
+ main (void)
+ {
+ /* exec sql begin declare section */
+ 		  
+ 		  
+ 		
+ 		
+ 
+ #line 65 "sqlda.pgc"
+  char * stmt1 = "SELECT * FROM t1" ;
+  
+ #line 66 "sqlda.pgc"
+  char * stmt2 = "SELECT * FROM t1 WHERE id = ?" ;
+  
+ #line 67 "sqlda.pgc"
+  int rec ;
+  
+ #line 68 "sqlda.pgc"
+  int id ;
+ /* exec sql end declare section */
+ #line 69 "sqlda.pgc"
+ 
+ 
+ 	char msg[128];
+ 
+ 	ECPGdebug(1, stderr);
+ 
+ 	strcpy(msg, "connect");
+ 	{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , "regress1", 0); 
+ #line 76 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 76 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "set");
+ 	{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+ #line 79 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 79 "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 ) )", ECPGt_EOIT, ECPGt_EORT);
+ #line 87 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 87 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "insert");
+ 	{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' ) , ( 2 , null , null , null , null ) , ( 3 , '\"c\"' , - 3 , 'nan' :: float8 , 'c' ) , ( 4 , 'd' , 4.0 , 4 , 'd' )", ECPGt_EOIT, ECPGt_EORT);
+ #line 94 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 94 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "commit");
+ 	{ ECPGtrans(__LINE__, NULL, "commit");
+ #line 97 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 97 "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 104 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 104 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "declare");
+ 	/* declare mycur1 cursor for $1 */
+ #line 107 "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 110 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 110 "sqlda.pgc"
+ 
+ 
+ 	/* exec sql whenever not found  break ; */
+ #line 112 "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 118 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+ #line 118 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 118 "sqlda.pgc"
+  
+ 
+ 		printf("FETCH RECORD %d\n", ++rec);
+ 		dump_sqlda(outp_sqlda);
+ 	}
+ 
+ 	/* exec sql whenever not found  continue ; */
+ #line 124 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "close");
+ 	{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close mycur1", ECPGt_EOIT, ECPGt_EORT);
+ #line 127 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 127 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "deallocate");
+ 	{ ECPGdeallocate(__LINE__, 0, NULL, "st_id1");
+ #line 130 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 130 "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 139 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 139 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "declare");
+ 	/* declare mycur2 cursor for $1 */
+ #line 142 "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 145 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 145 "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 148 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 148 "sqlda.pgc"
+ 
+ 
+ 	outp_sqlda1 = outp_sqlda;
+ 	rec = 0;
+ 	while (outp_sqlda1)
+ 	{
+ 		pg_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 164 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 164 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "deallocate");
+ 	{ ECPGdeallocate(__LINE__, 0, NULL, "st_id2");
+ #line 167 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 167 "sqlda.pgc"
+ 
+ 
+ 	/* SQLDA test for getting one record using an input descriptor */
+ 
+ 	/* Input sqlda has to be built manually */
+ 	inp_sqlda = (pg_sqlda_t *)malloc(sizeof(pg_sqlda_t));
+ 	memset(inp_sqlda, 0, sizeof(pg_sqlda_t));
+ 	inp_sqlda->sqld = 1;
+ 	inp_sqlda->sqlvar = malloc(sizeof(pg_sqlvar_t));
+ 	memset(inp_sqlda->sqlvar, 0, sizeof(pg_sqlvar_t));
+ 
+ 	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 188 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 188 "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 191 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 191 "sqlda.pgc"
+ 
+ 
+ 	dump_sqlda(outp_sqlda);
+ 
+ 	strcpy(msg, "deallocate");
+ 	{ ECPGdeallocate(__LINE__, 0, NULL, "st_id3");
+ #line 196 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 196 "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__, 0, "regress1" , NULL, NULL , "con2", 0); 
+ #line 206 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 206 "sqlda.pgc"
+ 
+ 
+ 	/* Input sqlda has to be built manually */
+ 	inp_sqlda = (pg_sqlda_t *)malloc(sizeof(pg_sqlda_t));
+ 	memset(inp_sqlda, 0, sizeof(pg_sqlda_t));
+ 	inp_sqlda->sqld = 1;
+ 	inp_sqlda->sqlvar = malloc(sizeof(pg_sqlvar_t));
+ 	memset(inp_sqlda->sqlvar, 0, sizeof(pg_sqlvar_t));
+ 
+ 	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 225 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 225 "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 228 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 228 "sqlda.pgc"
+ 
+ 
+ 	dump_sqlda(outp_sqlda);
+ 
+ 	strcpy(msg, "commit");
+ 	{ ECPGtrans(__LINE__, "con2", "commit");
+ #line 233 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 233 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "deallocate");
+ 	{ ECPGdeallocate(__LINE__, 0, NULL, "st_id4");
+ #line 236 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 236 "sqlda.pgc"
+ 
+ 
+ 	free(inp_sqlda->sqlvar);
+ 	free(inp_sqlda);
+ 	free(outp_sqlda);
+ 
+ 	strcpy(msg, "disconnect");
+ 	{ ECPGdisconnect(__LINE__, "con2");
+ #line 243 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 243 "sqlda.pgc"
+ 
+ 
+ 	/* End test */
+ 
+ 	strcpy(msg, "drop");
+ 	{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT);
+ #line 248 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 248 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "commit");
+ 	{ ECPGtrans(__LINE__, NULL, "commit");
+ #line 251 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 251 "sqlda.pgc"
+ 
+ 
+ 	strcpy(msg, "disconnect");
+ 	{ ECPGdisconnect(__LINE__, "CURRENT");
+ #line 254 "sqlda.pgc"
+ 
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 254 "sqlda.pgc"
+ 
+ 
+ 	return (0);
+ }
diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/expected/sql-sqlda.stderr pgsql.2/src/interfaces/ecpg/test/expected/sql-sqlda.stderr
*** pgsql.orig/src/interfaces/ecpg/test/expected/sql-sqlda.stderr	1970-01-01 01:00:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/test/expected/sql-sqlda.stderr	2009-12-16 14:03:43.000000000 +0100
***************
*** 0 ****
--- 1,574 ----
+ [NO_PID]: ECPGdebug: set to 1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>  
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 79: 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 79: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 79: OK: SET
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 82: 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 82: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 82: OK: CREATE TABLE
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 90: query: insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' ) , ( 2 , null , null , null , null ) , ( 3 , '"c"' , - 3 , 'nan' :: float8 , 'c' ) , ( 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 90: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 90: OK: INSERT 0 4
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGtrans on line 97: action "commit"; connection "regress1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGprepare on line 104: name st_id1; query: "SELECT * FROM t1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 110: 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 110: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 110: OK: DECLARE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: 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 118: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 118: RESULT: 1 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 118: RESULT: a offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 118: RESULT: 1 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 118: RESULT: a          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: 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 118: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 118: RESULT: 2 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: 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 118: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 118: RESULT: 3 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 118: RESULT: "c" offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 118: RESULT: NaN offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 118: RESULT: c          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: 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 118: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 118: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 118: RESULT: d offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 118: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 118: RESULT: d          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: 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 118: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 118: correctly got 0 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: raising sqlcode 100 on line 118: no data found on line 118
+ [NO_PID]: sqlca: code: 100, state: 02000
+ [NO_PID]: ecpg_execute on line 127: query: close 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_execute on line 127: OK: CLOSE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGdeallocate on line 130: name st_id1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGprepare on line 139: name st_id2; query: "SELECT * FROM t1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 145: 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 145: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 145: OK: DECLARE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 148: 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 148: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 148: correctly got 4 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 148: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 3 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 148: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 3 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 148: RESULT: d offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 3 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 3 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 148: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 3 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 148: RESULT: d          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 148: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 148: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 2 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 148: RESULT: 3 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 2 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 148: RESULT: "c" offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 2 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 2 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 148: RESULT: NaN offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 2 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 148: RESULT: c          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 148: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 148: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 1 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 148: RESULT: 2 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 1 col 1 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 1 col 2 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 1 col 3 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 1 col 4 IS NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 148: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 148: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 148: RESULT: 1 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 148: RESULT: a offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 148: RESULT: 1 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 148: RESULT: a          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 148: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 164: query: close mycur2; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 164: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 164: OK: CLOSE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGdeallocate on line 167: name st_id2
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGprepare on line 188: name st_id3; query: "SELECT * FROM t1 WHERE id = $1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 191: 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 191: using PQexecPrepared for "SELECT * FROM t1 WHERE id = $1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: free_params on line 191: parameter 1 = 4
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 191: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 191: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 191: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 191: RESULT: d offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 191: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 191: RESULT: d          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 191: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGdeallocate on line 196: name st_id3
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>  
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGprepare on line 225: name st_id4; query: "SELECT * FROM t1 WHERE id = $1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 228: 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 228: using PQexecPrepared for "SELECT * FROM t1 WHERE id = $1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: free_params on line 228: parameter 1 = 4
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 228: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_sqlda_total_size type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 228: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type int offset 672
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 0 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 228: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 676
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 1 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 228: RESULT: d offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset1 680
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type numeric offset2 720
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 2 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type double offset 728
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 3 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 228: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult type char offset 736
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_set_sqlda_from_PGresult row 0 col 4 IS NOT NULL
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 228: RESULT: d          offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 228: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGtrans on line 233: action "commit"; connection "con2"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGdeallocate on line 236: 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 248: query: drop table t1; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 248: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 248: OK: DROP TABLE
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGtrans on line 251: 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 -dcrpN pgsql.orig/src/interfaces/ecpg/test/expected/sql-sqlda.stdout pgsql.2/src/interfaces/ecpg/test/expected/sql-sqlda.stdout
*** pgsql.orig/src/interfaces/ecpg/test/expected/sql-sqlda.stdout	1970-01-01 01:00:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/test/expected/sql-sqlda.stdout	2009-12-16 14:03:43.000000000 +0100
***************
*** 0 ****
--- 1,60 ----
+ 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         '
+ 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 3
+ name sqlda descriptor: 't' value '"c"'
+ name sqlda descriptor: 'd1' value NUMERIC '-3'
+ name sqlda descriptor: 'd2' value nan
+ name sqlda descriptor: 'c' value 'c         '
+ FETCH RECORD 4
+ name sqlda descriptor: 'id' value 4
+ name sqlda descriptor: 't' value 'd'
+ name sqlda descriptor: 'd1' value NUMERIC '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 NUMERIC '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 3
+ name sqlda descriptor: 't' value '"c"'
+ name sqlda descriptor: 'd1' value NUMERIC '-3'
+ name sqlda descriptor: 'd2' value nan
+ name sqlda descriptor: 'c' value 'c         '
+ FETCH RECORD 4
+ name sqlda descriptor: 'id' value 4
+ name sqlda descriptor: 't' value 'd'
+ name sqlda descriptor: 'd1' value NUMERIC '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 NUMERIC '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 NUMERIC '4.0'
+ name sqlda descriptor: 'd2' value 4.000000
+ name sqlda descriptor: 'c' value 'd         '
diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/sql/desc.pgc pgsql.2/src/interfaces/ecpg/test/sql/desc.pgc
*** pgsql.orig/src/interfaces/ecpg/test/sql/desc.pgc	2007-08-14 12:01:54.000000000 +0200
--- pgsql.2/src/interfaces/ecpg/test/sql/desc.pgc	2009-12-16 14:03:43.000000000 +0100
*************** main(void)
*** 32,61 ****
  	EXEC SQL PREPARE foo2 FROM :stmt2;
  	EXEC SQL PREPARE foo3 FROM :stmt3;
  
! 	EXEC SQL EXECUTE foo1 USING DESCRIPTOR indesc;
  
  	EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 2;
  	EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2null, DATA = :val2;
  
! 	EXEC SQL EXECUTE foo1 USING DESCRIPTOR indesc;
  
  	EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 3;
  	EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val1, DATA = 'this is a long test';
  
! 	EXEC SQL EXECUTE "Foo-1" USING DESCRIPTOR indesc;
  
  	EXEC SQL DEALLOCATE "Foo-1";
  
  	EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = :val1;
  	EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2i, DATA = :val2;
  
! 	EXEC SQL EXECUTE foo2 USING DESCRIPTOR indesc INTO DESCRIPTOR outdesc;
  
  	EXEC SQL GET DESCRIPTOR outdesc VALUE 1 :val2output = DATA;
  	printf("output = %s\n", val2output);
  
  	EXEC SQL DECLARE c1 CURSOR FOR foo2;
! 	EXEC SQL OPEN c1 USING DESCRIPTOR indesc;
  
  	EXEC SQL FETCH next FROM c1 INTO :val1output:ind1, :val2output:ind2;
  	printf("val1=%d (ind1: %d) val2=%s (ind2: %d)\n",
--- 32,61 ----
  	EXEC SQL PREPARE foo2 FROM :stmt2;
  	EXEC SQL PREPARE foo3 FROM :stmt3;
  
! 	EXEC SQL EXECUTE foo1 USING SQL DESCRIPTOR indesc;
  
  	EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 2;
  	EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2null, DATA = :val2;
  
! 	EXEC SQL EXECUTE foo1 USING SQL DESCRIPTOR indesc;
  
  	EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 3;
  	EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val1, DATA = 'this is a long test';
  
! 	EXEC SQL EXECUTE "Foo-1" USING SQL DESCRIPTOR indesc;
  
  	EXEC SQL DEALLOCATE "Foo-1";
  
  	EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = :val1;
  	EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2i, DATA = :val2;
  
! 	EXEC SQL EXECUTE foo2 USING SQL DESCRIPTOR indesc INTO SQL DESCRIPTOR outdesc;
  
  	EXEC SQL GET DESCRIPTOR outdesc VALUE 1 :val2output = DATA;
  	printf("output = %s\n", val2output);
  
  	EXEC SQL DECLARE c1 CURSOR FOR foo2;
! 	EXEC SQL OPEN c1 USING SQL DESCRIPTOR indesc;
  
  	EXEC SQL FETCH next FROM c1 INTO :val1output:ind1, :val2output:ind2;
  	printf("val1=%d (ind1: %d) val2=%s (ind2: %d)\n",
*************** main(void)
*** 67,73 ****
  	EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 2;
  
  	EXEC SQL DECLARE c2 CURSOR FOR foo3;
! 	EXEC SQL OPEN c2 USING DESCRIPTOR indesc;
  
  	EXEC SQL FETCH next FROM c2 INTO :val1output, :val2output :val2i;
  	printf("val1=%d val2=%s\n", val1output, val2i ? "null" : val2output);
--- 67,73 ----
  	EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 2;
  
  	EXEC SQL DECLARE c2 CURSOR FOR foo3;
! 	EXEC SQL OPEN c2 USING SQL DESCRIPTOR indesc;
  
  	EXEC SQL FETCH next FROM c2 INTO :val1output, :val2output :val2i;
  	printf("val1=%d val2=%s\n", val1output, val2i ? "null" : val2output);
diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/sql/dynalloc2.pgc pgsql.2/src/interfaces/ecpg/test/sql/dynalloc2.pgc
*** pgsql.orig/src/interfaces/ecpg/test/sql/dynalloc2.pgc	2006-08-19 15:42:40.000000000 +0200
--- pgsql.2/src/interfaces/ecpg/test/sql/dynalloc2.pgc	2009-12-16 14:03:43.000000000 +0100
*************** int main(void)
*** 30,36 ****
     exec sql insert into test values (NULL, NULL);
  
     exec sql allocate descriptor mydesc;
!    exec sql select * into descriptor mydesc from test;
     exec sql get descriptor mydesc :colnum=COUNT;
     exec sql get descriptor mydesc value 1 :ip1=DATA, :ipointer1=INDICATOR;
     exec sql get descriptor mydesc value 2 :cp2=DATA, :ipointer2=INDICATOR;
--- 30,36 ----
     exec sql insert into test values (NULL, NULL);
  
     exec sql allocate descriptor mydesc;
!    exec sql select * into sql descriptor mydesc from test;
     exec sql get descriptor mydesc :colnum=COUNT;
     exec sql get descriptor mydesc value 1 :ip1=DATA, :ipointer1=INDICATOR;
     exec sql get descriptor mydesc value 2 :cp2=DATA, :ipointer2=INDICATOR;
diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/sql/dynalloc.pgc pgsql.2/src/interfaces/ecpg/test/sql/dynalloc.pgc
*** pgsql.orig/src/interfaces/ecpg/test/sql/dynalloc.pgc	2006-08-19 15:42:40.000000000 +0200
--- pgsql.2/src/interfaces/ecpg/test/sql/dynalloc.pgc	2009-12-16 14:03:43.000000000 +0100
*************** int main(void)
*** 39,45 ****
     exec sql 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);
  
     exec sql allocate descriptor mydesc;
!    exec sql select a,b,c,d,e,f,g,h,i into descriptor mydesc from test order by a;
     exec sql get descriptor mydesc value 1 :d1=DATA, :i1=INDICATOR;
     exec sql get descriptor mydesc value 2 :d2=DATA, :i2=INDICATOR;
     exec sql get descriptor mydesc value 3 :d3=DATA, :i3=INDICATOR;
--- 39,45 ----
     exec sql 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);
  
     exec sql allocate descriptor mydesc;
!    exec sql select a,b,c,d,e,f,g,h,i into sql descriptor mydesc from test order by a;
     exec sql get descriptor mydesc value 1 :d1=DATA, :i1=INDICATOR;
     exec sql get descriptor mydesc value 2 :d2=DATA, :i2=INDICATOR;
     exec sql get descriptor mydesc value 3 :d3=DATA, :i3=INDICATOR;
diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/sql/Makefile pgsql.2/src/interfaces/ecpg/test/sql/Makefile
*** pgsql.orig/src/interfaces/ecpg/test/sql/Makefile	2007-08-14 12:01:54.000000000 +0200
--- pgsql.2/src/interfaces/ecpg/test/sql/Makefile	2009-12-16 14:03:43.000000000 +0100
*************** TESTS = array array.c \
*** 20,25 ****
--- 20,26 ----
          parser parser.c \
          quote quote.c \
          show show.c \
+         sqlda sqlda.c \
          insupd insupd.c 
  
  all: $(TESTS)
diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/sql/sqlda.pgc pgsql.2/src/interfaces/ecpg/test/sql/sqlda.pgc
*** pgsql.orig/src/interfaces/ecpg/test/sql/sqlda.pgc	1970-01-01 01:00:00.000000000 +0100
--- pgsql.2/src/interfaces/ecpg/test/sql/sqlda.pgc	2009-12-16 14:03:43.000000000 +0100
***************
*** 0 ****
--- 1,257 ----
+ #include <stdlib.h>
+ #include <string.h>
+ #include <inttypes.h>
+ #include <limits.h>
+ 
+ exec sql include ../regression;
+ 
+ exec sql include sqlda.h;
+ exec sql include pgtypes_numeric.h;
+ 
+ exec sql whenever sqlerror stop;
+ 
+ /* These shouldn't be under DECLARE SECTION */
+ pg_sqlda_t	*inp_sqlda, *outp_sqlda, *outp_sqlda1;
+ 
+ static void
+ dump_sqlda(pg_sqlda_t *sqlda)
+ {
+ 	int	i;
+ 
+ 	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 ECPGt_char:
+ 			printf("name sqlda descriptor: '%s' value '%s'\n", sqlda->sqlvar[i].sqlname, sqlda->sqlvar[i].sqldata);
+ 			break;
+ 		case ECPGt_int:
+ 			printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname, *(int *)sqlda->sqlvar[i].sqldata);
+ 			break;
+ #if (LONG_BIT == 64) /* Defined via <limits.h> */
+ 		case ECPGt_long:
+ #else
+ # if (LONG_BIT = 32)
+ 		case ECPGt_long_long:
+ # else
+ #  error Neither "long" nor "long long" are 64-bit
+ # endif
+ #endif
+ 			printf("name sqlda descriptor: '%s' value %" PRId64 "\n", sqlda->sqlvar[i].sqlname, *(int64_t *)sqlda->sqlvar[i].sqldata);
+ 			break;
+ 		case ECPGt_double:
+ 			printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname, *(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, val);
+ 				free(val);
+ 				break;
+ 			}
+ 		}
+ 	}
+ }
+ 
+ int
+ main (void)
+ {
+ exec sql begin declare section;
+ 	char	*stmt1 = "SELECT * FROM t1";
+ 	char	*stmt2 = "SELECT * FROM t1 WHERE id = ?";
+ 	int	rec;
+ 	int	id;
+ exec sql end declare section;
+ 
+ 	char msg[128];
+ 
+ 	ECPGdebug(1, stderr);
+ 
+ 	strcpy(msg, "connect");
+ 	exec sql connect to REGRESSDB1 as regress1;
+ 
+ 	strcpy(msg, "set");
+ 	exec sql set datestyle to iso;
+ 
+ 	strcpy(msg, "create");
+ 	exec sql create table t1(
+ 		id integer,
+ 		t text,
+ 		d1 numeric,
+ 		d2 float8,
+ 		c char(10));
+ 
+ 	strcpy(msg, "insert");
+ 	exec sql insert into t1 values
+ 		(1, 'a', 1.0, 1, 'a'),
+ 		(2, null, null, null, null),
+ 		(3, '"c"', -3, 'nan'::float8, 'c'),
+ 		(4, 'd', 4.0, 4, 'd');
+ 
+ 	strcpy(msg, "commit");
+ 	exec sql commit;
+ 
+ 	/* SQLDA test for getting all records from a table */
+ 
+ 	outp_sqlda = NULL;
+ 
+ 	strcpy(msg, "prepare");
+ 	exec sql prepare st_id1 from :stmt1;
+ 
+ 	strcpy(msg, "declare");
+ 	exec sql declare mycur1 cursor for st_id1;
+ 
+ 	strcpy(msg, "open");
+ 	exec sql open mycur1;
+ 
+ 	exec sql whenever not found do break;
+ 
+ 	rec = 0;
+ 	while (1)
+ 	{
+ 		strcpy(msg, "fetch");
+ 		exec sql fetch 1 from mycur1 into descriptor outp_sqlda; 
+ 
+ 		printf("FETCH RECORD %d\n", ++rec);
+ 		dump_sqlda(outp_sqlda);
+ 	}
+ 
+ 	exec sql whenever not found continue;
+ 
+ 	strcpy(msg, "close");
+ 	exec sql close mycur1;
+ 
+ 	strcpy(msg, "deallocate");
+ 	exec sql deallocate prepare st_id1;
+ 
+ 	free(outp_sqlda);
+ 
+ 	/* SQLDA test for getting ALL records into the sqlda list */
+ 
+ 	outp_sqlda = NULL;
+ 
+ 	strcpy(msg, "prepare");
+ 	exec sql prepare st_id2 from :stmt1;
+ 
+ 	strcpy(msg, "declare");
+ 	exec sql declare mycur2 cursor for st_id2;
+ 
+ 	strcpy(msg, "open");
+ 	exec sql open mycur2;
+ 
+ 	strcpy(msg, "fetch");
+ 	exec sql fetch all from mycur2 into descriptor outp_sqlda;
+ 
+ 	outp_sqlda1 = outp_sqlda;
+ 	rec = 0;
+ 	while (outp_sqlda1)
+ 	{
+ 		pg_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");
+ 	exec sql close mycur2;
+ 
+ 	strcpy(msg, "deallocate");
+ 	exec sql deallocate prepare st_id2;
+ 
+ 	/* SQLDA test for getting one record using an input descriptor */
+ 
+ 	/* Input sqlda has to be built manually */
+ 	inp_sqlda = (pg_sqlda_t *)malloc(sizeof(pg_sqlda_t));
+ 	memset(inp_sqlda, 0, sizeof(pg_sqlda_t));
+ 	inp_sqlda->sqld = 1;
+ 	inp_sqlda->sqlvar = malloc(sizeof(pg_sqlvar_t));
+ 	memset(inp_sqlda->sqlvar, 0, sizeof(pg_sqlvar_t));
+ 
+ 	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");
+ 	exec sql prepare st_id3 FROM :stmt2;
+ 
+ 	strcpy(msg, "execute");
+ 	exec sql execute st_id3 using descriptor inp_sqlda into descriptor outp_sqlda;
+ 
+ 	dump_sqlda(outp_sqlda);
+ 
+ 	strcpy(msg, "deallocate");
+ 	exec sql deallocate prepare st_id3;
+ 
+ 	free(inp_sqlda->sqlvar);
+ 	free(inp_sqlda);
+ 	free(outp_sqlda);
+ 
+ 	/* SQLDA test for getting one record using an input descriptor
+ 	 * on a named connection
+ 	 */
+ 
+ 	exec sql connect to REGRESSDB1 as con2;
+ 
+ 	/* Input sqlda has to be built manually */
+ 	inp_sqlda = (pg_sqlda_t *)malloc(sizeof(pg_sqlda_t));
+ 	memset(inp_sqlda, 0, sizeof(pg_sqlda_t));
+ 	inp_sqlda->sqld = 1;
+ 	inp_sqlda->sqlvar = malloc(sizeof(pg_sqlvar_t));
+ 	memset(inp_sqlda->sqlvar, 0, sizeof(pg_sqlvar_t));
+ 
+ 	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");
+ 	exec sql at con2 prepare st_id4 FROM :stmt2;
+ 
+ 	strcpy(msg, "execute");
+ 	exec sql at con2 execute st_id4 using descriptor inp_sqlda into descriptor outp_sqlda;
+ 
+ 	dump_sqlda(outp_sqlda);
+ 
+ 	strcpy(msg, "commit");
+ 	exec sql at con2 commit;
+ 
+ 	strcpy(msg, "deallocate");
+ 	exec sql deallocate prepare st_id4;
+ 
+ 	free(inp_sqlda->sqlvar);
+ 	free(inp_sqlda);
+ 	free(outp_sqlda);
+ 
+ 	strcpy(msg, "disconnect");
+ 	exec sql disconnect con2;
+ 
+ 	/* End test */
+ 
+ 	strcpy(msg, "drop");
+ 	exec sql drop table t1;
+ 
+ 	strcpy(msg, "commit");
+ 	exec sql commit;
+ 
+ 	strcpy(msg, "disconnect");
+ 	exec sql disconnect;
+ 
+ 	return (0);
+ }