[Zope] Re: [Zope-DB] DCO2 and nulls again

Garry Steedman gs@styrax.com
Tue, 18 Dec 2001 17:45:06 +0000


Fredrik,

i think this is why we are using the to_char() function to convert 
oracle dates to python strings on some date fields, though obviously 
this doesn't solve everyone's problems...

cheers,

g

On 18 Dec 2001, at 17:34, Fredrik Svensson wrote:

From:           	"Fredrik Svensson" <fredrik@ita.chalmers.se>
To:             	<zope-db@zope.org>
Subject:        	[Zope-DB] DCO2 and nulls again
Date sent:      	Tue, 18 Dec 2001 17:34:34 +0100

> Hi,
> 
> 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 8.1.7.1
> 
> However... Here is an example:
> my_table(
>  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: ID      MIN_AMOUNT    
> MAX_AMOUNT 2 4 6 22
> 
> 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: ID     MIN_AMOUNT     MAX_AMOUNT 2 4 6      
> 1077041684    1077041684 22     1077041684    1077041684
> 
> 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??
> 
> /Fredrik
> 
> 
> _______________________________________________
> Zope-DB mailing list
> Zope-DB@zope.org
> http://lists.zope.org/mailman/listinfo/zope-db


+-------------------------------------------+
  Garry Steedman      mailto:gs@styrax.com  
  Styrax Associates  http://www.styrax.com/ 

  "The Good Man has no shape."            
+-------------------------------------------+