[Zope-DB] Re: Re: Test for equality to Missing.Value (empty field)?

M.-A. Lemburg mal@lemburg.com
Wed, 27 Nov 2002 22:12:31 +0100


Jeff Kowalczyk wrote:
> I agree that mapping SQL Null to None is much more useful than Missing.Value. My only
> experience has been with ZODBCDA and the Zope mxODBC DA, both of which map Null to
> Missing.Value. For things like tal:condition, 'None' is far more friendly to TTW tales and
> TTW script usage, as Deiter points out. And from my point of view, Null isn't semantically
> 'Missing', it is an intentionally blank value, equivalent to None. I think of Missing
> along the lines of a dictionary key error.
> 
> I expect to transition from Windows databases to ZpsycopgDA and ZMySQLDA over time and if
> they all use the Null-None mapping, I'd greatly prefer to see it that way in Zope mxODBC
> DA. Unless there's a good reason, I would consider that the more correct behavior.

mxODBCZopeDA will use the None mapping too in the final
release.

Some other things which I found while writing the DA:

* floats returned from the database are automagically converted
   to integers in the ZODBCDA if the scale is 0 -- I wonder whether
   that's a good idea, because integers can overflow (the mxODBC
   Zope DA uses longs for these cases).

* there's no query interface which allows usage of bound
   parameters (as defined in the DB-API); the result is that
   data in query strings is restricted in size to what the database
   interfaces can handle, e.g. Oracle has a 4k byte for SQL
   literals. I would welcome a standard interface of the form
   .execute(sql, paramtuple, maxrows=None)

* there's no support for providing an offset into the result set;
   this makes browsing large query sets very slow and memory
   intense

* the de-facto "standards" for .tables() and .columns() have
   inconsistent interfaces

Are there any activities to solve these problems ? Something
like a DB-API for Zope internal use ?

> "Dieter Maurer" <dieter@handshake.de> wrote in message
> news:15845.3500.897813.894036@gargle.gargle.HOWL...
> 
>>M.-A. Lemburg writes:
>> > ...
>> > Note that the mxODBC Zope DA also maps None returns (which represent
>> > NULLs in SQL) to Zope's Missing.MV. The Zope DA has to do this to
>> > stay compatible to the other DAs.
>>Are you sure?
>>
>>Where did you find that documented?
>>
>>The DA's I used ("ZpsycopgDA", ZMySQLDA, ZOracleDA")
>>map SQL Null to "None" and this is good,
>>as "Missing.MV" is unavailable in TTW code.
>>This makes it quite not very adequate for the job.
>>
>>
>>Dieter
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Zope-DB mailing list
> Zope-DB@zope.org
> http://lists.zope.org/mailman/listinfo/zope-db

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/