diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-03 12:54:56 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-03 12:54:56 -0400 |
| commit | c2a158c137ee07a146f02e5ee89ec42e486c6a37 (patch) | |
| tree | 294b01e4dae6244ad4722b6c04693113895e6f33 /lib | |
| parent | 32716eae773e6f6b7f37baf705342c1ed89df461 (diff) | |
| download | sqlalchemy-c2a158c137ee07a146f02e5ee89ec42e486c6a37.tar.gz | |
- some tweaks to try to help out mssql+pyodbc support a bit, py3k is really
not happening too well (I need to stick with linux + freetds 0.91, I know)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/connectors/pyodbc.py | 31 | ||||
| -rw-r--r-- | lib/sqlalchemy/dialects/mssql/base.py | 1 |
2 files changed, 20 insertions, 12 deletions
diff --git a/lib/sqlalchemy/connectors/pyodbc.py b/lib/sqlalchemy/connectors/pyodbc.py index 784344b82..6b4e3036d 100644 --- a/lib/sqlalchemy/connectors/pyodbc.py +++ b/lib/sqlalchemy/connectors/pyodbc.py @@ -16,9 +16,12 @@ class PyODBCConnector(Connector): driver = 'pyodbc' supports_sane_multi_rowcount = False - # PyODBC unicode is broken on UCS-4 builds - supports_unicode = sys.maxunicode == 65535 - supports_unicode_statements = supports_unicode + + if util.py2k: + # PyODBC unicode is broken on UCS-4 builds + supports_unicode = sys.maxunicode == 65535 + supports_unicode_statements = supports_unicode + supports_native_decimal = True default_paramstyle = 'named' @@ -121,15 +124,19 @@ class PyODBCConnector(Connector): self.freetds_driver_version = dbapi_con.getinfo( pyodbc.SQL_DRIVER_VER) - if not util.py3k: - self.supports_unicode_statements = ( - 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 - else: - self.supports_unicode_binds = ( - not self.freetds or self.freetds_driver_version >= '0.91' - ) and not self.easysoft + 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) diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index a5d789be1..3c329fe5e 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -1172,6 +1172,7 @@ class MSDialect(default.DefaultDialect): columns = ischema.columns whereclause = self._unicode_cast(columns.c.table_name) == tablename + if owner: whereclause = sql.and_(whereclause, columns.c.table_schema == owner) |
