diff options
author | Michael Meskes <meskes@postgresql.org> | 2000-05-17 06:03:14 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2000-05-17 06:03:14 +0000 |
commit | e39a1186941200fdab0187e6022d714f41fc1945 (patch) | |
tree | 6b40bf6b22a0b9bd8275c87622cf5bab134fa8fe /src/interfaces/ecpg/lib/data.c | |
parent | 76da5b80b1424cbf467ec8871a264db3885efd53 (diff) | |
download | postgresql-e39a1186941200fdab0187e6022d714f41fc1945.tar.gz postgresql-e39a1186941200fdab0187e6022d714f41fc1945.zip |
*** empty log message ***
Diffstat (limited to 'src/interfaces/ecpg/lib/data.c')
-rw-r--r-- | src/interfaces/ecpg/lib/data.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/interfaces/ecpg/lib/data.c b/src/interfaces/ecpg/lib/data.c index 29675a89728..18ac49805bd 100644 --- a/src/interfaces/ecpg/lib/data.c +++ b/src/interfaces/ecpg/lib/data.c @@ -1,4 +1,5 @@ #include <stdlib.h> +#include <string.h> #include <ecpgtype.h> #include <ecpglib.h> @@ -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 */ { |