Package com.ibatis.common.jdbc
Class SimpleDataSource.SimplePooledConnection
java.lang.Object
com.ibatis.common.jdbc.SimpleDataSource.SimplePooledConnection
- All Implemented Interfaces:
InvocationHandler
- Enclosing class:
- SimpleDataSource
public static class SimpleDataSource.SimplePooledConnection
extends Object
implements InvocationHandler
--------------------------------------------------------------------------------------- SimplePooledConnection
---------------------------------------------------------------------------------------.
-
Constructor Summary
ConstructorDescriptionSimplePooledConnection
(Connection connection, SimpleDataSource dataSource) Constructor for SimplePooledConnection that uses the Connection and SimpleDataSource passed in. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear warnings.void
close()
Close.void
commit()
Commit.Creates the statement.createStatement
(int resultSetType, int resultSetConcurrency) Creates the statement.createStatement
(int resultSetType, int resultSetConcurrency, int resultSetHoldability) Creates the statement.boolean
Allows comparing this connection to anotherlong
getAge()
Getter for the age of the connection.boolean
Gets the auto commit.Gets the catalog.long
Getter for the time that this connection has been checked out.long
Getter for the timestamp that this connection was checked out.int
Getter for the connection type (based on url + user + password).long
Getter for the time that the connection was created.int
Gets the holdability.long
Getter for the time that the connection was last used.Gets the meta data.Getter for the proxy for the connection.Getter for the *real* connection that this wraps.int
Gets the hashcode of the real connection (or 0 if it is null).long
Getter for the time since this connection was last used.int
Gets the transaction isolation.Gets the type map.Gets the warnings.int
hashCode()
void
Invalidates the connection.Required for InvocationHandler implementation.boolean
isClosed()
Checks if is closed.boolean
Checks if is read only.boolean
isValid()
Method to see if the connection is usable.Native SQL.prepareCall
(String sql) Prepare call.prepareCall
(String sql, int resultSetType, int resultSetConcurrency) Prepare call.prepareCall
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) Prepare call.prepareStatement
(String sql) Prepare statement.prepareStatement
(String sql, int autoGeneratedKeys) Prepare statement.prepareStatement
(String sql, int[] columnIndexes) Prepare statement.prepareStatement
(String sql, int resultSetType, int resultSetConcurrency) Prepare statement.prepareStatement
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) Prepare statement.prepareStatement
(String sql, String[] columnNames) Prepare statement.void
releaseSavepoint
(Savepoint savepoint) Release savepoint.void
rollback()
Rollback.void
Rollback.void
setAutoCommit
(boolean autoCommit) Sets the auto commit.void
setCatalog
(String catalog) Sets the catalog.void
setCheckoutTimestamp
(long timestamp) Setter for the timestamp that this connection was checked out.void
setConnectionTypeCode
(int connectionTypeCode) Setter for the connection type.void
setCreatedTimestamp
(long createdTimestamp) Setter for the time that the connection was created.void
setHoldability
(int holdability) Sets the holdability.void
setLastUsedTimestamp
(long lastUsedTimestamp) Setter for the time that the connection was last used.void
setReadOnly
(boolean readOnly) Sets the read only.Sets the savepoint.setSavepoint
(String name) Sets the savepoint.void
setTransactionIsolation
(int level) Sets the transaction isolation.void
setTypeMap
(Map map) Sets the type map.
-
Constructor Details
-
SimplePooledConnection
Constructor for SimplePooledConnection that uses the Connection and SimpleDataSource passed in.- Parameters:
connection
- - the connection that is to be presented as a pooled connectiondataSource
- - the dataSource that the connection is from
-
-
Method Details
-
invalidate
public void invalidate()Invalidates the connection. -
isValid
public boolean isValid()Method to see if the connection is usable.- Returns:
- True if the connection is usable
-
getRealConnection
Getter for the *real* connection that this wraps.- Returns:
- The connection
-
getProxyConnection
Getter for the proxy for the connection.- Returns:
- The proxy
-
getRealHashCode
public int getRealHashCode()Gets the hashcode of the real connection (or 0 if it is null).- Returns:
- The hashcode of the real connection (or 0 if it is null)
-
getConnectionTypeCode
public int getConnectionTypeCode()Getter for the connection type (based on url + user + password).- Returns:
- The connection type
-
setConnectionTypeCode
public void setConnectionTypeCode(int connectionTypeCode) Setter for the connection type.- Parameters:
connectionTypeCode
- - the connection type
-
getCreatedTimestamp
public long getCreatedTimestamp()Getter for the time that the connection was created.- Returns:
- The creation timestamp
-
setCreatedTimestamp
public void setCreatedTimestamp(long createdTimestamp) Setter for the time that the connection was created.- Parameters:
createdTimestamp
- - the timestamp
-
getLastUsedTimestamp
public long getLastUsedTimestamp()Getter for the time that the connection was last used.- Returns:
- - the timestamp
-
setLastUsedTimestamp
public void setLastUsedTimestamp(long lastUsedTimestamp) Setter for the time that the connection was last used.- Parameters:
lastUsedTimestamp
- - the timestamp
-
getTimeElapsedSinceLastUse
public long getTimeElapsedSinceLastUse()Getter for the time since this connection was last used.- Returns:
- - the time since the last use
-
getAge
public long getAge()Getter for the age of the connection.- Returns:
- the age
-
getCheckoutTimestamp
public long getCheckoutTimestamp()Getter for the timestamp that this connection was checked out.- Returns:
- the timestamp
-
setCheckoutTimestamp
public void setCheckoutTimestamp(long timestamp) Setter for the timestamp that this connection was checked out.- Parameters:
timestamp
- the timestamp
-
getCheckoutTime
public long getCheckoutTime()Getter for the time that this connection has been checked out.- Returns:
- the time
-
hashCode
public int hashCode() -
equals
Allows comparing this connection to another -
invoke
Required for InvocationHandler implementation.- Specified by:
invoke
in interfaceInvocationHandler
- Parameters:
proxy
- - not usedmethod
- - the method to be executedargs
- - the parameters to be passed to the method- Throws:
Throwable
- See Also:
-
createStatement
Creates the statement.- Returns:
- the statement
- Throws:
SQLException
- the SQL exception
-
prepareStatement
Prepare statement.- Parameters:
sql
- the sql- Returns:
- the prepared statement
- Throws:
SQLException
- the SQL exception
-
prepareCall
Prepare call.- Parameters:
sql
- the sql- Returns:
- the callable statement
- Throws:
SQLException
- the SQL exception
-
nativeSQL
Native SQL.- Parameters:
sql
- the sql- Returns:
- the string
- Throws:
SQLException
- the SQL exception
-
setAutoCommit
Sets the auto commit.- Parameters:
autoCommit
- the new auto commit- Throws:
SQLException
- the SQL exception
-
getAutoCommit
Gets the auto commit.- Returns:
- the auto commit
- Throws:
SQLException
- the SQL exception
-
commit
Commit.- Throws:
SQLException
- the SQL exception
-
rollback
Rollback.- Throws:
SQLException
- the SQL exception
-
close
Close.- Throws:
SQLException
- the SQL exception
-
isClosed
Checks if is closed.- Returns:
- true, if is closed
- Throws:
SQLException
- the SQL exception
-
getMetaData
Gets the meta data.- Returns:
- the meta data
- Throws:
SQLException
- the SQL exception
-
setReadOnly
Sets the read only.- Parameters:
readOnly
- the new read only- Throws:
SQLException
- the SQL exception
-
isReadOnly
Checks if is read only.- Returns:
- true, if is read only
- Throws:
SQLException
- the SQL exception
-
setCatalog
Sets the catalog.- Parameters:
catalog
- the new catalog- Throws:
SQLException
- the SQL exception
-
getCatalog
Gets the catalog.- Returns:
- the catalog
- Throws:
SQLException
- the SQL exception
-
setTransactionIsolation
Sets the transaction isolation.- Parameters:
level
- the new transaction isolation- Throws:
SQLException
- the SQL exception
-
getTransactionIsolation
Gets the transaction isolation.- Returns:
- the transaction isolation
- Throws:
SQLException
- the SQL exception
-
getWarnings
Gets the warnings.- Returns:
- the warnings
- Throws:
SQLException
- the SQL exception
-
clearWarnings
Clear warnings.- Throws:
SQLException
- the SQL exception
-
createStatement
Creates the statement.- Parameters:
resultSetType
- the result set typeresultSetConcurrency
- the result set concurrency- Returns:
- the statement
- Throws:
SQLException
- the SQL exception
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException Prepare statement.- Parameters:
sql
- the sqlresultSetType
- the result set typeresultSetConcurrency
- the result set concurrency- Returns:
- the prepared statement
- Throws:
SQLException
- the SQL exception
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException Prepare call.- Parameters:
sql
- the sqlresultSetType
- the result set typeresultSetConcurrency
- the result set concurrency- Returns:
- the callable statement
- Throws:
SQLException
- the SQL exception
-
getTypeMap
Gets the type map.- Returns:
- the type map
- Throws:
SQLException
- the SQL exception
-
setTypeMap
Sets the type map.- Parameters:
map
- the new type map- Throws:
SQLException
- the SQL exception
-
setHoldability
Sets the holdability.- Parameters:
holdability
- the new holdability- Throws:
SQLException
- the SQL exception
-
getHoldability
Gets the holdability.- Returns:
- the holdability
- Throws:
SQLException
- the SQL exception
-
setSavepoint
Sets the savepoint.- Returns:
- the savepoint
- Throws:
SQLException
- the SQL exception
-
setSavepoint
Sets the savepoint.- Parameters:
name
- the name- Returns:
- the savepoint
- Throws:
SQLException
- the SQL exception
-
rollback
Rollback.- Parameters:
savepoint
- the savepoint- Throws:
SQLException
- the SQL exception
-
releaseSavepoint
Release savepoint.- Parameters:
savepoint
- the savepoint- Throws:
SQLException
- the SQL exception
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException Creates the statement.- Parameters:
resultSetType
- the result set typeresultSetConcurrency
- the result set concurrencyresultSetHoldability
- the result set holdability- Returns:
- the statement
- Throws:
SQLException
- the SQL exception
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException Prepare statement.- Parameters:
sql
- the sqlresultSetType
- the result set typeresultSetConcurrency
- the result set concurrencyresultSetHoldability
- the result set holdability- Returns:
- the prepared statement
- Throws:
SQLException
- the SQL exception
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException Prepare call.- Parameters:
sql
- the sqlresultSetType
- the result set typeresultSetConcurrency
- the result set concurrencyresultSetHoldability
- the result set holdability- Returns:
- the callable statement
- Throws:
SQLException
- the SQL exception
-
prepareStatement
Prepare statement.- Parameters:
sql
- the sqlautoGeneratedKeys
- the auto generated keys- Returns:
- the prepared statement
- Throws:
SQLException
- the SQL exception
-
prepareStatement
Prepare statement.- Parameters:
sql
- the sqlcolumnIndexes
- the column indexes- Returns:
- the prepared statement
- Throws:
SQLException
- the SQL exception
-
prepareStatement
Prepare statement.- Parameters:
sql
- the sqlcolumnNames
- the column names- Returns:
- the prepared statement
- Throws:
SQLException
- the SQL exception
-