1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Fixed some Informix compat functions so they handle NULL resp. indicators better.

This commit is contained in:
Michael Meskes
2003-07-09 13:49:38 +00:00
parent 4afcba05de
commit abfa8ae54f
2 changed files with 30 additions and 0 deletions

View File

@ -55,6 +55,12 @@ deccall3(Decimal *arg1, Decimal *arg2, Decimal *result, int (*ptr)(Numeric *, Nu
Numeric *a1, *a2, *nres;
int i;
if (risnull(CDECIMALTYPE, (char *)arg1) || risnull(CDECIMALTYPE, (char *)arg2))
{
rsetnull(CDECIMALTYPE, (char *)result);
return 0;
}
if ((a1 = PGTYPESnumeric_new()) == NULL)
return -1211;
@ -191,6 +197,12 @@ deccvdbl(double dbl, Decimal *np)
Numeric *nres = PGTYPESnumeric_new();
int result = 1;
if (risnull(CDOUBLETYPE, (char *)&dbl))
{
rsetnull(CDECIMALTYPE, (char *)np);
return 0;
}
if (nres == NULL)
return -1211;
@ -208,6 +220,12 @@ deccvint(int in, Decimal *np)
Numeric *nres = PGTYPESnumeric_new();
int result = 1;
if (risnull(CINTTYPE, (char *)&in))
{
rsetnull(CDECIMALTYPE, (char *)np);
return 0;
}
if (nres == NULL)
return -1211;
@ -225,6 +243,12 @@ deccvlong(long lng, Decimal *np)
Numeric *nres = PGTYPESnumeric_new();
int result = 1;
if (risnull(CLONGTYPE, (char *)&lng))
{
rsetnull(CDECIMALTYPE, (char *)np);
return 0;
}
if (nres == NULL)
return -1211;