server/sources/rql2sql.py
branchstable
changeset 7042 8bcf33c493f8
parent 6940 1172c25655b7
child 7108 bcdf22734059
equal deleted inserted replaced
7041:5a6fd60f7617 7042:8bcf33c493f8
     1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
   363     def iter_exists_sols(self, exists):
   363     def iter_exists_sols(self, exists):
   364         if not exists in self.existssols:
   364         if not exists in self.existssols:
   365             yield 1
   365             yield 1
   366             return
   366             return
   367         thisexistssols, thisexistsvars = self.existssols[exists]
   367         thisexistssols, thisexistsvars = self.existssols[exists]
       
   368         # when iterating other solutions inner to an EXISTS subquery, we should
       
   369         # reset variables which have this exists node as scope at each iteration
       
   370         for var in exists.stmt.defined_vars.itervalues():
       
   371             if var.scope is exists:
       
   372                 thisexistsvars.add(var.name)
   368         origsol = self.solution
   373         origsol = self.solution
   369         origtables = self.tables
   374         origtables = self.tables
   370         done = self.done
   375         done = self.done
   371         for thisexistssol in thisexistssols:
   376         for thisexistssol in thisexistssols:
   372             for vname in self.unstablevars:
   377             for vname in self.unstablevars: