diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-04-08 14:54:45 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-04-08 14:54:45 -0400 |
| commit | ee542a109feba61cc34adc7927b74500894c9425 (patch) | |
| tree | 3621adc2bd88f26a8b6faff65ee033db2be3beb0 /lib | |
| parent | a645032262afc41cd39a85c9f56388341346a995 (diff) | |
| download | sqlalchemy-ee542a109feba61cc34adc7927b74500894c9425.tar.gz | |
- assume in py3k that description encoding is None unless the dialect really
overrides it
- psycopg2 + 3k supports unicode statements...
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/dialects/mysql/oursql.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/dialects/postgresql/pg8000.py | 1 | ||||
| -rw-r--r-- | lib/sqlalchemy/dialects/postgresql/psycopg2.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/default.py | 14 |
4 files changed, 10 insertions, 9 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/oursql.py b/lib/sqlalchemy/dialects/mysql/oursql.py index ff5ecfc93..4ea4f56be 100644 --- a/lib/sqlalchemy/dialects/mysql/oursql.py +++ b/lib/sqlalchemy/dialects/mysql/oursql.py @@ -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 diff --git a/lib/sqlalchemy/dialects/postgresql/pg8000.py b/lib/sqlalchemy/dialects/postgresql/pg8000.py index c4f00eabe..44e095cdd 100644 --- a/lib/sqlalchemy/dialects/postgresql/pg8000.py +++ b/lib/sqlalchemy/dialects/postgresql/pg8000.py @@ -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, diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py index 10d6e0269..f96dab9a4 100644 --- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py +++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py @@ -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 diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 75a686475..9f6c5010e 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -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 ) |
