|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.melati.poem.util.CachedIndexFactory
org.melati.poem.PreparedStatementFactory
public class PreparedStatementFactory
Maintains a cache of PreparedStatements for an SQL
statement string.
The cached contents are discarded if the database structure has changed since the cache was created.
Execution of the statement in a transaction reflects uncommitted changes in that transaction.
The supertype dictates that connections can be indentified by index, but this is slightly complicated and the additional methods rely on transactions instead.
| Constructor Summary | |
|---|---|
PreparedStatementFactory(Database database,
String sql)
Constructor. |
|
| Method Summary | |
|---|---|
Object |
get(int index)
Get either from cache or, failing that, really get it. |
PreparedStatement |
preparedStatement()
|
PreparedStatement |
preparedStatement(PoemTransaction transaction)
Get a new or cached PreparedStatement. |
protected Object |
reallyGet(int index)
Obtain a fresh PreparedStatement for a connection
identified by an index. |
ResultSet |
resultSet()
|
protected ResultSet |
resultSet(SessionToken token)
|
protected ResultSet |
resultSet(SessionToken token,
PreparedStatement statement)
|
String |
toString()
|
| Methods inherited from class org.melati.poem.util.CachedIndexFactory |
|---|
invalidate, invalidate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PreparedStatementFactory(Database database,
String sql)
database - the db we are working withsql - the SQL statement| Method Detail |
|---|
protected Object reallyGet(int index)
PreparedStatement for a connection
identified by an index.
The index is zero for the commited connection and the transaction index plus 1 for current transactions.
reallyGet in class CachedIndexFactoryindex - of the item, possibly a troid
public Object get(int index)
get in interface IndexFactoryget in class CachedIndexFactoryindex - the index
CachedIndexFactory.get(int)public PreparedStatement preparedStatement(PoemTransaction transaction)
transaction - the PoemTransaction, can be null
public final PreparedStatement preparedStatement()
protected ResultSet resultSet(SessionToken token,
PreparedStatement statement)
protected final ResultSet resultSet(SessionToken token)
public final ResultSet resultSet()
public String toString()
toString in class ObjectObject.toString()
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||