311 else: |
311 else: |
312 del self._eid_cache[eid] |
312 del self._eid_cache[eid] |
313 |
313 |
314 # low level session data management ####################################### |
314 # low level session data management ####################################### |
315 |
315 |
316 def get_shared_data(self, key, default=None, pop=False): |
316 def get_shared_data(self, key, default=None, pop=False, txdata=False): |
317 """return value associated to `key` in shared data""" |
317 """see :meth:`Connection.get_shared_data`""" |
318 return self.cnx.get_shared_data(key, default, pop) |
318 return self.cnx.get_shared_data(key, default, pop, txdata) |
319 |
319 |
320 def set_shared_data(self, key, value, querydata=False): |
320 def set_shared_data(self, key, value, txdata=False, querydata=None): |
321 """set value associated to `key` in shared data |
321 """see :meth:`Connection.set_shared_data`""" |
322 |
322 if querydata is not None: |
323 if `querydata` is true, the value will be added to the repository |
323 txdata = querydata |
324 session's query data which are cleared on commit/rollback of the current |
324 warn('[3.10] querydata argument has been renamed to txdata', |
325 transaction, and won't be available through the connexion, only on the |
325 DeprecationWarning, stacklevel=2) |
326 repository side. |
326 return self.cnx.set_shared_data(key, value, txdata) |
327 """ |
|
328 return self.cnx.set_shared_data(key, value, querydata) |
|
329 |
327 |
330 # server session compat layer ############################################# |
328 # server session compat layer ############################################# |
331 |
329 |
332 def describe(self, eid): |
330 def describe(self, eid): |
333 """return a tuple (type, sourceuri, extid) for the entity with id <eid>""" |
331 """return a tuple (type, sourceuri, extid) for the entity with id <eid>""" |
518 """raise `BadConnectionId` if the connection is no more valid""" |
516 """raise `BadConnectionId` if the connection is no more valid""" |
519 if self._closed is not None: |
517 if self._closed is not None: |
520 raise ProgrammingError('Closed connection') |
518 raise ProgrammingError('Closed connection') |
521 self._repo.set_session_props(self.sessionid, props) |
519 self._repo.set_session_props(self.sessionid, props) |
522 |
520 |
523 def get_shared_data(self, key, default=None, pop=False): |
521 def get_shared_data(self, key, default=None, pop=False, txdata=False): |
524 """return value associated to `key` in shared data""" |
522 """return value associated to key in the session's data dictionary or |
|
523 session's transaction's data if `txdata` is true. |
|
524 |
|
525 If pop is True, value will be removed from the dictionnary. |
|
526 |
|
527 If key isn't defined in the dictionnary, value specified by the |
|
528 `default` argument will be returned. |
|
529 """ |
525 if self._closed is not None: |
530 if self._closed is not None: |
526 raise ProgrammingError('Closed connection') |
531 raise ProgrammingError('Closed connection') |
527 return self._repo.get_shared_data(self.sessionid, key, default, pop) |
532 return self._repo.get_shared_data(self.sessionid, key, default, pop, txdata) |
528 |
533 |
529 def set_shared_data(self, key, value, querydata=False): |
534 def set_shared_data(self, key, value, txdata=False): |
530 """set value associated to `key` in shared data |
535 """set value associated to `key` in shared data |
531 |
536 |
532 if `querydata` is true, the value will be added to the repository |
537 if `txdata` is true, the value will be added to the repository session's |
533 session's query data which are cleared on commit/rollback of the current |
538 transaction's data which are cleared on commit/rollback of the current |
534 transaction, and won't be available through the connexion, only on the |
539 transaction. |
535 repository side. |
|
536 """ |
540 """ |
537 if self._closed is not None: |
541 if self._closed is not None: |
538 raise ProgrammingError('Closed connection') |
542 raise ProgrammingError('Closed connection') |
539 return self._repo.set_shared_data(self.sessionid, key, value, querydata) |
543 return self._repo.set_shared_data(self.sessionid, key, value, txdata) |
540 |
544 |
541 def get_schema(self): |
545 def get_schema(self): |
542 """Return the schema currently used by the repository. |
546 """Return the schema currently used by the repository. |
543 |
547 |
544 This is NOT part of the DB-API. |
548 This is NOT part of the DB-API. |