From 61d86443205e950e67c73ba446b4422f077f6a24 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 1 Apr 2008 22:36:40 +0000 Subject: - 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 --- lib/sqlalchemy/sql/expression.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'lib/sqlalchemy/sql/expression.py') 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 -- cgit v1.2.1