infomix9.21 handles spaces as nulls ?
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hi, We are trying to port our code from informix7.3.0 to informix9.21 on solaris2.6. The code compiled fine after we linked -ldl at the end of the link line. But when I run it, I get errors. I found from our logfiles that the old executable (built with 7.3.0) receives the columns that have a single space for their value(we fill certain non-null defined fields with a single space to initialize them) correctly as a space. But the executable built with 9.21 is showing as null. The esql is 0.30.UC. THe engine is 9.21.UC1. Anybody knows what is the story and how to deal with it ? Thanks much. -AH Sent via Deja.com http://www.deja.com/ Before you buy.
hash100@my-deja.com writes:
> We are trying to port our code from informix7.3.0 to informix9.21 on
> solaris2.6. The code compiled fine after we linked -ldl at the end of
> the link line. But when I run it, I get errors. I found from our
> logfiles that the old executable (built with 7.3.0) receives the
> columns that have a single space for their value(we fill certain
> non-null defined fields with a single space to initialize them)
> correctly as a space. But the executable built with 9.21 is showing as
> null.
> The esql is 0.30.UC.
> THe engine is 9.21.UC1.
>
> Anybody knows what is the story and how to deal with it ?
> Thanks much.
Hmmm... Informix trims trailing spaces, so a single space is really a
zero-length string. However, a zero-length string should not be
confused with NULL (NULL should be an out-of-band value).
I did this with 7.30-UC7 on Linux:
$ dbaccess - -
> create database rjc;
Database created.
> create table t(c char(10));
Table created.
> insert into t values (" ");
1 row(s) inserted.
> insert into t values (null);
1 row(s) inserted.
> select count(*) from t where c is null;
(count(*))
1
1 row(s) retrieved.
> select count(*) from t where c = "";
(count(*))
1
1 row(s) retrieved.
>
So, everything looks ok for 7.30-UC7. AFAIK, there is no 9.21 for
Linux, yet; so I can't see if that release differs. Could you post
your results?
--
Forte International, P.O. Box 1412, Ridgecrest, CA 93556-1412
Ronald Cole <ronald@forte-intl.com> Phone: (760) 499-9142
President, CEO Fax: (760) 499-9152
My GPG fingerprint: C3AF 4BE9 BEA6 F1C2 B084 4A88 8851 E6C8 69E3 B00B