summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-04-01 22:36:40 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-04-01 22:36:40 +0000
commit61d86443205e950e67c73ba446b4422f077f6a24 (patch)
treec94cadb365d095a32263a0699ba05f013529ae90 /lib/sqlalchemy/sql
parentf01e13ca723e5fbcdae29538d176a8358f1d7de0 (diff)
downloadsqlalchemy-61d86443205e950e67c73ba446b4422f077f6a24.tar.gz
- added verbose activity to profiling.function_call_count
- simplified oracle non-ansi join generation, removed hooks from base compiler - removed join() call from _label generation, fixed repeat label gen
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/compiler.py20
-rw-r--r--lib/sqlalchemy/sql/expression.py20
2 files changed, 13 insertions, 27 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 76e2ca260..800881e49 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -193,16 +193,6 @@ class DefaultCompiler(engine.Compiled):
def is_subquery(self, select):
return self.stack and self.stack[-1].get('is_subquery')
- def get_whereclause(self, obj):
- """given a FROM clause, return an additional WHERE condition that should be
- applied to a SELECT.
-
- Currently used by Oracle to provide WHERE criterion for JOIN and OUTER JOIN
- constructs in non-ansi mode.
- """
-
- return None
-
def construct_params(self, params=None):
"""return a dictionary of bind parameter keys and values"""
@@ -529,25 +519,17 @@ class DefaultCompiler(engine.Compiled):
text += self.get_select_precolumns(select)
text += collist
- whereclause = select._whereclause
-
from_strings = []
for f in froms:
from_strings.append(self.process(f, asfrom=True))
- w = self.get_whereclause(f)
- if w is not None:
- if whereclause is not None:
- whereclause = sql.and_(w, whereclause)
- else:
- whereclause = w
-
if froms:
text += " \nFROM "
text += string.join(from_strings, ', ')
else:
text += self.default_from()
+ whereclause = select._whereclause
if whereclause is not None:
t = self.process(whereclause)
if t:
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py
index 758f75ebe..d8a85d8bd 100644
--- a/lib/sqlalchemy/sql/expression.py
+++ b/lib/sqlalchemy/sql/expression.py
@@ -2630,16 +2630,20 @@ class _ColumnClause(ColumnElement):
# therefore no 'label' can be automatically generated
if self.is_literal:
return None
- if self.__label is None:
- if self.table is not None and self.table.named_with_column:
+ if not self.__label:
+ if self.table and self.table.named_with_column:
if getattr(self.table, 'schema', None):
- self.__label = "_".join([self.table.schema, self.table.name, self.name])
+ self.__label = self.table.schema + "_" + self.table.name + "_" + self.name
else:
- self.__label = "_".join([self.table.name, self.name])
- counter = 1
- while self.__label in self.table.c:
- self.__label = self.__label + "_%d" % counter
- counter += 1
+ self.__label = self.table.name + "_" + self.name
+
+ if self.__label in self.table.c:
+ label = self.__label
+ counter = 1
+ while label in self.table.c:
+ label = self.__label + "_" + str(counter)
+ counter +=1
+ self.__label = label
else:
self.__label = self.name
return self.__label