|
jacquard 1.12.0 by The Web Engineering Factory and Toolworks | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.co.weft.dbutil.ConnectionFish
A fish is something that swims in a pool, obviously. This is a connection which knows a bit about itself, enabling it to be reissued on request from a pool. The idea is that you should not create instances of this class directly, and you should not know that you've got one. Instead, you'll ask for connections from the pool, and when you've finished with them, release them back into the pool. You'll treat them as vanilla-flavoured java.sql.Connections. The pool won't tell you it's really giving you a fish.
A fish which is not returned to the pool will eventually be cleaned up by the SuckerFish; however, it's unwise to rely on this in situations where connections may be being requested in quick succession. For every call you make to ConnectionPool.getConnection() you should make a call to ConnectionPool.releaseConnection().
The Connection interface is implemented through a series of wrappers. Most of these are very simple for speed, but the key ones update the lastRequested date of the fish so that it stays alive.
ConnectionPool.getConnection(java.lang.String, java.lang.String, java.lang.String),
ConnectionPool.releaseConnection(java.sql.Connection)| Field Summary | |
protected java.util.Date |
lastRequested
the time when I was last asked to do anything |
protected java.util.Stack |
statements
My (potentially open) statements |
protected static int |
ttl
the time a fish is allowed to live after it was last used, in milliseconds. |
| Fields inherited from interface java.sql.Connection |
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
| Constructor Summary | |
protected |
ConnectionFish(java.lang.String db_url,
java.lang.String username,
java.lang.String password,
java.lang.Integer hash)
Spawn a new fish. |
| Method Summary | |
void |
clearWarnings()
a simple wrapper round clearWarnings |
void |
close()
close my real connection and remove me from the pool. |
void |
commit()
a simple wrapper round commit |
java.sql.Statement |
createStatement()
a wrapper round createStatement, simply to remind me I'm still alive |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
a wrapper round createStatement, simply to remind me I'm still alive |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
jdbc 3 methods; don't yet really know what they do so I'm just passing them through blindly. |
boolean |
getAutoCommit()
just pass it on ... |
java.lang.String |
getCatalog()
just pass it on ... |
int |
getHoldability()
jdbc 3 methods; don't yet really know what they do so I'm just passing them through blindly. |
java.sql.DatabaseMetaData |
getMetaData()
just pass it on ... |
int |
getTransactionIsolation()
just pass it on ... |
java.util.Map |
getTypeMap()
DOCUMENT ME! |
java.sql.SQLWarning |
getWarnings()
just pass it on ... |
boolean |
isClosed()
Whoops! Need to watch this one... |
boolean |
isReadOnly()
just pass it on ... |
java.lang.String |
nativeSQL(java.lang.String sql)
just pass it on ... |
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
just pass it on ... |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
just pass it on ... |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
jdbc 3 methods; don't yet really know what they do so I'm just passing them through blindly. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
just pass it on ... |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
jdbc 3 methods; don't yet really know what they do so I'm just passing them through blindly. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] columnIndexes)
jdbc 3 methods; don't yet really know what they do so I'm just passing them through blindly. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
just pass it on ... |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
jdbc 3 methods; don't yet really know what they do so I'm just passing them through blindly. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
jdbc 3 methods; don't yet really know what they do so I'm just passing them through blindly. |
void |
releaseSavepoint(java.sql.Savepoint savepoint)
jdbc 3 methods; don't yet really know what they do so I'm just passing them through blindly. |
void |
rollback()
just pass it on ... |
void |
rollback(java.sql.Savepoint savepoint)
jdbc 3 methods; don't yet really know what they do so I'm just passing them through blindly. |
void |
setAutoCommit(boolean autoCommit)
just pass it on ... |
void |
setCatalog(java.lang.String catalog)
just pass it on ... |
void |
setHoldability(int holdability)
jdbc 3 methods; don't yet really know what they do so I'm just passing them through blindly. |
void |
setReadOnly(boolean readOnly)
just pass it on ... |
java.sql.Savepoint |
setSavepoint()
jdbc 3 methods; don't yet really know what they do so I'm just passing them through blindly. |
java.sql.Savepoint |
setSavepoint(java.lang.String savepoint)
jdbc 3 methods; don't yet really know what they do so I'm just passing them through blindly. |
void |
setTransactionIsolation(int level)
Set transaction isolation; thanks to David Orr for this code |
void |
setTypeMap(java.util.Map map)
just pass it on ... |
protected int |
unused()
how many milliseconds is it since I was last used? |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final int ttl
protected java.util.Date lastRequested
protected java.util.Stack statements
| Constructor Detail |
protected ConnectionFish(java.lang.String db_url,
java.lang.String username,
java.lang.String password,
java.lang.Integer hash)
throws DataStoreException
| Method Detail |
public void setAutoCommit(boolean autoCommit)
throws java.sql.SQLException
setAutoCommit in interface java.sql.Connectionjava.sql.SQLException
public boolean getAutoCommit()
throws java.sql.SQLException
getAutoCommit in interface java.sql.Connectionjava.sql.SQLException
public void setCatalog(java.lang.String catalog)
throws java.sql.SQLException
setCatalog in interface java.sql.Connectionjava.sql.SQLException
public java.lang.String getCatalog()
throws java.sql.SQLException
getCatalog in interface java.sql.Connectionjava.sql.SQLException
public boolean isClosed()
throws java.sql.SQLException
isClosed in interface java.sql.Connectionjava.sql.SQLException
public void setHoldability(int holdability)
throws java.sql.SQLException
setHoldability in interface java.sql.Connectionjava.sql.SQLException
public int getHoldability()
throws java.sql.SQLException
getHoldability in interface java.sql.Connectionjava.sql.SQLException
public java.sql.DatabaseMetaData getMetaData()
throws java.sql.SQLException
getMetaData in interface java.sql.Connectionjava.sql.SQLException
public void setReadOnly(boolean readOnly)
throws java.sql.SQLException
setReadOnly in interface java.sql.Connectionjava.sql.SQLException
public boolean isReadOnly()
throws java.sql.SQLException
isReadOnly in interface java.sql.Connectionjava.sql.SQLException
public java.sql.Savepoint setSavepoint()
throws java.sql.SQLException
setSavepoint in interface java.sql.Connectionjava.sql.SQLException
public java.sql.Savepoint setSavepoint(java.lang.String savepoint)
throws java.sql.SQLException
setSavepoint in interface java.sql.Connectionjava.sql.SQLException
public void setTransactionIsolation(int level)
throws java.sql.SQLException
setTransactionIsolation in interface java.sql.Connectionjava.sql.SQLException
public int getTransactionIsolation()
throws java.sql.SQLException
getTransactionIsolation in interface java.sql.Connectionjava.sql.SQLException
public void setTypeMap(java.util.Map map)
throws java.sql.SQLException
setTypeMap in interface java.sql.Connectionjava.sql.SQLException
public java.util.Map getTypeMap()
throws java.sql.SQLException
getTypeMap in interface java.sql.Connectionjava.sql.SQLException - DOCUMENT ME!
public java.sql.SQLWarning getWarnings()
throws java.sql.SQLException
getWarnings in interface java.sql.Connectionjava.sql.SQLException
public void clearWarnings()
throws java.sql.SQLException
clearWarnings in interface java.sql.Connectionjava.sql.SQLException
public void close()
throws java.sql.SQLException
close in interface java.sql.Connectionjava.sql.SQLException
public void commit()
throws java.sql.SQLException
commit in interface java.sql.Connectionjava.sql.SQLException
public java.sql.Statement createStatement()
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLExceptionConnection.createStatement()
public java.sql.Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLExceptionConnection.createStatement(int, int)
public java.sql.Statement createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLException
public java.lang.String nativeSQL(java.lang.String sql)
throws java.sql.SQLException
nativeSQL in interface java.sql.Connectionjava.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int[] columnIndexes)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLException
public void releaseSavepoint(java.sql.Savepoint savepoint)
throws java.sql.SQLException
releaseSavepoint in interface java.sql.Connectionjava.sql.SQLException
public void rollback()
throws java.sql.SQLException
rollback in interface java.sql.Connectionjava.sql.SQLException
public void rollback(java.sql.Savepoint savepoint)
throws java.sql.SQLException
rollback in interface java.sql.Connectionjava.sql.SQLExceptionprotected int unused()
|
jacquard 1.12.0 by The Web Engineering Factory and Toolworks | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||