From bd3a65252d2f9155b7f2c1c6284074ba6e555d1f Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 19 Jan 2008 20:11:29 +0000 Subject: - 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] --- lib/sqlalchemy/sql/compiler.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 666a38d39..71bfd1765 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -468,13 +468,20 @@ class DefaultCompiler(engine.Compiled): else: return column - def visit_select(self, select, asfrom=False, parens=True, **kwargs): + def visit_select(self, select, asfrom=False, parens=True, iswrapper=False, **kwargs): stack_entry = {'select':select} - - if asfrom or (self.stack and 'select' in self.stack[-1]): + prev_entry = self.stack and self.stack[-1] or None + + if asfrom or (prev_entry and 'select' in prev_entry): stack_entry['is_subquery'] = True + if prev_entry and 'iswrapper' in prev_entry: + column_clause_args = {'result_map':self.result_map} + else: + column_clause_args = {} + elif iswrapper: column_clause_args = {} + stack_entry['iswrapper'] = True else: column_clause_args = {'result_map':self.result_map} -- cgit v1.2.1