diff options
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))) |