public class PreparedStatementWrapper
extends java.lang.Object
implements java.lang.AutoCloseable
java.sql.PreparedStatement的包装类,包装所有检查异常(SQLEception)为非检查异常(JdbcException)
| 构造器和说明 |
|---|
PreparedStatementWrapper(java.sql.PreparedStatement preparedStatement,
ConnectionWrapper connectionWrapper)
Instantiates a new prepared statement wrapper.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addBatch()
Adds the batch.
|
void |
addBatch(java.lang.String sql)
Adds the batch.
|
void |
cancel()
Cancel.
|
void |
clearBatch()
Clear batch.
|
void |
clearParameters()
Clear parameters.
|
void |
clearWarnings()
Clear warnings.
|
void |
close()
Close.
|
boolean |
execute()
Execute.
|
boolean |
execute(java.lang.String sql)
Execute.
|
boolean |
execute(java.lang.String sql,
int autoGeneratedKeys)
Execute.
|
boolean |
execute(java.lang.String sql,
int[] columnIndexes)
Execute.
|
boolean |
execute(java.lang.String sql,
java.lang.String[] columnNames)
Execute.
|
int[] |
executeBatch()
Execute batch.
|
ResultSetWrapper |
executeQuery()
Execute query.
|
ResultSetWrapper |
executeQuery(java.lang.String sql)
Execute query.
|
int |
executeUpdate()
Execute update.
|
int |
executeUpdate(java.lang.String sql)
Execute update.
|
int |
executeUpdate(java.lang.String sql,
int autoGeneratedKeys)
Execute update.
|
int |
executeUpdate(java.lang.String sql,
int[] columnIndexes)
Execute update.
|
int |
executeUpdate(java.lang.String sql,
java.lang.String[] columnNames)
Execute update.
|
ConnectionWrapper |
getConnection()
Gets the connection.
|
int |
getFetchDirection()
Gets the fetch direction.
|
int |
getFetchSize()
Gets the fetch size.
|
ResultSetWrapper |
getGeneratedKeys()
Gets the generated keys.
|
int |
getMaxFieldSize()
Gets the max field size.
|
int |
getMaxRows()
Gets the max rows.
|
java.sql.ResultSetMetaData |
getMetaData()
Gets the meta data.
|
boolean |
getMoreResults()
Gets the more results.
|
boolean |
getMoreResults(int current)
Gets the more results.
|
java.sql.ParameterMetaData |
getParameterMetaData()
Gets the parameter meta data.
|
java.sql.PreparedStatement |
getPreparedStatement()
Gets the prepared statement.
|
int |
getQueryTimeout()
Gets the query timeout.
|
ResultSetWrapper |
getResultSet()
Gets the result set.
|
int |
getResultSetConcurrency()
Gets the result set concurrency.
|
int |
getResultSetHoldability()
Gets the result set holdability.
|
int |
getResultSetType()
Gets the result set type.
|
int |
getUpdateCount()
Gets the update count.
|
java.sql.SQLWarning |
getWarnings()
Gets the warnings.
|
boolean |
isClosed()
Checks if is closed.
|
boolean |
isPoolable()
Checks if is poolable.
|
boolean |
isWrapperFor(java.lang.Class<?> iface)
Checks if is wrapper for.
|
void |
setArray(int parameterIndex,
java.sql.Array x)
Sets the array.
|
void |
setAsciiStream(int parameterIndex,
java.io.InputStream x)
Sets the ascii stream.
|
void |
setAsciiStream(int parameterIndex,
java.io.InputStream x,
int length)
Sets the ascii stream.
|
void |
setAsciiStream(int parameterIndex,
java.io.InputStream x,
long length)
Sets the ascii stream.
|
void |
setBigDecimal(int parameterIndex,
java.math.BigDecimal x)
Sets the big decimal.
|
void |
setBinaryStream(int parameterIndex,
java.io.InputStream x)
Sets the binary stream.
|
void |
setBinaryStream(int parameterIndex,
java.io.InputStream x,
int length)
Sets the binary stream.
|
void |
setBinaryStream(int parameterIndex,
java.io.InputStream x,
long length)
Sets the binary stream.
|
void |
setBlob(int parameterIndex,
java.sql.Blob x)
Sets the blob.
|
void |
setBlob(int parameterIndex,
java.io.InputStream inputStream)
Sets the blob.
|
void |
setBlob(int parameterIndex,
java.io.InputStream inputStream,
long length)
Sets the blob.
|
void |
setBoolean(int parameterIndex,
boolean x)
Sets the boolean.
|
void |
setByte(int parameterIndex,
byte x)
Sets the byte.
|
void |
setBytes(int parameterIndex,
byte[] x)
Sets the bytes.
|
void |
setCharacterStream(int parameterIndex,
java.io.Reader reader)
Sets the character stream.
|
void |
setCharacterStream(int parameterIndex,
java.io.Reader reader,
int length)
Sets the character stream.
|
void |
setCharacterStream(int parameterIndex,
java.io.Reader reader,
long length)
Sets the character stream.
|
void |
setClob(int parameterIndex,
java.sql.Clob x)
Sets the clob.
|
void |
setClob(int parameterIndex,
java.io.Reader reader)
Sets the clob.
|
void |
setClob(int parameterIndex,
java.io.Reader reader,
long length)
Sets the clob.
|
void |
setCursorName(java.lang.String name)
Sets the cursor name.
|
void |
setDate(int parameterIndex,
java.sql.Date x)
Sets the date.
|
void |
setDate(int parameterIndex,
java.sql.Date x,
java.util.Calendar cal)
Sets the date.
|
void |
setDouble(int parameterIndex,
double x)
Sets the double.
|
void |
setEscapeProcessing(boolean enable)
Sets the escape processing.
|
void |
setFetchDirection(int direction)
Sets the fetch direction.
|
void |
setFetchSize(int rows)
Sets the fetch size.
|
void |
setFloat(int parameterIndex,
float x)
Sets the float.
|
void |
setInt(int parameterIndex,
int x)
Sets the int.
|
void |
setLong(int parameterIndex,
long x)
Sets the long.
|
void |
setMaxFieldSize(int max)
Sets the max field size.
|
void |
setMaxRows(int max)
Sets the max rows.
|
void |
setNCharacterStream(int parameterIndex,
java.io.Reader value)
Sets the N character stream.
|
void |
setNCharacterStream(int parameterIndex,
java.io.Reader value,
long length)
Sets the N character stream.
|
void |
setNClob(int parameterIndex,
java.sql.NClob value)
Sets the N clob.
|
void |
setNClob(int parameterIndex,
java.io.Reader reader)
Sets the N clob.
|
void |
setNClob(int parameterIndex,
java.io.Reader reader,
long length)
Sets the N clob.
|
void |
setNString(int parameterIndex,
java.lang.String value)
Sets the N string.
|
void |
setNull(int parameterIndex,
int sqlType)
Sets the null.
|
void |
setNull(int parameterIndex,
int sqlType,
java.lang.String typeName)
Sets the null.
|
void |
setObject(int parameterIndex,
java.lang.Object x)
Sets the object.
|
void |
setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType)
Sets the object.
|
void |
setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType,
int scaleOrLength)
Sets the object.
|
void |
setPoolable(boolean poolable)
Sets the poolable.
|
void |
setQueryTimeout(int seconds)
Sets the query timeout.
|
void |
setRef(int parameterIndex,
java.sql.Ref x)
Sets the ref.
|
void |
setRowId(int parameterIndex,
java.sql.RowId x)
Sets the row id.
|
void |
setShort(int parameterIndex,
short x)
Sets the short.
|
void |
setSQLXML(int parameterIndex,
java.sql.SQLXML xmlObject)
Sets the SQLXML.
|
void |
setString(int parameterIndex,
java.lang.String x)
Sets the string.
|
void |
setTime(int parameterIndex,
java.sql.Time x)
Sets the time.
|
void |
setTime(int parameterIndex,
java.sql.Time x,
java.util.Calendar cal)
Sets the time.
|
void |
setTimestamp(int parameterIndex,
java.sql.Timestamp x)
Sets the timestamp.
|
void |
setTimestamp(int parameterIndex,
java.sql.Timestamp x,
java.util.Calendar cal)
Sets the timestamp.
|
void |
setUnicodeStream(int parameterIndex,
java.io.InputStream x,
int length)
已过时。
|
void |
setURL(int parameterIndex,
java.net.URL x)
Sets the URL.
|
<T> T |
unwrap(java.lang.Class<T> iface)
Unwrap.
|
public PreparedStatementWrapper(java.sql.PreparedStatement preparedStatement,
ConnectionWrapper connectionWrapper)
preparedStatement - the prepared statementconnectionWrapper - the connection wrapperpublic void addBatch()
PreparedStatementpublic void clearParameters()
PreparedStatementpublic boolean execute()
PreparedStatementpublic ResultSetWrapper executeQuery()
PreparedStatementpublic int executeUpdate()
PreparedStatementpublic java.sql.ResultSetMetaData getMetaData()
PreparedStatementpublic java.sql.ParameterMetaData getParameterMetaData()
PreparedStatementpublic void setArray(int parameterIndex,
java.sql.Array x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setAsciiStream(int parameterIndex,
java.io.InputStream x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setAsciiStream(int parameterIndex,
java.io.InputStream x,
int length)
parameterIndex - the parameter indexx - the xlength - the lengthPreparedStatementpublic void setAsciiStream(int parameterIndex,
java.io.InputStream x,
long length)
parameterIndex - the parameter indexx - the xlength - the lengthPreparedStatementpublic void setBigDecimal(int parameterIndex,
java.math.BigDecimal x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setBinaryStream(int parameterIndex,
java.io.InputStream x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setBinaryStream(int parameterIndex,
java.io.InputStream x,
int length)
parameterIndex - the parameter indexx - the xlength - the lengthPreparedStatementpublic void setBinaryStream(int parameterIndex,
java.io.InputStream x,
long length)
parameterIndex - the parameter indexx - the xlength - the lengthPreparedStatementpublic void setBlob(int parameterIndex,
java.sql.Blob x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setBlob(int parameterIndex,
java.io.InputStream inputStream)
parameterIndex - the parameter indexinputStream - the input streamPreparedStatementpublic void setBlob(int parameterIndex,
java.io.InputStream inputStream,
long length)
parameterIndex - the parameter indexinputStream - the input streamlength - the lengthPreparedStatementpublic void setBoolean(int parameterIndex,
boolean x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setByte(int parameterIndex,
byte x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setBytes(int parameterIndex,
byte[] x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setCharacterStream(int parameterIndex,
java.io.Reader reader)
parameterIndex - the parameter indexreader - the readerPreparedStatementpublic void setCharacterStream(int parameterIndex,
java.io.Reader reader,
int length)
parameterIndex - the parameter indexreader - the readerlength - the lengthPreparedStatementpublic void setCharacterStream(int parameterIndex,
java.io.Reader reader,
long length)
parameterIndex - the parameter indexreader - the readerlength - the lengthPreparedStatementpublic void setClob(int parameterIndex,
java.sql.Clob x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setClob(int parameterIndex,
java.io.Reader reader)
parameterIndex - the parameter indexreader - the readerPreparedStatementpublic void setClob(int parameterIndex,
java.io.Reader reader,
long length)
parameterIndex - the parameter indexreader - the readerlength - the lengthPreparedStatementpublic void setDate(int parameterIndex,
java.sql.Date x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setDate(int parameterIndex,
java.sql.Date x,
java.util.Calendar cal)
parameterIndex - the parameter indexx - the xcal - the calPreparedStatementpublic void setDouble(int parameterIndex,
double x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setFloat(int parameterIndex,
float x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setInt(int parameterIndex,
int x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setLong(int parameterIndex,
long x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setNCharacterStream(int parameterIndex,
java.io.Reader value)
parameterIndex - the parameter indexvalue - the valuePreparedStatementpublic void setNCharacterStream(int parameterIndex,
java.io.Reader value,
long length)
parameterIndex - the parameter indexvalue - the valuelength - the lengthPreparedStatementpublic void setNClob(int parameterIndex,
java.sql.NClob value)
parameterIndex - the parameter indexvalue - the valuePreparedStatementpublic void setNClob(int parameterIndex,
java.io.Reader reader)
parameterIndex - the parameter indexreader - the readerPreparedStatementpublic void setNClob(int parameterIndex,
java.io.Reader reader,
long length)
parameterIndex - the parameter indexreader - the readerlength - the lengthPreparedStatementpublic void setNString(int parameterIndex,
java.lang.String value)
parameterIndex - the parameter indexvalue - the valuePreparedStatementpublic void setNull(int parameterIndex,
int sqlType)
parameterIndex - the parameter indexsqlType - the sql typePreparedStatementpublic void setNull(int parameterIndex,
int sqlType,
java.lang.String typeName)
parameterIndex - the parameter indexsqlType - the sql typetypeName - the type namePreparedStatementpublic void setObject(int parameterIndex,
java.lang.Object x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType)
parameterIndex - the parameter indexx - the xtargetSqlType - the target sql typePreparedStatementpublic void setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType,
int scaleOrLength)
parameterIndex - the parameter indexx - the xtargetSqlType - the target sql typescaleOrLength - the scale or lengthPreparedStatementpublic void setRef(int parameterIndex,
java.sql.Ref x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setRowId(int parameterIndex,
java.sql.RowId x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setSQLXML(int parameterIndex,
java.sql.SQLXML xmlObject)
parameterIndex - the parameter indexxmlObject - the xml objectPreparedStatementpublic void setShort(int parameterIndex,
short x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setString(int parameterIndex,
java.lang.String x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setTime(int parameterIndex,
java.sql.Time x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setTime(int parameterIndex,
java.sql.Time x,
java.util.Calendar cal)
parameterIndex - the parameter indexx - the xcal - the calPreparedStatementpublic void setTimestamp(int parameterIndex,
java.sql.Timestamp x)
parameterIndex - the parameter indexx - the xPreparedStatementpublic void setTimestamp(int parameterIndex,
java.sql.Timestamp x,
java.util.Calendar cal)
parameterIndex - the parameter indexx - the xcal - the calPreparedStatementpublic void setURL(int parameterIndex,
java.net.URL x)
parameterIndex - the parameter indexx - the xPreparedStatement@Deprecated
public void setUnicodeStream(int parameterIndex,
java.io.InputStream x,
int length)
parameterIndex - the parameter indexx - the xlength - the lengthPreparedStatementpublic void addBatch(java.lang.String sql)
sql - the sqlPreparedStatementpublic void cancel()
PreparedStatementpublic void clearBatch()
PreparedStatementpublic void clearWarnings()
PreparedStatementpublic void close()
close 在接口中 java.lang.AutoCloseablePreparedStatementpublic boolean execute(java.lang.String sql)
sql - the sqlPreparedStatementpublic boolean execute(java.lang.String sql,
int autoGeneratedKeys)
sql - the sqlautoGeneratedKeys - the auto generated keysPreparedStatementpublic boolean execute(java.lang.String sql,
int[] columnIndexes)
sql - the sqlcolumnIndexes - the column indexesPreparedStatementpublic boolean execute(java.lang.String sql,
java.lang.String[] columnNames)
sql - the sqlcolumnNames - the column namesPreparedStatementpublic int[] executeBatch()
PreparedStatementpublic ResultSetWrapper executeQuery(java.lang.String sql)
sql - the sqlPreparedStatementpublic int executeUpdate(java.lang.String sql)
sql - the sqlPreparedStatementpublic int executeUpdate(java.lang.String sql,
int autoGeneratedKeys)
sql - the sqlautoGeneratedKeys - the auto generated keysPreparedStatementpublic int executeUpdate(java.lang.String sql,
int[] columnIndexes)
sql - the sqlcolumnIndexes - the column indexesPreparedStatementpublic int executeUpdate(java.lang.String sql,
java.lang.String[] columnNames)
sql - the sqlcolumnNames - the column namesPreparedStatementpublic ConnectionWrapper getConnection()
PreparedStatementpublic int getFetchDirection()
PreparedStatementpublic int getFetchSize()
PreparedStatementpublic ResultSetWrapper getGeneratedKeys()
PreparedStatementpublic int getMaxFieldSize()
PreparedStatementpublic int getMaxRows()
PreparedStatementpublic boolean getMoreResults()
PreparedStatementpublic boolean getMoreResults(int current)
current - the currentPreparedStatementpublic int getQueryTimeout()
PreparedStatementpublic ResultSetWrapper getResultSet()
PreparedStatementpublic int getResultSetConcurrency()
PreparedStatementpublic int getResultSetHoldability()
PreparedStatementpublic int getResultSetType()
PreparedStatementpublic int getUpdateCount()
PreparedStatementpublic java.sql.SQLWarning getWarnings()
PreparedStatementpublic boolean isClosed()
PreparedStatementpublic boolean isPoolable()
PreparedStatementpublic void setCursorName(java.lang.String name)
name - the new cursor namePreparedStatementpublic void setEscapeProcessing(boolean enable)
enable - the new escape processingPreparedStatementpublic void setFetchDirection(int direction)
direction - the new fetch directionPreparedStatementpublic void setFetchSize(int rows)
rows - the new fetch sizePreparedStatementpublic void setMaxFieldSize(int max)
max - the new max field sizePreparedStatementpublic void setMaxRows(int max)
max - the new max rowsPreparedStatementpublic void setPoolable(boolean poolable)
poolable - the new poolablePreparedStatementpublic void setQueryTimeout(int seconds)
seconds - the new query timeoutPreparedStatementpublic boolean isWrapperFor(java.lang.Class<?> iface)
iface - the ifacePreparedStatementpublic <T> T unwrap(java.lang.Class<T> iface)
T - the generic typeiface - the ifacePreparedStatementpublic java.sql.PreparedStatement getPreparedStatement()