1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

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.
This commit is contained in:
Michael Meskes
2003-07-01 12:40:52 +00:00
parent f973b74583
commit 2bdd2e5dcf
18 changed files with 380 additions and 175 deletions

View File

@ -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)))