Home | Trees | Index | Help |
|
---|
Package twisted :: Package enterprise :: Module adbapi :: Class ConnectionPool |
|
I represent a pool of connections to a DB-API 2.0 compliant database.
You can pass cp_min, cp_max or both to set the minimum and maximum number of connections that will be opened by the pool. You can pass the noisy arg which determines whether informational log messages are generated during the pool's operation.Method Summary | |
---|---|
__init__(self,
dbapiName,
*connargs,
**connkw)
| |
__getstate__(self)
| |
__setstate__(self,
state)
| |
Internal function. | |
_runInteraction(self,
interaction,
*args,
**kw)
| |
_runOperation(self,
*args,
**kw)
| |
_runQuery(self,
*args,
**kw)
| |
Close all pool connections and shutdown the pool. | |
Return a database connection when one becomes available. | |
This should only be called by the shutdown trigger. | |
interaction(self,
interaction,
callback,
errback,
*args,
**kw)
| |
operation(self,
callback,
errback,
*args,
**kw)
| |
query(self,
callback,
errback,
*args,
**kw)
| |
Interact with the database and return the result. | |
Execute an SQL query and return None. | |
Execute an SQL query and return the result. | |
Start the connection pool. | |
synchronousOperation(self,
*args,
**kw)
|
Class Variable Summary | |
---|---|
int |
max = 5 |
int |
min = 3 |
int |
noisy = 1 |
int |
running = 0 |
Method Details |
---|
_deferToThread(self, f, *args, **kwargs)Internal function. Call f in one of the connection pool's threads. |
close(self)Close all pool connections and shutdown the pool. |
connect(self)Return a database connection when one becomes available. This method blocks and should be run in a thread from the internal threadpool. Don't call this method directly from non-threaded twisted code.
|
finalClose(self)This should only be called by the shutdown trigger. |
runInteraction(self, interaction, *args, **kw)Interact with the database and return the result. The 'interaction' is a callable object which will be executed in a
thread using a pooled connection. It will be passed an
|
runOperation(self, *args, **kw)Execute an SQL query and return None. A DB-API cursor will will be invoked with cursor.execute(*args, **kw). The exact nature of the arguments will depend on the specific flavor of DB-API being used, but the first argument in *args will be an SQL statement. This method will not attempt to fetch any results from the query and is thus suitable for INSERT, DELETE, and other SQL statements which do not return values. If the 'execute' method raises an exception, the transaction will be rolled back and a Failure returned. The args and kw arguments will be passed to the DB-API cursor's 'execute' method. return: a Deferred which will fire None or a Failure. |
runQuery(self, *args, **kw)Execute an SQL query and return the result. A DB-API cursor will will be invoked with cursor.execute(*args, **kw). The exact nature of the arguments will depend on the specific flavor of DB-API being used, but the first argument in *args be an SQL statement. The result of a subsequent cursor.fetchall() will be fired to the Deferred which is returned. If either the 'execute' or 'fetchall' methods raise an exception, the transaction will be rolled back and a Failure returned. The *args and **kw arguments will be passed to the DB-API cursor's 'execute' method.
|
start(self)Start the connection pool. If you are using the reactor normally, this function does *not* need to be called. |
Class Variable Details |
---|
max
|
min
|
noisy
|
running
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.0 on Sat May 15 20:08:48 2004 | http://epydoc.sf.net |