]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- CompileTests run without the DBAPI being used
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 23 Oct 2008 02:35:08 +0000 (02:35 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 23 Oct 2008 02:35:08 +0000 (02:35 +0000)
- added stack logic back to visit_compound(), pared down is_subquery

lib/sqlalchemy/sql/compiler.py
test/dialect/mssql.py

index ac46d57686a28ae5b4666f501abe029bf24d873b..b4069e6fd6d2ec2f688d309a649fd89d129fb473 100644 (file)
@@ -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:
index a2fcae8047bf982b68fd4db717c802d30887e4af..4708cc28c4cfcc93bc2f0775d605adb00f848f18 100755 (executable)
@@ -10,7 +10,6 @@ from testlib import *
 
 
 class CompileTest(TestBase, AssertsCompiledSQL):
-    __only_on__ = 'mssql'
     __dialect__ = mssql.MSSQLDialect()
 
     def test_insert(self):