Package Gnumed :: Package pycommon :: Module gmPG :: Class ConnectionPool
[frames] | no frames]

Class ConnectionPool

source code

maintains a static dictionary of available database connections

Instance Methods
 
__init__(self, login=None, encoding=None)
parameter login is of type gmLoginInfo.LoginInfo
source code
 
__del__(self) source code
 
GetConnection(self, service="default", readonly=1, encoding=None, extra_verbose=None)
Get a connection.
source code
 
ReleaseConnection(self, service)
decrease reference counter of active connection
source code
 
Connected(self) source code
 
get_connection_for_user(self, user=None, password=None, service="default", encoding=None, extra_verbose=None)
Get a connection for a given user.
source code
 
Listen(self, service, signal, callback)
Listen to 'signal' from backend in an asynchronous thread.
source code
 
Unlisten(self, service, signal, callback) source code
 
StopListener(self, service) source code
 
StopListeners(self) source code
 
GetAvailableServices(self)
list all distributed services available on this system (according to configuration database)
source code
 
GetLoginInfoFor(self, service, login=None)
return login information for a particular service
source code
Method Details

get_connection_for_user(self, user=None, password=None, service="default", encoding=None, extra_verbose=None)

source code 

Get a connection for a given user.

This will return a connection just as GetConnection() would except that the user to be used for authentication can be specified. All the other parameters are going to be the same, IOW it will connect to the same server, port and database as any other connection obtained through this broker.

You will have to specify the password, of course, if it is needed for PostgreSQL authentication.

This will always return a read-write connection.

Listen(self, service, signal, callback)

source code 

Listen to 'signal' from backend in an asynchronous thread.

If 'signal' is received from database 'service', activate the 'callback' function