[patch] MS-SQL server fixes
|Reported by:||Dan Hristodorescu danh@…||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
I attached a patch to try to make django work with MS-SQL server.
The patch is for these issues:
- The backend didn't create the proper wrapper cursor to replace parameter placeholders to ?
- MS-SQL doesn't support microseconds, so I added it like it was already in for MySQL. Since there are already two databases that need this I would suggest to refactor the code and add a flag in the backend drivers for this.
- In django/db/models/base.py line 175: cursor.execute("SELECT 1 FROM %s WHERE %s=%%s LIMIT 1"
In SQL server should be SELECT TOP 1 instead of LIMIT although I don't understand why one would put a limit on an exact match on the primary key. It could only return one row anyway. I removed it but someone should check if it's ok.