public class ConnectionWrapper
extends java.lang.Object
implements java.lang.AutoCloseable
java.sql.Connection的包装类,包装所有检查异常(SQLEception)为非检查异常(JdbcException)
| 构造器和说明 |
|---|
ConnectionWrapper(java.sql.Connection connection)
Instantiates a new connection wrapper.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clearWarnings()
Clear warnings.
|
void |
close()
Close.
|
void |
commit()
Commit.
|
java.sql.Array |
createArrayOf(java.lang.String typeName,
java.lang.Object[] elements)
Creates the array of.
|
java.sql.Blob |
createBlob()
Creates the blob.
|
java.sql.Clob |
createClob()
Creates the clob.
|
java.sql.NClob |
createNClob()
Creates the N clob.
|
java.sql.SQLXML |
createSQLXML()
Creates the SQLXML.
|
StatementWrapper |
createStatement()
Creates the statement.
|
StatementWrapper |
createStatement(int resultSetType,
int resultSetConcurrency)
Creates the statement.
|
StatementWrapper |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Creates the statement.
|
java.sql.Struct |
createStruct(java.lang.String typeName,
java.lang.Object[] attributes)
Creates the struct.
|
boolean |
getAutoCommit()
Gets the auto commit.
|
java.lang.String |
getCatalog()
Gets the catalog.
|
java.util.Properties |
getClientInfo()
Gets the client info.
|
java.lang.String |
getClientInfo(java.lang.String name)
Gets the client info.
|
java.sql.Connection |
getConnection()
Gets the connection.
|
int |
getHoldability()
Gets the holdability.
|
java.sql.DatabaseMetaData |
getMetaData()
Gets the meta data.
|
int |
getTransactionIsolation()
Gets the transaction isolation.
|
java.util.Map<java.lang.String,java.lang.Class<?>> |
getTypeMap()
Gets the type map.
|
java.sql.SQLWarning |
getWarnings()
Gets the warnings.
|
boolean |
isClosed()
Checks if is closed.
|
boolean |
isReadOnly()
Checks if is read only.
|
boolean |
isValid(int timeout)
Checks if is valid.
|
boolean |
isWrapperFor(java.lang.Class<?> iface)
Checks if is wrapper for.
|
java.lang.String |
nativeSQL(java.lang.String sql)
Native SQL.
|
CallableStatementWrapper |
prepareCall(java.lang.String sql)
Prepare call.
|
CallableStatementWrapper |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Prepare call.
|
CallableStatementWrapper |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Prepare call.
|
PreparedStatementWrapper |
prepareStatement(java.lang.String sql)
Prepare statement.
|
PreparedStatementWrapper |
prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
Prepare statement.
|
PreparedStatementWrapper |
prepareStatement(java.lang.String sql,
int[] columnIndexes)
Prepare statement.
|
PreparedStatementWrapper |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Prepare statement.
|
PreparedStatementWrapper |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Prepare statement.
|
PreparedStatementWrapper |
prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
Prepare statement.
|
void |
releaseSavepoint(java.sql.Savepoint savepoint)
Release savepoint.
|
void |
rollback()
Rollback.
|
void |
rollback(java.sql.Savepoint savepoint)
Rollback.
|
void |
setAutoCommit(boolean autoCommit)
Sets the auto commit.
|
void |
setCatalog(java.lang.String catalog)
Sets the catalog.
|
void |
setClientInfo(java.util.Properties properties)
Sets the client info.
|
void |
setClientInfo(java.lang.String name,
java.lang.String value)
Sets the client info.
|
void |
setHoldability(int holdability)
Sets the holdability.
|
void |
setReadOnly(boolean readOnly)
Sets the read only.
|
java.sql.Savepoint |
setSavepoint()
Sets the savepoint.
|
java.sql.Savepoint |
setSavepoint(java.lang.String name)
Sets the savepoint.
|
void |
setTransactionIsolation(int level)
Sets the transaction isolation.
|
void |
setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map)
Sets the type map.
|
<T> T |
unwrap(java.lang.Class<T> iface)
Unwrap.
|
public ConnectionWrapper(java.sql.Connection connection)
connection - the connectionpublic void clearWarnings()
Connectionpublic void close()
close 在接口中 java.lang.AutoCloseableConnectionpublic void commit()
Connectionpublic java.sql.Array createArrayOf(java.lang.String typeName,
java.lang.Object[] elements)
throws java.sql.SQLException
typeName - the type nameelements - the elementsjava.sql.SQLException - the SQL exceptionConnectionpublic java.sql.Blob createBlob()
Connectionpublic java.sql.Clob createClob()
Connectionpublic java.sql.NClob createNClob()
Connectionpublic java.sql.SQLXML createSQLXML()
Connectionpublic StatementWrapper createStatement()
Connectionpublic StatementWrapper createStatement(int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
resultSetType - the result set typeresultSetConcurrency - the result set concurrencyjava.sql.SQLException - the SQL exceptionConnectionpublic StatementWrapper createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
resultSetType - the result set typeresultSetConcurrency - the result set concurrencyresultSetHoldability - the result set holdabilityjava.sql.SQLException - the SQL exceptionConnectionpublic java.sql.Struct createStruct(java.lang.String typeName,
java.lang.Object[] attributes)
throws java.sql.SQLException
typeName - the type nameattributes - the attributesjava.sql.SQLException - the SQL exceptionConnectionpublic boolean getAutoCommit()
Connectionpublic java.lang.String getCatalog()
Connectionpublic java.util.Properties getClientInfo()
Connectionpublic java.lang.String getClientInfo(java.lang.String name)
name - the nameConnectionpublic int getHoldability()
Connectionpublic java.sql.DatabaseMetaData getMetaData()
Connectionpublic int getTransactionIsolation()
Connectionpublic java.util.Map<java.lang.String,java.lang.Class<?>> getTypeMap()
Connectionpublic java.sql.SQLWarning getWarnings()
Connectionpublic boolean isClosed()
Connectionpublic boolean isReadOnly()
Connectionpublic boolean isValid(int timeout)
timeout - the timeoutConnectionpublic java.lang.String nativeSQL(java.lang.String sql)
sql - the sqlConnectionpublic CallableStatementWrapper prepareCall(java.lang.String sql)
sql - the sqlConnectionpublic CallableStatementWrapper prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)
sql - the sqlresultSetType - the result set typeresultSetConcurrency - the result set concurrencyConnectionpublic CallableStatementWrapper prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
sql - the sqlresultSetType - the result set typeresultSetConcurrency - the result set concurrencyresultSetHoldability - the result set holdabilityConnectionpublic PreparedStatementWrapper prepareStatement(java.lang.String sql)
sql - the sqlConnectionpublic PreparedStatementWrapper prepareStatement(java.lang.String sql, int autoGeneratedKeys)
sql - the sqlautoGeneratedKeys - the auto generated keysConnectionpublic PreparedStatementWrapper prepareStatement(java.lang.String sql, int[] columnIndexes)
sql - the sqlcolumnIndexes - the column indexesConnectionpublic PreparedStatementWrapper prepareStatement(java.lang.String sql, java.lang.String[] columnNames)
sql - the sqlcolumnNames - the column namesConnectionpublic PreparedStatementWrapper prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
sql - the sqlresultSetType - the result set typeresultSetConcurrency - the result set concurrencyConnectionpublic PreparedStatementWrapper prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
sql - the sqlresultSetType - the result set typeresultSetConcurrency - the result set concurrencyresultSetHoldability - the result set holdabilityConnectionpublic void releaseSavepoint(java.sql.Savepoint savepoint)
savepoint - the savepointConnectionpublic void rollback()
Connectionpublic void rollback(java.sql.Savepoint savepoint)
savepoint - the savepointConnectionpublic void setAutoCommit(boolean autoCommit)
autoCommit - the new auto commitConnectionpublic void setCatalog(java.lang.String catalog)
catalog - the new catalogConnectionpublic void setClientInfo(java.util.Properties properties)
properties - the new client infoConnectionpublic void setClientInfo(java.lang.String name,
java.lang.String value)
throws java.sql.SQLClientInfoException
name - the namevalue - the valuejava.sql.SQLClientInfoException - the SQL client info exceptionConnectionpublic void setHoldability(int holdability)
holdability - the new holdabilityConnectionpublic void setReadOnly(boolean readOnly)
readOnly - the new read onlyConnectionpublic java.sql.Savepoint setSavepoint()
Connectionpublic java.sql.Savepoint setSavepoint(java.lang.String name)
name - the nameConnectionpublic void setTransactionIsolation(int level)
level - the new transaction isolationConnectionpublic void setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map)
map - the mapConnectionpublic boolean isWrapperFor(java.lang.Class<?> iface)
iface - the ifaceConnectionpublic <T> T unwrap(java.lang.Class<T> iface)
T - the generic typeiface - the ifaceConnectionpublic java.sql.Connection getConnection()