server/sources/rql2sql.py
branchstable
changeset 5844 df7608ecea29
parent 5793 1faff41593df
child 5849 9db65b381028
child 5887 3f55f0f10a22
equal deleted inserted replaced
5843:85c4d5334f2c 5844:df7608ecea29
   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)