On Tue, 2008-04-01 at 10:10 -0700, Adam V. wrote: > In DateTimeField.get_db_prep_save there is a hard-coded check for the > mysql backend, which drops the microseconds from the value. > > I'm working on an external MS SQL backend (django-mssql) and I'm > running into a different problem here. > > DateTimeFields are sent to queries as unicode which looks like: > u'2008-03-09 17:45:10.156000' > > MS SQL Server only accepts up to 3 digits in the decimal, so this > would work: > u'2008-03-09 17:45:10.156' > > > I certainly don't want to cram a check for my external backend name > into django's core... but by the time the parameter is being processed > in the backend its already a string and I don't have a lot of > information about the fact that it's going to end up (say) being > inserted into a date field in the database.
A couple of times I've tried to earnestly remove all of the backend-specific checks in fields/__init__.py so that they can reside only in backends. It should be possible, but it's a little fiddly, so I've been postponing it in favour of higher-priority stuff to date. I think it's worth doing eventually for date and datetime fields. We now have Oracle- and MySQL-specific tests in there, so it's reasonable to expect that's an area of some variation. Another function in the backend's DatabaseOperations probably won't kill us here. Regards, Malcolm -- I just got lost in thought. It was unfamiliar territory. http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
