]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add a new 'odbc_autotranslate' engine/dburi kwd parm to the MSSQL pyodbc dialect...
authorRick Morrison <rickmorrison@gmail.com>
Tue, 8 Apr 2008 19:09:33 +0000 (19:09 +0000)
committerRick Morrison <rickmorrison@gmail.com>
Tue, 8 Apr 2008 19:09:33 +0000 (19:09 +0000)
[ticket:1005]

CHANGES
lib/sqlalchemy/databases/mssql.py

diff --git a/CHANGES b/CHANGES
index cf7df2c730aae72b1bf8c67392303e56be1030b3..9abc4a249aaf2aca44faef8512f4bfcdeb632a07 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -25,6 +25,16 @@ CHANGES
       callables or a (possibly partial) duck-type of
       PoolListener, your choice.
 
+- mssql
+    - Added "odbc_autotranslate" parameter to engine / dburi
+      parameters. Any given string will be passed through to 
+      the ODBC connection string as 
+            "AutoTranslat=%s" % odbc_autotranslate
+      [ticket:1005]
+
+
+
+
 0.4.5
 =====
 - orm
index e0bf2e6bb601ba0e621de86769723a3492be50a2..6cc5f4fd34c0c6b93051ba48fc9cf30e143680b2 100644 (file)
@@ -792,7 +792,14 @@ class MSSQLDialect_pyodbc(MSSQLDialect):
             connectors.append("UID=%s" % user)
             connectors.append("PWD=%s" % keys.get("password", ""))
         else:
-            connectors.append ("TrustedConnection=Yes")
+            connectors.append("TrustedConnection=Yes")
+
+        # if set to 'Yes', the ODBC layer will try to automagically convert 
+        # textual data from your database encoding to your client encoding 
+        # This should obviously be set to 'No' if you query a cp1253 encoded 
+        # database from a latin1 client... 
+        if 'odbc_autotranslate' in keys: 
+            connectors.append("AutoTranslate=%s" % keys.pop("odbc_autotranslate")) 
         return [[";".join (connectors)], {}]
 
     def is_disconnect(self, e):