RE: Checking NULL value...
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Server Administration, Data Types & Schema Design
Thanks, I figured it out - the server doesn't set the NULL indicator of the
sqlvar structure after the fetch unless you allocate a short and put it in
the structure.
Also, if anyone is interested, the risnull() does not work correctly on char
data types returned from the server using the sqlda structure. The value of
the char returned if the column is NULL is '\\0' which is the same as if the
value of the column was set to '\\0' - even though they are different on the
server.
Bryan Hughes
Shutterfly.com
-----Original Message-----
From: William Rice [mailto:ricew@operamail.com]
Sent: Sunday, May 07, 2000 7:58 AM
To: Pacbell News; informix-list
Subject: RE: Checking NULL value...
I always used an INDICATOR for the column to find if it was NULL.
Information on indicators should be in your esqlc manual
Will
>===== Original Message From "Pacbell News" <hughesb@pacbell.net> =====
>I am hoping someone can help me. My ESQL/C code is having difficulty
>distiquishing between a column with a NULL value and a column = '\\0' (or
"")
>using a sqlda structure after a FETCH ... USING DESCRIPTOR ...
>
>I have correctly DESCRIBED the statement into the sqlda structure and
>allocated the memory accordingly. I have the following table:
>
>CREATE TABLE test ( name char(16), value char(16) );>
>INSERT INTO test ( name, value ) values ( "test", "" );
>INSERT INTO test ( name ) values ( "test1" );>
>If I use dbaccess and do a SELECT * FROM test WHERE value IS NULL, the row
>with name = "test1" is returned.
>
>In my ESQL/C code, immediately before the fetch sqlvar[...].sqlind is NULL
>as well as immediately after for both rows. When I use the Informix library
>call risnull(), it returns TRUE for both records.
>
>Why is dbaccess able to determine that one row is NULL and the other is a
>single character string with a NULL value?
>
>Bryan Hughes
>Shutterfly.com
>
>--
>
>------------------------------------------------------------
>"A doctor can bury his mistakes but an architect can only
>advise his client to plant vines." -- Frank Lloyd Wright
------------------------------------------------------------
This e-mail has been sent to you courtesy of OperaMail, as a free
service from
Opera Software, makers of the award-winning Web Browser, Opera. Visit us
at
http://www.opera.com/ or our portal at: http://www.myopera.com/ Your free
e-mail
account is waiting at: http://www.operamail.com/
------------------------------------------------------------