Robin Becker wrote:
> Just came across a weird problem with dbi.dbDate; it seems it is based on the
> 32bit time since 1970 used by python's time module. Unfortunately I have
> financial data for a bunch of people with DOB <1940.
>
>
> Nothing seems to blow up when I execute sql fetches, but the returned objects
> behave very strangely.
>
> eg
> >>> type(objs[5].DateOfBirth)
> <type 'DbiDate'>
> >>> str(objs[5].DateOfBirth)
> '<interactive input>\x00\x00\x00\x00\x00'
>
> ie it seems to be producing garbage from somewhere in memory.
>
> I'm not sure that I care to use a date system which is so limited, but surely
> it
> should be able to detect that the date is out of range and raise some kind of
> ValueError or something.
>
> I guess an alternative would be to abandon compatibility with python's time
> module and switch to datetime for the dbDate construction.
> --
I think the datetime module was added in Python 2.3. Not sure how
long Mark intends to keep building for 2.2.
>From a quick look at the source, it would be relatively simple to convert
to PyTime instead of DbiDate. This wouldn't be backward compatible
either, though.
As a workaround, you could format the dates as strings in your SQL.
Alternately, you might want to try using ADO instead of ODBC.
Roger
_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32