Renamed get_cols to get_group_by_cols

This commit is contained in:
Anssi Kääriäinen 2014-01-11 14:57:12 +02:00
parent c7d5f8661b
commit 33aa18a6e3
6 changed files with 17 additions and 17 deletions

View File

@ -54,8 +54,8 @@ class Extract(RegisterLookupMixin):
def relabeled_clone(self, relabels):
return self.__class__(self.lhs.relabeled_clone(relabels))
def get_cols(self):
return self.lhs.get_cols()
def get_group_by_cols(self):
return self.lhs.get_group_by_cols()
class Lookup(RegisterLookupMixin):
@ -102,10 +102,10 @@ class Lookup(RegisterLookupMixin):
new.rhs = new.rhs.relabeled_clone(relabels)
return new
def get_cols(self):
cols = self.lhs.get_cols()
if hasattr(self.rhs, 'get_cols'):
cols.extend(self.rhs.get_cols())
def get_group_by_cols(self):
cols = self.lhs.get_group_by_cols()
if hasattr(self.rhs, 'get_group_by_cols'):
cols.extend(self.rhs.get_group_by_cols())
return cols
def as_sql(self, qn, connection):

View File

@ -94,7 +94,7 @@ class Aggregate(RegisterLookupMixin):
return self.sql_template % substitutions, params
def get_cols(self):
def get_group_by_cols(self):
return []
@property

View File

@ -106,7 +106,7 @@ class SQLCompiler(object):
where, w_params = self.compile(self.query.where)
having, h_params = self.compile(self.query.having)
having_group_by = self.query.having.get_cols()
having_group_by = self.query.having.get_group_by_cols()
params = []
for val in six.itervalues(self.query.extra_select):
params.extend(val[1])

View File

@ -22,7 +22,7 @@ class Col(object):
def relabeled_clone(self, relabels):
return self.__class__(relabels.get(self.alias, self.alias), self.target, self.source)
def get_cols(self):
def get_group_by_cols(self):
return [(self.alias, self.target.column)]
def get_lookup(self, name):

View File

@ -24,11 +24,11 @@ class SQLEvaluator(object):
(change_map.get(col[0], col[0]), col[1])))
return clone
def get_cols(self):
def get_group_by_cols(self):
cols = []
for node, col in self.cols:
if hasattr(node, 'get_cols'):
cols.extend(node.get_cols())
if hasattr(node, 'get_group_by_cols'):
cols.extend(node.get_group_by_cols())
elif isinstance(col, tuple):
cols.append(col)
return cols

View File

@ -153,16 +153,16 @@ class WhereNode(tree.Node):
sql_string = '(%s)' % sql_string
return sql_string, result_params
def get_cols(self):
def get_group_by_cols(self):
cols = []
for child in self.children:
if hasattr(child, 'get_cols'):
cols.extend(child.get_cols())
if hasattr(child, 'get_group_by_cols'):
cols.extend(child.get_group_by_cols())
else:
if isinstance(child[0], Constraint):
cols.append((child[0].alias, child[0].col))
if hasattr(child[3], 'get_cols'):
cols.extend(child[3].get_cols())
if hasattr(child[3], 'get_group_by_cols'):
cols.extend(child[3].get_group_by_cols())
return cols
def make_atom(self, child, qn, connection):