def _disjunctions(cls, cursor, disjuncts, aliases=None, aggregate=False): """ Returns a valid SQL condition expression of the form: (d00 & d01 & ...) | (d10 & d11 & ...) | ... Where `d{N}` is a `nfldb.Condition` element in `disjuncts` and `d{Ni}` is an element in `d{N}`. """ def sql(c): return c._sql_where(cursor, aliases=aliases, aggregate=aggregate) ds = [] for conjuncts in disjuncts: ds.append(' AND '.join('(%s)' % sql(c) for c in conjuncts)) return ' OR '.join('(%s)' % d for d in ds if d)
def _disjunctions(cls, cursor, disjuncts, aliases=None, aggregate=False): """ Returns a valid SQL condition expression of the form: (d00 & d01 & ...) | (d10 & d11 & ...) | ... Where `d{N}` is a `nfldb.Condition` element in `disjuncts` and `d{Ni}` is an element in `d{N}`. """ def sql(c): return c._sql_where(cursor, aliases=aliases, aggregate=aggregate) ds = [] for conjuncts in disjuncts: ds.append(' AND '.join('(%s)' % sql(c).decode() for c in conjuncts)) return ' OR '.join('(%s)' % d for d in ds if d)