server/sources/__init__.py
changeset 7398 26695dd703d8
parent 7342 d1c8b5b3531c
child 7514 32081892850e
equal deleted inserted replaced
7397:6a9e66d788b3 7398:26695dd703d8
   228         """open and return a connection to the source"""
   228         """open and return a connection to the source"""
   229         raise NotImplementedError()
   229         raise NotImplementedError()
   230 
   230 
   231     def check_connection(self, cnx):
   231     def check_connection(self, cnx):
   232         """Check connection validity, return None if the connection is still
   232         """Check connection validity, return None if the connection is still
   233         valid else a new connection (called when the pool using the given
   233         valid else a new connection (called when the connections set using the
   234         connection is being attached to a session). Do nothing by default.
   234         given connection is being attached to a session). Do nothing by default.
   235         """
   235         """
   236         pass
   236         pass
   237 
   237 
   238     def close_pool_connections(self):
   238     def close_source_connections(self):
   239         for pool in self.repo.pools:
   239         for cnxset in self.repo.cnxsets:
   240             pool._cursors.pop(self.uri, None)
   240             cnxset._cursors.pop(self.uri, None)
   241             pool.source_cnxs[self.uri][1].close()
   241             cnxset.source_cnxs[self.uri][1].close()
   242 
   242 
   243     def open_pool_connections(self):
   243     def open_source_connections(self):
   244         for pool in self.repo.pools:
   244         for cnxset in self.repo.cnxsets:
   245             pool.source_cnxs[self.uri] = (self, self.get_connection())
   245             cnxset.source_cnxs[self.uri] = (self, self.get_connection())
   246 
   246 
   247     def pool_reset(self, cnx):
   247     def cnxset_freed(self, cnx):
   248         """the pool using the given connection is being reseted from its current
   248         """the connections set holding the given connection is being reseted
   249         attached session
   249         from its current attached session.
   250 
   250 
   251         do nothing by default
   251         do nothing by default
   252         """
   252         """
   253         pass
   253         pass
   254 
   254 
   402         table (on-the-fly if possible, eg for the system source whose the given
   402         table (on-the-fly if possible, eg for the system source whose the given
   403         cursor come from). If not possible, inserts all data by calling
   403         cursor come from). If not possible, inserts all data by calling
   404         .executemany().
   404         .executemany().
   405         """
   405         """
   406         res = self.syntax_tree_search(session, union, args, varmap=varmap)
   406         res = self.syntax_tree_search(session, union, args, varmap=varmap)
   407         session.pool.source('system').manual_insert(res, table, session)
   407         session.cnxset.source('system').manual_insert(res, table, session)
   408 
   408 
   409     # write modification api ###################################################
   409     # write modification api ###################################################
   410     # read-only sources don't have to implement methods below
   410     # read-only sources don't have to implement methods below
   411 
   411 
   412     def get_extid(self, entity):
   412     def get_extid(self, entity):