|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--planetj.dataengine.cache.PreparedStatementManager
Manages prepared statements for a pool of connections. When a user needs a connection to run a prepared statement, this class tries to give that user a connection which already contains the prepared statement. If no such connections are available, then this class tries to give the user the connection in the pool which has the fewest number of prepared statements.
Constructor Summary | |
PreparedStatementManager(DataEngineConnectionPool pPool)
PreparedStatementManager constructor comment. |
Method Summary | |
void |
addConnection(DataEngineConnection conn)
Adds a connection to the list of connections whose prepared statements are managed |
Connection |
getConnection(String sql)
Gets a Connection. |
void |
registerPreparedStatement(String sql,
DataEngineConnection connection,
boolean creation,
boolean resort)
Registers a relationship between a prepared statement and a connection. |
void |
removeConnection(DataEngineConnection conn)
Removes a connection from the list of connections whose prepared statements are managed |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PreparedStatementManager(DataEngineConnectionPool pPool)
Method Detail |
public void addConnection(DataEngineConnection conn)
public Connection getConnection(String sql) throws DataEngineException
sql
- An SQL statement for which a prepared statement should be created.
DataEngineException
public void registerPreparedStatement(String sql, DataEngineConnection connection, boolean creation, boolean resort)
sql
- The sql String from which the statement was preparedconnection
- The connection in which the statement was preparedcreation
- If this is true, it means the statement was just prepared, and we need to
associate it with the connection. If this is false, it means the prepared statement was just
removed from the connection, and we should remove the association between the two.resort
- If this is true, the ordered List of Connections will be resorted. In general, this
should usually be true, unless this method is being invoked multiple times, in which case the List
only needs to be resorted the last time.public void removeConnection(DataEngineConnection conn)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |