diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-01-19 20:11:29 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-01-19 20:11:29 +0000 |
commit | bd3a65252d2f9155b7f2c1c6284074ba6e555d1f (patch) | |
tree | 00d2369aea4ae48c95b9d6314aa39258fd1fb7eb /test/sql/labels.py | |
parent | 840a2fabb8999b4b3807dfa55d771627656ab1db (diff) | |
download | sqlalchemy-bd3a65252d2f9155b7f2c1c6284074ba6e555d1f.tar.gz |
- Oracle assembles the correct columns in the result set
column mapping when generating a LIMIT/OFFSET subquery,
allows columns to map properly to result sets even
if long-name truncation kicks in [ticket:941]
Diffstat (limited to 'test/sql/labels.py')
-rw-r--r-- | test/sql/labels.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/test/sql/labels.py b/test/sql/labels.py index 3d4f0adde..8164d7f77 100644 --- a/test/sql/labels.py +++ b/test/sql/labels.py @@ -44,7 +44,8 @@ class LongLabelsTest(SQLCompileTest): table1.insert().execute(**{"this_is_the_primarykey_column":3, "this_is_the_data_column":"data3"}) table1.insert().execute(**{"this_is_the_primarykey_column":4, "this_is_the_data_column":"data4"}) - r = table1.select(use_labels=True, order_by=[table1.c.this_is_the_primarykey_column]).execute() + s = table1.select(use_labels=True, order_by=[table1.c.this_is_the_primarykey_column]) + r = s.execute() result = [] for row in r: result.append((row[table1.c.this_is_the_primarykey_column], row[table1.c.this_is_the_data_column])) @@ -55,6 +56,28 @@ class LongLabelsTest(SQLCompileTest): (4, "data4"), ], repr(result) + # some dialects such as oracle (and possibly ms-sql in a future version) + # generate a subquery for limits/offsets. + # ensure that the generated result map corresponds to the selected table, not + # the select query + r = s.limit(2).execute() + result = [] + for row in r: + result.append((row[table1.c.this_is_the_primarykey_column], row[table1.c.this_is_the_data_column])) + assert result == [ + (1, "data1"), + (2, "data2"), + ], repr(result) + + r = s.limit(2).offset(1).execute() + result = [] + for row in r: + result.append((row[table1.c.this_is_the_primarykey_column], row[table1.c.this_is_the_data_column])) + assert result == [ + (2, "data2"), + (3, "data3"), + ], repr(result) + def test_colbinds(self): table1.insert().execute(**{"this_is_the_primarykey_column":1, "this_is_the_data_column":"data1"}) table1.insert().execute(**{"this_is_the_primarykey_column":2, "this_is_the_data_column":"data2"}) |