[Zope-DB] DCOracle2.1.1 problems

DA Loeffler David.Loeffler@bristol.ac.uk
Mon, 15 Jul 2002 15:29:49 +0100 (BST)


> >---
> >(3)
> >A select query of an empty string field in the Oracle Database
> >returns the string text "None" (!!!) instead of a None object or an empty string!!!
> >
> >Could you please tell me, if I have made something wrong or if this is a bug
> >(known or unknown or probably yet solved)?
> >
> 
> I'm not aware of anything like that -- it sounds like something is doing 
> a str() on a value of None.  I'd double-check the invoking code to see 
> if it's turning results into strings before printing -- nothing in the 
> DCOracle2 code does that.
> 

Of course, when you _print_ a None, it prints the string 'None', which
is what appears in your web page.

To some extent, isn't this a problem with Python, not with DCOracle2 at
all? Inasmuch as str(None) makes sense at all, shouldn't it be an empty
string?

However, one other thing I noticed when I upgraded from DCO1 to DCO2 was
that for an integer number field, it will return the value in floating
point form, returning 1 as 1.0; then if you call int() on it, it will
die on NULL values, as Python quite understandably doesn't like
int(None). So one has to write a tedious conversion routine whenever one
wishes to use numbers from a query! I would be keen to see this returned
to its DCO1 state, where if a number field has its scale
parameter 0, its value is returned as a Python integer, not a float.


David