I'd like to thank you for this work. I tried it and it *mostly* works on my Windows Server 2003 machine with MS SQL Server 2000, with a few hacks:
- Changed the last line in creation.py to (this was just to make it work in SQL 2000 *for me*, clearly it shouldn't stay like this) DATA_TYPES['TextField'] = 'nvarchar(1000) %(db_collation)s' - Inserted this line before the Database.connect call in DatabaseWrapper.cursor in base.py (because otherwise I was getting errors about a driver not being specified) Apparently this is the default according to the comments at the top of this file but it doesn't get put in the command. Again this is probably a bug that should be fixed properly rather than applying my hack. odbc_string = 'DRIVER={SQL Server};' + odbc_string - Changed CursorWrapper.execute in base.py to: def execute(self, sql, params=()): import datetime sql = self.format_sql(sql) # convert from unicode to utf-8 for pyodbc ps = [] for p in params: if isinstance(p, unicode): ps.append(unicode(p).encode('utf-8')) elif isinstance(p, datetime.date): ps.append(datetime.datetime(p.year, p.month, p.day)) elif isinstance(p, datetime.time): ps.append(datetime.datetime(1970, 1, 1, p.hour, p.minute, p.second)) else: ps.append(p) params = tuple(ps) return self.cursor.execute(sql, params) To handle the fact that SQL Server doesn't have specific date or time types. - I still haven't managed to get the reverse of this working; I always get datetime objects out of the database even for date fields and time fields. Does anyone see any way to fix this? I had a play around with get_cached_row in django.db.models.query.py but didn't really have any luck. I'd really like to see a SQL Server backend stay reasonably up to date with django and I'm prepared to help with any work needed to achieve this. Thanks On Jul 2, 11:48 pm, "vcc" <[EMAIL PROTECTED]> wrote: > I port MS SQL pyodbc backend (django-pyodbc) to newforms-admin r7671, tested > on ubuntu 8.04 and with SQL Server 2005. > I found sql server need convert boolean value to integer (BooleanField), so > need add a new feature like 'needs_bool_to_integer' to DatabaseFeatures, > deafult to False. > > Since this MS SQL backend work both on Linux and Windows, so we may consider > have MS SQL backend back in Django internal. > > Please see patch in attachment. > > Best regards, > > Wei Guangjing > _ > > django-pyodbc-r7671.patch > 39KDownload --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---