diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-09-18 15:33:12 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-09-18 15:33:12 -0400 |
| commit | 57ae8672a6be786c32d79faca90666d5b654bce6 (patch) | |
| tree | 517a9586b04ca72723e50b263c309366cc465832 /lib/sqlalchemy/connectors | |
| parent | 746be1283806259f7be6e283c4e7a2df254cc094 (diff) | |
| download | sqlalchemy-57ae8672a6be786c32d79faca90666d5b654bce6.tar.gz | |
- Changes to attempt support of FreeTDS 0.91 with
Pyodbc. This includes that string binds are sent as
Python unicode objects when FreeTDS 0.91 is detected,
and a CAST(? AS NVARCHAR) is used when we detect
for a table. However, I'd continue
to characterize Pyodbc + FreeTDS 0.91 behavior as
pretty crappy, there are still many queries such
as used in reflection which cause a core dump on
Linux, and it is not really usable at all
on OSX, MemoryErrors abound and just plain broken
unicode support. [ticket:2273]
Diffstat (limited to 'lib/sqlalchemy/connectors')
| -rw-r--r-- | lib/sqlalchemy/connectors/pyodbc.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/sqlalchemy/connectors/pyodbc.py b/lib/sqlalchemy/connectors/pyodbc.py index ea4810df7..562cf9273 100644 --- a/lib/sqlalchemy/connectors/pyodbc.py +++ b/lib/sqlalchemy/connectors/pyodbc.py @@ -29,6 +29,10 @@ class PyODBCConnector(Connector): # 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 @@ -108,11 +112,15 @@ class PyODBCConnector(Connector): 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) + # the "Py2K only" part here is theoretical. # have not tried pyodbc + python3.1 yet. # Py2K self.supports_unicode_statements = not self.freetds and not self.easysoft - self.supports_unicode_binds = not self.freetds and not self.easysoft + self.supports_unicode_binds = (not self.freetds or + self.freetds_driver_version >= '0.91') and not self.easysoft # end Py2K # run other initialization which asks for user name, etc. |
