Feature Requests item #3005507, was opened at 2010-05-21 15:01
Message generated for change (Comment added) made by kf7xm
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551957&aid=3005507&group_id=78018
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Airdrik (airdrik)
Assigned to: Nobody/Anonymous (nobody)
Summary: adodbapi distinguishing of datetime and date
Initial Comment:
In MS SQL server, there are two date types: datetime and smalldatetime; datetime has a time component and smalldatetime does not. in adodbapi, they both come in as basically the same type and adodbapi converts them both to python's datetime.date if the time component is 0 or to datetime.datetime otherwise. This leads to possible type differences if a datetime column sometimes has a time component of midnight, and sometimes has other times (for some strange reason datetime.date and datetime.datetime are not comparable).
I would prefer that sql datetime get converted to python datetime.datetime (regardless of if the time component), and sql smalldatetime get converted to python datetime.date (with the exception that sql null get converted to None regardless).
Part of the problem of distinguishing these types is that the type_code of both datetime and smalldatetime is 135 (adDBTimeStamp), however they can be distinguished by the scale field of .description - the scale on datetime is 3, whereas the scale on smalldatetime is 0.
----------------------------------------------------------------------
>Comment By: Vernon Cole (kf7xm)
Date: 2010-07-24 14:15
Message:
This "feature" has bitten me, too. I like your proposed solution and will
investigate using it. -- Vernon
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551957&aid=3005507&group_id=78018
|