diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index 29a59fa320..6f292eeb4c 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -919,4 +919,9 @@ Mon May 15 10:51:31 CEST 2000 - Added patch by SAKAIDA Masaaki to fix segfault. - Set ecpg version to 2.7.1. +Wed May 17 07:52:59 CEST 2000 + + - Added patch by SAKAIDA Masaaki to fix array + handling. + - Set library version to 3.1.1. diff --git a/src/interfaces/ecpg/lib/Makefile.in b/src/interfaces/ecpg/lib/Makefile.in index 20f5c314dd..d48c75ea23 100644 --- a/src/interfaces/ecpg/lib/Makefile.in +++ b/src/interfaces/ecpg/lib/Makefile.in @@ -6,13 +6,13 @@ # Copyright (c) 1994, Regents of the University of California # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.65 2000/03/30 11:41:34 meskes Exp $ +# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.66 2000/05/17 06:03:13 meskes Exp $ # #------------------------------------------------------------------------- NAME= ecpg SO_MAJOR_VERSION= 3 -SO_MINOR_VERSION= 1.0 +SO_MINOR_VERSION= 1.1 SRCDIR= @top_srcdir@ include $(SRCDIR)/Makefile.global diff --git a/src/interfaces/ecpg/lib/data.c b/src/interfaces/ecpg/lib/data.c index 29675a8972..18ac49805b 100644 --- a/src/interfaces/ecpg/lib/data.c +++ b/src/interfaces/ecpg/lib/data.c @@ -1,4 +1,5 @@ #include +#include #include #include @@ -26,8 +27,18 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno, ECPGraise(lineno, ECPG_DATA_NOT_ARRAY, NULL); return (false); } - else - ++pval; + + switch (type) + { + case ECPGt_char: + case ECPGt_unsigned_char: + case ECPGt_varchar: + break; + + default: + pval++; + break; + } } /* We will have to decode the value */ @@ -144,7 +155,14 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno, case ECPGt_double: if (pval) { - dres = strtod(pval, &scan_length); + if (isarray && *pval == '"') + dres = strtod(pval + 1, &scan_length); + else + dres = strtod(pval, &scan_length); + + if (isarray && *scan_length == '"') + scan_length++; + if ((isarray && *scan_length != ',' && *scan_length != '}') || (!isarray && *scan_length != '\0')) /* Garbage left */ { diff --git a/src/interfaces/ecpg/test/Makefile b/src/interfaces/ecpg/test/Makefile index 72f38035d3..0b9135a5af 100644 --- a/src/interfaces/ecpg/test/Makefile +++ b/src/interfaces/ecpg/test/Makefile @@ -2,7 +2,8 @@ all: test1 test2 test3 test4 perftest dyntest dyntest2 LDFLAGS=-g -I /usr/local/pgsql/include -L/usr/local/pgsql/lib -lecpg -lpq -ECPG=../preproc/ecpg -I../include +ECPG=/usr/local/pgsql/bin/ecpg -I../include +#ECPG=../preproc/ecpg -I../include .SUFFIXES: .pgc .c @@ -18,4 +19,4 @@ dyntest2: dyntest2.c $(ECPG) $? clean: - rm -f test1 test2 test3 test4 perftest *.c *.o log dyntest dyntest2 + rm -f test1 test2 test3 test4 perftest *.c log dyntest dyntest2 diff --git a/src/interfaces/ecpg/test/test1.pgc b/src/interfaces/ecpg/test/test1.pgc index 67c1aa847f..f98719d56f 100644 --- a/src/interfaces/ecpg/test/test1.pgc +++ b/src/interfaces/ecpg/test/test1.pgc @@ -1,5 +1,3 @@ - - exec sql include sqlca; exec sql whenever sqlerror do PrintAndStop(msg); @@ -88,8 +86,9 @@ exec sql end declare section; strcpy(msg, "commit"); exec sql commit; - /* Stop automatic transactioning for connection pm. */ - exec sql at pm set autocommit to off; + /* Start automatic transactioning for connection pm. */ + exec sql at pm set autocommit to on; + exec sql at pm begin transaction; strcpy(msg, "select"); exec sql select name, amount, letter into :name, :amount, :letter from "Test"; @@ -117,14 +116,17 @@ exec sql end declare section; for (i=0, j=sqlca.sqlerrd[2]; i