]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- assume in py3k that description encoding is None unless the dialect really
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 8 Apr 2011 18:54:45 +0000 (14:54 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 8 Apr 2011 18:54:45 +0000 (14:54 -0400)
overrides it
- psycopg2 + 3k supports unicode statements...

lib/sqlalchemy/dialects/mysql/oursql.py
lib/sqlalchemy/dialects/postgresql/pg8000.py
lib/sqlalchemy/dialects/postgresql/psycopg2.py
lib/sqlalchemy/engine/default.py

index ff5ecfc9318684becb471a8c89e2d820fa23213a..4ea4f56bedcaf7c180cf5fd536f0a3a88a919f7d 100644 (file)
@@ -64,8 +64,6 @@ class MySQLExecutionContext_oursql(MySQLExecutionContext):
 
 class MySQLDialect_oursql(MySQLDialect):
     driver = 'oursql'
-# Py3K
-#    description_encoding = None
 # Py2K
     supports_unicode_binds = True
     supports_unicode_statements = True
index c4f00eabea882c3f13667f57c90d4b6051e53cd3..44e095cdd9c70989682138ddffa64cab45a58bd5 100644 (file)
@@ -89,6 +89,7 @@ class PGDialect_pg8000(PGDialect):
     execution_ctx_cls = PGExecutionContext_pg8000
     statement_compiler = PGCompiler_pg8000
     preparer = PGIdentifierPreparer_pg8000
+    description_encoding = 'use_encoding'
 
     colspecs = util.update_copy(
         PGDialect.colspecs,
index 10d6e02697875022f4d0e2052666a6a458a75254..f96dab9a4af6191b15e948384d8252a19370dad2 100644 (file)
@@ -221,7 +221,9 @@ class PGIdentifierPreparer_psycopg2(PGIdentifierPreparer):
 
 class PGDialect_psycopg2(PGDialect):
     driver = 'psycopg2'
+    # Py2K
     supports_unicode_statements = False
+    # end Py2K
     default_paramstyle = 'pyformat'
     supports_sane_multi_rowcount = False
     execution_ctx_cls = PGExecutionContext_psycopg2
index 75a6864753c23ffa8a30b764df46b794b732ba01..9f6c5010e2d3f93ae3b2b3e69f4a5f1cb467d537 100644 (file)
@@ -56,10 +56,12 @@ class DefaultDialect(base.Dialect):
     #supports_unicode_statements = True
     #supports_unicode_binds = True
     #returns_unicode_strings = True
+    #description_encoding = None
     # Py2K
     supports_unicode_statements = False
     supports_unicode_binds = False
     returns_unicode_strings = False
+    description_encoding = 'use_encoding'
     # end Py2K
 
 
@@ -139,13 +141,11 @@ class DefaultDialect(base.Dialect):
                     (label_length, self.max_identifier_length))
         self.label_length = label_length
 
-        if not hasattr(self, 'description_encoding'):
-            self.description_encoding = getattr(
-                                            self, 
-                                            'description_encoding', 
-                                            encoding)
-
-        if self.description_encoding:
+        if self.description_encoding == 'use_encoding':
+            self._description_decoder = processors.to_unicode_processor_factory(
+                                            encoding
+                                    )
+        elif self.description_encoding is not None:
             self._description_decoder = processors.to_unicode_processor_factory(
                                             self.description_encoding
                                     )