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): def relabeled_clone(self, relabels):
return self.__class__(self.lhs.relabeled_clone(relabels)) return self.__class__(self.lhs.relabeled_clone(relabels))
def get_cols(self): def get_group_by_cols(self):
return self.lhs.get_cols() return self.lhs.get_group_by_cols()
class Lookup(RegisterLookupMixin): class Lookup(RegisterLookupMixin):
@ -102,10 +102,10 @@ class Lookup(RegisterLookupMixin):
new.rhs = new.rhs.relabeled_clone(relabels) new.rhs = new.rhs.relabeled_clone(relabels)
return new return new
def get_cols(self): def get_group_by_cols(self):
cols = self.lhs.get_cols() cols = self.lhs.get_group_by_cols()
if hasattr(self.rhs, 'get_cols'): if hasattr(self.rhs, 'get_group_by_cols'):
cols.extend(self.rhs.get_cols()) cols.extend(self.rhs.get_group_by_cols())
return cols return cols
def as_sql(self, qn, connection): def as_sql(self, qn, connection):

View File

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

View File

@ -106,7 +106,7 @@ class SQLCompiler(object):
where, w_params = self.compile(self.query.where) where, w_params = self.compile(self.query.where)
having, h_params = self.compile(self.query.having) 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 = [] params = []
for val in six.itervalues(self.query.extra_select): for val in six.itervalues(self.query.extra_select):
params.extend(val[1]) params.extend(val[1])

View File

@ -22,7 +22,7 @@ class Col(object):
def relabeled_clone(self, relabels): def relabeled_clone(self, relabels):
return self.__class__(relabels.get(self.alias, self.alias), self.target, self.source) 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)] return [(self.alias, self.target.column)]
def get_lookup(self, name): def get_lookup(self, name):

View File

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

View File

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