Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
DATABASE_ODBC_DRIVER - ODBC Driver. Defalut is "{Sql Server}".
DATABASE_ODBC_EXTRA_PARAMS - Additional parameters for the ODBC connection.
The format is "param=value;param=value".
"""
from django.db.backends import BaseDatabaseWrapper, BaseDatabaseFeatures, util
from django.core.exceptions import ImproperlyConfigured
from operations import DatabaseOperations
need_param_rewrite=False
try:
import pymssql as Database
except ImportError, ex:
try:
need_param_rewrite=True
import pyodbc as Database
version = tuple(map(int, Database.version.split('.')))
if version < (2,0,38) :
raise ImportError("pyodbc 2.0.38 or newer is required; you have %s" % Database.version)
except ImportError, e:
raise ImproperlyConfigured("Error loading pymssq/pyodbc modules: %s" % ex)
try:
# Only exists in Python 2.4+
from threading import local
except ImportError:
# Import copy of _thread_local.py from Python 2.4
from django.utils._threading_local import local
DatabaseError = Database.DatabaseError
IntegrityError = Database.IntegrityError
class DatabaseFeatures(BaseDatabaseFeatures):