diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-03-06 02:27:13 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-03-06 02:27:13 +0000 |
commit | a0079b6831aef2b604859f89f07772e65c04d5d4 (patch) | |
tree | e70475a71ecc1cc198f8a7dd70f17fb081fb9727 /lib/sqlalchemy/ansisql.py | |
parent | 51acad4b5bf4ec5517d66e111d625ac0a0fd443e (diff) | |
download | sqlalchemy-a0079b6831aef2b604859f89f07772e65c04d5d4.tar.gz |
added new 'polymorphic' example. still trying to understand it :) .
fixes to relation to enable it to locate "direction" more consistently with inheritance relationships
more tweaks to parenthesizing subqueries, unions, etc.
Diffstat (limited to 'lib/sqlalchemy/ansisql.py')
-rw-r--r-- | lib/sqlalchemy/ansisql.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sqlalchemy/ansisql.py b/lib/sqlalchemy/ansisql.py index 64715cb4f..118f9f809 100644 --- a/lib/sqlalchemy/ansisql.py +++ b/lib/sqlalchemy/ansisql.py @@ -240,7 +240,10 @@ class ANSICompiler(sql.Compiled): text = string.join([self.get_str(c) for c in cs.selects], " " + cs.keyword + " ") for tup in cs.clauses: text += " " + tup[0] + " " + self.get_str(tup[1]) - self.strings[cs] = text + if cs.parens: + self.strings[cs] = "(" + text + ")" + else: + self.strings[cs] = text self.froms[cs] = "(" + text + ")" def visit_binary(self, binary): @@ -368,7 +371,7 @@ class ANSICompiler(sql.Compiled): text += self.visit_select_postclauses(select) - if getattr(select, 'useparens', False): + if getattr(select, 'parens', False): self.strings[select] = "(" + text + ")" else: self.strings[select] = text |