On Tue, 25 Nov 1997, Guy Smithson wrote:
> Does anyone know how NULL/Blank Informix dates are stored.
Yes, I do.
> I have a sample data file and the 4 byte integer containing a NULL
> Informix-Date has it's highest bit set to one (0x80000000).
And so do you.
> Is this always the case,
Yes.
> or do other storage formats for NULL/Blank Informix-Dates exist also
> (like 0x00000000) ?
0x00000000 is a perfectly good non-null date; 31st December 1899 to be precise.
Dates are stored as the number of days since 31st December 1899, so day 1
is 1st January 1900 (which was not a leap year!). Null dates are stored as
if they were null integers, which means as 0x80000000. On machines which
use 32-bit twos-complement arithmetic, this number can be negated, but
produces the same value. You might have noticed that the range of SMALLINT
values is documented as -32767..+32767; the missing value (-32768 or
0x8000) is deliberately omitted because it is used to represent NULL.
Similarly for INTEGER and SERIAL and DATE...
Yours,
Jonathan Leffler (johnl@informix.com) #include <witticism.h>