summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-10-23 02:35:08 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-10-23 02:35:08 +0000
commit99cd1346fb8d36744d8d681d159795424cdbf76b (patch)
treee42a93e04334ea7b161240bbbaa4d0525f1e2b94 /lib/sqlalchemy/sql/compiler.py
parent1ccdfb517237408f746068f466548f9331468d7f (diff)
downloadsqlalchemy-99cd1346fb8d36744d8d681d159795424cdbf76b.tar.gz
- CompileTests run without the DBAPI being used
- added stack logic back to visit_compound(), pared down is_subquery
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index ac46d5768..b4069e6fd 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -194,7 +194,7 @@ class DefaultCompiler(engine.Compiled):
return obj._compiler_dispatch(self, **kwargs)
def is_subquery(self):
- return self.stack and len(self.stack) > 1 and self.stack[-1].get('from')
+ return len(self.stack) > 1
def construct_params(self, params=None):
"""return a dictionary of bind parameter keys and values"""
@@ -342,6 +342,8 @@ class DefaultCompiler(engine.Compiled):
return self.functions.get(func.__class__, self.functions.get(func.name, func.name + "%(expr)s"))
def visit_compound_select(self, cs, asfrom=False, parens=True, **kwargs):
+ entry = self.stack and self.stack[-1] or {}
+ self.stack.append({'from':entry.get('from', None), 'iswrapper':True})
text = string.join((self.process(c, asfrom=asfrom, parens=False, compound_index=i)
for i, c in enumerate(cs.selects)),
@@ -353,6 +355,7 @@ class DefaultCompiler(engine.Compiled):
text += self.order_by_clause(cs)
text += (cs._limit is not None or cs._offset is not None) and self.limit_clause(cs) or ""
+ self.stack.pop(-1)
if asfrom and parens:
return "(" + text + ")"
else: