summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/connectors/pyodbc.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/connectors/pyodbc.py')
-rw-r--r--lib/sqlalchemy/connectors/pyodbc.py58
1 files changed, 6 insertions, 52 deletions
diff --git a/lib/sqlalchemy/connectors/pyodbc.py b/lib/sqlalchemy/connectors/pyodbc.py
index 66acf0072..b95b2964f 100644
--- a/lib/sqlalchemy/connectors/pyodbc.py
+++ b/lib/sqlalchemy/connectors/pyodbc.py
@@ -9,7 +9,6 @@ from . import Connector
from .. import util
-import sys
import re
@@ -19,10 +18,8 @@ class PyODBCConnector(Connector):
supports_sane_rowcount_returning = False
supports_sane_multi_rowcount = False
- if util.py2k:
- # PyODBC unicode is broken on UCS-4 builds
- supports_unicode = sys.maxunicode == 65535
- supports_unicode_statements = supports_unicode
+ supports_unicode_statements = True
+ supports_unicode_binds = True
supports_native_decimal = True
default_paramstyle = 'named'
@@ -31,21 +28,10 @@ class PyODBCConnector(Connector):
# hold the desired driver name
pyodbc_driver_name = None
- # will be set to True after initialize()
- # if the freetds.so is detected
- freetds = False
-
- # will be set to the string version of
- # the FreeTDS driver if freetds is detected
- freetds_driver_version = None
-
- # will be set to True after initialize()
- # if the libessqlsrv.so is detected
- easysoft = False
-
def __init__(self, supports_unicode_binds=None, **kw):
super(PyODBCConnector, self).__init__(**kw)
- self._user_supports_unicode_binds = supports_unicode_binds
+ if supports_unicode_binds is not None:
+ self.supports_unicode_binds = supports_unicode_binds
@classmethod
def dbapi(cls):
@@ -130,40 +116,8 @@ class PyODBCConnector(Connector):
else:
return False
- def initialize(self, connection):
- # determine FreeTDS first. can't issue SQL easily
- # without getting unicode_statements/binds set up.
-
- pyodbc = self.dbapi
-
- dbapi_con = connection.connection
-
- _sql_driver_name = dbapi_con.getinfo(pyodbc.SQL_DRIVER_NAME)
- self.freetds = bool(re.match(r".*libtdsodbc.*\.so", _sql_driver_name
- ))
- self.easysoft = bool(re.match(r".*libessqlsrv.*\.so", _sql_driver_name
- ))
-
- if self.freetds:
- self.freetds_driver_version = dbapi_con.getinfo(
- pyodbc.SQL_DRIVER_VER)
-
- self.supports_unicode_statements = (
- not util.py2k or
- (not self.freetds and not self.easysoft)
- )
-
- if self._user_supports_unicode_binds is not None:
- self.supports_unicode_binds = self._user_supports_unicode_binds
- elif util.py2k:
- self.supports_unicode_binds = (
- not self.freetds or self.freetds_driver_version >= '0.91'
- ) and not self.easysoft
- else:
- self.supports_unicode_binds = True
-
- # run other initialization which asks for user name, etc.
- super(PyODBCConnector, self).initialize(connection)
+ # def initialize(self, connection):
+ # super(PyODBCConnector, self).initialize(connection)
def _dbapi_version(self):
if not self.dbapi: