[Zope-DB] DCO2 and nulls again

Matthew T. Kromer matt@zope.com
Tue, 18 Dec 2001 11:51:45 -0500

Fredrik Svensson wrote:

>I want to do a follow-up on Darios earlier mail with some examples of our
>random null behaviour.
>We are experiencing problems with null values from several different
>datatypes. Not just dates. Dates however is the most problematic since DCO2
>tries to convert the date value to a Zope DateObject. When a DateObject is
>created with random data it fails with an error that we cannot handle.
>The version of DCO2 we are using was checked out of CVS on december the 4:th
>and compiled on a RedHat 7.2 with Oracle client
>However... Here is an example:
> id number(9) not null,
> min_amount number(9),
> max_amount number(9)
>I do a SELECT * FROM my_table WHERE min_amount IS NULL from toad or sqlplus
>or something and get the following:
>ok... now I do a SELECT * FROM my_table in an ZSQL method from within zope
>using DCO2. Looking at the result from testing that ZSQL method, this is
>what I see:
>6       1077041684    1077041684
>22     1077041684    1077041684

Well, 1077041684 is 0x40325a14, which would be a valid memory pointer 
under Linux...

Is this a reproducable test case for you?  If so, I can describe how to 
go look at the various indicators to see if the indicator was sent in as 
NULL -- the normal way to show this though, is to enable DCO2 tracing by 
setting DCO2TRACEFLAGS=255 as an environment variable and then saving 
the result of DCOracle2.traceback(format=1) which will pull the trace 
table out of the dco2 module.  I can look at the traceback and see if 
the indicator was set on the object, indicating a NULL column.

>Another example was a complex sql query using several subselects. In that
>case the null values where more random. We fixed that problem by using
>NVL(subquery, 0) but that doesn't work with dates.
>Anyone else who recognizes this behaviour??
>Zope-DB mailing list