Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit abfa8ae

Browse files
author
Michael Meskes
committed
Fixed some Informix compat functions so they handle NULL resp. indicators better.
1 parent 4afcba0 commit abfa8ae

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,6 +1563,12 @@ Tue Jul 8 12:34:00 CEST 2003
15631563

15641564
- Made Informix decimal-ascii conversion honor Informix NULLs.
15651565
- Informix variable handling didn't cope well with arrays.
1566+
1567+
Wed Jul 9 11:45:02 CEST 2003
1568+
1569+
- Made all Informix functions honor Informix NULLs.
1570+
- Extended compatibility functions for INFORMIX handling of DECLARE
1571+
statement to work with indicators.
15661572
- Set ecpg version to 3.0.0
15671573
- Set ecpg library to 4.0.0
15681574
- Set pgtypes library to 1.0.0

src/interfaces/ecpg/compatlib/informix.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ deccall3(Decimal *arg1, Decimal *arg2, Decimal *result, int (*ptr)(Numeric *, Nu
5555
Numeric *a1, *a2, *nres;
5656
int i;
5757

58+
if (risnull(CDECIMALTYPE, (char *)arg1) || risnull(CDECIMALTYPE, (char *)arg2))
59+
{
60+
rsetnull(CDECIMALTYPE, (char *)result);
61+
return 0;
62+
}
63+
5864
if ((a1 = PGTYPESnumeric_new()) == NULL)
5965
return -1211;
6066

@@ -191,6 +197,12 @@ deccvdbl(double dbl, Decimal *np)
191197
Numeric *nres = PGTYPESnumeric_new();
192198
int result = 1;
193199

200+
if (risnull(CDOUBLETYPE, (char *)&dbl))
201+
{
202+
rsetnull(CDECIMALTYPE, (char *)np);
203+
return 0;
204+
}
205+
194206
if (nres == NULL)
195207
return -1211;
196208

@@ -208,6 +220,12 @@ deccvint(int in, Decimal *np)
208220
Numeric *nres = PGTYPESnumeric_new();
209221
int result = 1;
210222

223+
if (risnull(CINTTYPE, (char *)&in))
224+
{
225+
rsetnull(CDECIMALTYPE, (char *)np);
226+
return 0;
227+
}
228+
211229
if (nres == NULL)
212230
return -1211;
213231

@@ -225,6 +243,12 @@ deccvlong(long lng, Decimal *np)
225243
Numeric *nres = PGTYPESnumeric_new();
226244
int result = 1;
227245

246+
if (risnull(CLONGTYPE, (char *)&lng))
247+
{
248+
rsetnull(CDECIMALTYPE, (char *)np);
249+
return 0;
250+
}
251+
228252
if (nres == NULL)
229253
return -1211;
230254

0 commit comments

Comments
 (0)