827 return '%s=%s' % (lhssql, rhsconst.accept(self)) |
827 return '%s=%s' % (lhssql, rhsconst.accept(self)) |
828 if isinstance(rhsvar, Variable) and not rhsvar.name in self._varmap: |
828 if isinstance(rhsvar, Variable) and not rhsvar.name in self._varmap: |
829 # if the rhs variable is only linked to this relation, this mean we |
829 # if the rhs variable is only linked to this relation, this mean we |
830 # only want the relation to exists, eg NOT NULL in case of inlined |
830 # only want the relation to exists, eg NOT NULL in case of inlined |
831 # relation |
831 # relation |
832 if len(rhsvar.stinfo['relations']) == 1 and rhsvar._q_invariant: |
832 if rhsvar._q_invariant: |
|
833 sql = self._extra_join_sql(relation, lhssql, rhsvar) |
|
834 if sql: |
|
835 return sql |
833 return '%s IS NOT NULL' % lhssql |
836 return '%s IS NOT NULL' % lhssql |
834 if rhsvar._q_invariant: |
|
835 return self._extra_join_sql(relation, lhssql, rhsvar) |
|
836 return '%s=%s' % (lhssql, rhsvar.accept(self)) |
837 return '%s=%s' % (lhssql, rhsvar.accept(self)) |
837 |
838 |
838 def _process_relation_term(self, relation, rid, termvar, termconst, relfield): |
839 def _process_relation_term(self, relation, rid, termvar, termconst, relfield): |
839 if termconst or not termvar._q_invariant: |
840 if termconst or not termvar._q_invariant: |
840 termsql = termconst and termconst.accept(self) or termvar.accept(self) |
841 termsql = termconst and termconst.accept(self) or termvar.accept(self) |