Skip to content

Commit bf58f97

Browse files
committed
add support for Microsoft's new SQL Native Client drivers
1 parent cc22e8d commit bf58f97

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

django_pyodbc/base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
9898
# CONTAINS: http://msdn2.microsoft.com/en-us/library/ms187787.aspx
9999
# FREETEXT: http://msdn2.microsoft.com/en-us/library/ms176078.aspx
100100

101+
vendor = 'microsoft'
101102
operators = {
102103
# Since '=' is used not only for string comparision there is no way
103104
# to make it case (in)sensitive. It will simply fallback to the
@@ -246,14 +247,15 @@ def _cursor(self):
246247
self.creation.data_types['TextField'] = 'ntext'
247248
self.features.can_return_id_from_insert = False
248249

250+
ms_sqlncli = re.compile('^((LIB)?SQLN?CLI|LIBMSODBCSQL)')
249251
if self.driver_needs_utf8 is None:
250252
self.driver_needs_utf8 = True
251253
self.drv_name = self.connection.getinfo(Database.SQL_DRIVER_NAME).upper()
252-
if self.drv_name in ('SQLSRV32.DLL', 'SQLNCLI.DLL', 'SQLNCLI10.DLL'):
254+
if self.drv_name == 'SQLSRV32.DLL' or ms_sqlncli.match(self.drv_name):
253255
self.driver_needs_utf8 = False
254256

255257
# http://msdn.microsoft.com/en-us/library/ms131686.aspx
256-
if self.ops.sql_server_ver >= 2005 and self.drv_name in ('SQLNCLI.DLL', 'SQLNCLI10.DLL') and self.MARS_Connection:
258+
if self.ops.sql_server_ver >= 2005 and ms_sqlncli.match(self.drv_name) and self.MARS_Connection:
257259
# How to to activate it: Add 'MARS_Connection': True
258260
# to the DATABASE_OPTIONS dictionary setting
259261
self.features.can_use_chunked_reads = True

0 commit comments

Comments
 (0)