450 #: connection unique id |
450 #: connection unique id |
451 self._open = None |
451 self._open = None |
452 if cnxid is None: |
452 if cnxid is None: |
453 cnxid = '%s-%s' % (session.id, uuid4().hex) |
453 cnxid = '%s-%s' % (session.id, uuid4().hex) |
454 self.connectionid = cnxid |
454 self.connectionid = cnxid |
|
455 self.sessionid = session.id |
455 #: self._session_handled |
456 #: self._session_handled |
456 #: are the life cycle of this Connection automatically controlled by the |
457 #: are the life cycle of this Connection automatically controlled by the |
457 #: Session This is the old backward compatibility mode |
458 #: Session This is the old backward compatibility mode |
458 self._session_handled = session_handled |
459 self._session_handled = session_handled |
459 #: reentrance handling |
460 #: reentrance handling |
786 rset = rset.copy() |
787 rset = rset.copy() |
787 entities = list(entities) |
788 entities = list(entities) |
788 rset.rows.append([targeteid]) |
789 rset.rows.append([targeteid]) |
789 if not isinstance(rset.description, list): # else description not set |
790 if not isinstance(rset.description, list): # else description not set |
790 rset.description = list(rset.description) |
791 rset.description = list(rset.description) |
791 rset.description.append([self.describe(targeteid)[0]]) |
792 rset.description.append([self.entity_metas(targeteid)['type']]) |
792 targetentity = self.entity_from_eid(targeteid) |
793 targetentity = self.entity_from_eid(targeteid) |
793 if targetentity.cw_rset is None: |
794 if targetentity.cw_rset is None: |
794 targetentity.cw_rset = rset |
795 targetentity.cw_rset = rset |
795 targetentity.cw_row = rset.rowcount |
796 targetentity.cw_row = rset.rowcount |
796 targetentity.cw_col = 0 |
797 targetentity.cw_col = 0 |
979 |
980 |
980 @_open_only |
981 @_open_only |
981 def source_defs(self): |
982 def source_defs(self): |
982 return self.repo.source_defs() |
983 return self.repo.source_defs() |
983 |
984 |
|
985 @deprecated('[3.19] use .entity_metas(eid) instead') |
984 @_with_cnx_set |
986 @_with_cnx_set |
985 @_open_only |
987 @_open_only |
986 def describe(self, eid, asdict=False): |
988 def describe(self, eid, asdict=False): |
987 """return a tuple (type, sourceuri, extid) for the entity with id <eid>""" |
989 """return a tuple (type, sourceuri, extid) for the entity with id <eid>""" |
988 metas = self.repo.type_and_source_from_eid(eid, self) |
990 etype, extid, source = self.repo.type_and_source_from_eid(eid, self) |
|
991 metas = {'type': etype, 'source': source, 'extid': extid} |
989 if asdict: |
992 if asdict: |
990 return dict(zip(('type', 'source', 'extid', 'asource'), metas)) |
993 metas['asource'] = meta['source'] # XXX pre 3.19 client compat |
991 # XXX :-1 for cw compat, use asdict=True for full information |
994 return meta |
992 return metas[:-1] |
995 return etype, source, extid |
993 |
996 |
994 @_with_cnx_set |
997 @_with_cnx_set |
995 @_open_only |
998 @_open_only |
996 def source_from_eid(self, eid): |
999 def entity_metas(self, eid): |
997 """return the source where the entity with id <eid> is located""" |
1000 """return a tuple (type, sourceuri, extid) for the entity with id <eid>""" |
998 return self.repo.source_from_eid(eid, self) |
1001 etype, extid, source = self.repo.type_and_source_from_eid(eid, self) |
|
1002 return {'type': etype, 'source': source, 'extid': extid} |
999 |
1003 |
1000 # core method ############################################################# |
1004 # core method ############################################################# |
1001 |
1005 |
1002 @_with_cnx_set |
1006 @_with_cnx_set |
1003 @_open_only |
1007 @_open_only |
1587 entity_cache = cnx_meth('entity_cache') |
1591 entity_cache = cnx_meth('entity_cache') |
1588 cache_entities = cnx_meth('cached_entities') |
1592 cache_entities = cnx_meth('cached_entities') |
1589 drop_entity_cache = cnx_meth('drop_entity_cache') |
1593 drop_entity_cache = cnx_meth('drop_entity_cache') |
1590 |
1594 |
1591 source_defs = cnx_meth('source_defs') |
1595 source_defs = cnx_meth('source_defs') |
1592 describe = cnx_meth('describe') |
1596 entity_metas = cnx_meth('entity_metas') |
1593 source_from_eid = cnx_meth('source_from_eid') |
1597 describe = cnx_meth('describe') # XXX deprecated in 3.19 |
1594 |
1598 |
1595 |
1599 |
1596 @deprecated('[3.19] use a Connection object instead') |
1600 @deprecated('[3.19] use a Connection object instead') |
1597 def execute(self, *args, **kwargs): |
1601 def execute(self, *args, **kwargs): |
1598 """db-api like method directly linked to the querier execute method. |
1602 """db-api like method directly linked to the querier execute method. |