diff options
author | Michael Meskes <meskes@postgresql.org> | 2003-07-01 12:40:52 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2003-07-01 12:40:52 +0000 |
commit | 2bdd2e5dcff20e4cf5987c901a71b794808d582b (patch) | |
tree | e158aaeb7ac2ab4db9e2e738e6be2aefa9cf4a50 /src/interfaces/ecpg/ecpglib/execute.c | |
parent | f973b74583c24e28ff8977d0fdd455474705604a (diff) | |
download | postgresql-2bdd2e5dcff20e4cf5987c901a71b794808d582b.tar.gz postgresql-2bdd2e5dcff20e4cf5987c901a71b794808d582b.zip |
Use ISO dates in pgtypeslib by default.
Applied patch by Philip Yarra to fix some thread issues.
Added a new data type "decimal" which is mostly the same as our
"numeric" but uses a fixed length array to store the digits. This is
for compatibility with Informix and maybe others.
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/execute.c')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/execute.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index ad5ab5d1f02..bc945a442c1 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -1,4 +1,4 @@ -/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.13 2003/06/26 11:37:05 meskes Exp $ */ +/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.14 2003/07/01 12:40:51 meskes Exp $ */ /* * The aim is to get a simpler inteface to the database routines. @@ -820,16 +820,24 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var, } break; + case ECPGt_decimal: case ECPGt_numeric: { char *str = NULL; int slen; + Numeric *nval = PGTYPESnumeric_new(); if (var->arrsize > 1) { for (element = 0; element < var->arrsize; element++) { - str = PGTYPESnumeric_to_asc((Numeric *)((var + var->offset * element)->value), 0); + if (var->type == ECPGt_numeric) + PGTYPESnumeric_copy((Numeric *)((var + var->offset * element)->value), nval); + else + PGTYPESnumeric_from_decimal((Decimal *)((var + var->offset * element)->value), nval); + + str = PGTYPESnumeric_to_asc(nval, 0); + PGTYPESnumeric_free(nval); slen = strlen (str); if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + 5, stmt->lineno))) @@ -845,7 +853,14 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var, } else { - str = PGTYPESnumeric_to_asc((Numeric *)(var->value), 0); + if (var->type == ECPGt_numeric) + PGTYPESnumeric_copy((Numeric *)(var->value), nval); + else + PGTYPESnumeric_from_decimal((Decimal *)(var->value), nval); + + str = PGTYPESnumeric_to_asc(nval, 0); + + PGTYPESnumeric_free(nval); slen = strlen (str); if (!(mallocedval = ECPGalloc(slen + 1, stmt->lineno))) |