com.partnersoft.sql
Class SqlPreparedStatementManager<T>

java.lang.Object
  extended by com.partnersoft.sql.SqlPreparedStatementManager<T>

public class SqlPreparedStatementManager<T>
extends java.lang.Object

Caches and manages SqlPreparedStatements using some unique key.

Note that it uses HashMaps internally for speed so String comparisons will be case-sensitive on keys and text (e.g., if you use the SQL itself as a key).

Copyright 2009 Partner Software, Inc.

Version:
$Id$
Author:
Paul Reavis

Constructor Summary
SqlPreparedStatementManager(SqlConnection connection)
           
 
Method Summary
 SqlPreparedStatement createStatement(T key, java.lang.String sql, java.util.List<java.lang.String> values)
           
 void removeAll()
           
 void removeStatementFor(T key)
          Closes and removes a statement.
 boolean statementExistsFor(T key)
           
 SqlPreparedStatement statementFor(T key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlPreparedStatementManager

public SqlPreparedStatementManager(SqlConnection connection)
Method Detail

statementExistsFor

public boolean statementExistsFor(T key)

statementFor

public SqlPreparedStatement statementFor(T key)

createStatement

public SqlPreparedStatement createStatement(T key,
                                            java.lang.String sql,
                                            java.util.List<java.lang.String> values)
                                     throws java.sql.SQLException
Throws:
java.sql.SQLException

removeStatementFor

public void removeStatementFor(T key)
                        throws java.sql.SQLException
Closes and removes a statement.

Parameters:
key -
Throws:
java.sql.SQLException

removeAll

public void removeAll()
               throws java.sql.SQLException
Throws:
java.sql.SQLException