diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-01-30 21:08:11 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-01-30 21:08:11 +0000 |
| commit | d3e6ccc62555688bced7d4eb463718b30db7c706 (patch) | |
| tree | 47740e623f9d5fa28f958212ef678ed08363a830 /test/sql/unicode.py | |
| parent | 204e7201d21e5b850050ac511cb108a36c37e738 (diff) | |
| download | sqlalchemy-d3e6ccc62555688bced7d4eb463718b30db7c706.tar.gz | |
- Oracle and others properly encode SQL used for defaults
like sequences, etc., even if no unicode idents are used
since identifier preparer may return a cached unicode
identifier.
Diffstat (limited to 'test/sql/unicode.py')
| -rw-r--r-- | test/sql/unicode.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/sql/unicode.py b/test/sql/unicode.py index 9f352fd09..81b33865b 100644 --- a/test/sql/unicode.py +++ b/test/sql/unicode.py @@ -5,7 +5,7 @@ import testenv; testenv.configure_for_tests() from sqlalchemy import * from testlib import * from testlib.engines import utf8_engine - +from sqlalchemy.sql import column class UnicodeSchemaTest(PersistTest): @testing.unsupported('maxdb', 'oracle', 'sybase') @@ -112,6 +112,27 @@ class UnicodeSchemaTest(PersistTest): meta.drop_all() metadata.create_all() + @testing.fails_on_everything_except('postgres', 'firebird', 'oracle') + def test_default_exec(self): + t1 = Table('t1', metadata, + Column(u'special_col', Integer, Sequence('special_col'), primary_key=True)) + t1.create() + + try: + engine = metadata.bind + + # reset the identifier preparer, so that we can force it to cache + # a unicode identifier + engine.dialect.identifier_preparer = engine.dialect.preparer(engine.dialect) + select([column(u'special_col')]).select_from(t1).execute() + assert isinstance(engine.dialect.identifier_preparer.format_sequence(Sequence('special_col')), unicode) + + # now execute, run the sequence. it should run in u"Special_col.nextid" or similar as + # a unicode object; cx_oracle asserts that this is None or a String (postgres lets it pass thru). + # ensure that base.DefaultRunner is encoding. + t1.insert().execute() + finally: + t1.drop() if __name__ == '__main__': |
