|
|
|
[
Permlink
| « Hide
]
Mike Doerfler - 04/May/04 01:32 PM
Peter, it looks like some of the mappings have a type="Time" type. Would it bother you if I changed them to a type="TimeSpan"?
I don't understand the problem, could you clear it a bit?
The problem is with the OleDb driver and the tests where a TimeType is involved.
I am not sure how other db's like Oracle will handle a parameter of DbType.Time. The SqlClient Data Provider converts that parameter type to a DateTime, the OleDb Data Provider treats it differently. Duplicate of
FooBarTest.PersistCollections there is code commented out dealing with a TimeArray. Need to figure out what the TimeType in nh should map to in .net. Right now it is mapping to a DateTime and only storing the Time as significant. I think this implementation maps to the java spec of java.sql.Time but am not sure about it. MySql has its own implementation of DbType.Time. MSDN docos say:
Time ----------------------- Date and time data ranging in value from January 1, 1753 to December 31, 9999 to an accuracy of 3.33 milliseconds. MySql converts DbType.Time to MySqlDbType.Time. The MySql docs say: Time ----------------------- Time The range is '-838:59:59' to '838:59:59'. To make this more consistent with the msdn docs I think this is how I'll implement it.
The property will be a TimeSpan. The database column will be a DbType.Time (according to msdn docs this should be a datetime column) The zero date is "1753-01-01". The value stored in the db will be "1753-01-01" + value of TimeSpan property. Isolate any Type="Time" mappings to NHSpecific namespace so FooBar tests stop failing for drivers that don't implement DbType.Time consistenty with msdn docs. I ended up going with the MSDN docs kind of. TimeType returns the hour, minute, second portion into a DateTime on Jan 1, 1753. It only compares hour, minute, second for dirty.
I'm still not that happy with implementation because the msdn spec and how dbs are implementing it are way off. But I don't see it being used very often. Same comments can apply to DateType. |
|||||||||||||||||||||||||||||||||||||||