equal
deleted
inserted
replaced
206 @property |
206 @property |
207 def pool(self): |
207 def pool(self): |
208 """connections pool, set according to transaction mode for each query""" |
208 """connections pool, set according to transaction mode for each query""" |
209 return getattr(self._threaddata, 'pool', None) |
209 return getattr(self._threaddata, 'pool', None) |
210 |
210 |
211 def set_pool(self): |
211 def set_pool(self, checkclosed=True): |
212 """the session need a pool to execute some queries""" |
212 """the session need a pool to execute some queries""" |
213 if self._closed: |
213 if checkclosed and self._closed: |
214 raise Exception('try to set pool on a closed session') |
214 raise Exception('try to set pool on a closed session') |
215 if self.pool is None: |
215 if self.pool is None: |
216 # get pool first to avoid race-condition |
216 # get pool first to avoid race-condition |
217 self._threaddata.pool = pool = self.repo._get_pool() |
217 self._threaddata.pool = pool = self.repo._get_pool() |
218 try: |
218 try: |
333 csession = self |
333 csession = self |
334 else: |
334 else: |
335 csession = ChildSession(self) |
335 csession = ChildSession(self) |
336 self._threaddata.childsession = csession |
336 self._threaddata.childsession = csession |
337 # need shared pool set |
337 # need shared pool set |
338 self.set_pool() |
338 self.set_pool(checkclosed=False) |
339 return csession |
339 return csession |
340 |
340 |
341 def unsafe_execute(self, rql, kwargs=None, eid_key=None, build_descr=True, |
341 def unsafe_execute(self, rql, kwargs=None, eid_key=None, build_descr=True, |
342 propagate=False): |
342 propagate=False): |
343 """like .execute but with security checking disabled (this method is |
343 """like .execute but with security checking disabled (this method is |