Class Logged
- java.lang.Object
-
- com.github.fabriciofx.cactoos.jdbc.prepared.PreparedStatementEnvelope
-
- com.github.fabriciofx.cactoos.jdbc.prepared.Logged
-
- All Implemented Interfaces:
AutoCloseable
,PreparedStatement
,Statement
,Wrapper
public final class Logged extends PreparedStatementEnvelope
Logged PreparedStatement.- Since:
- 0.1
-
-
Field Summary
-
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
-
-
Constructor Summary
Constructors Constructor Description Logged(PreparedStatement stmt, String src, Logger lggr, Level lvl, int id)
Ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addBatch()
void
addBatch(String sql)
void
cancel()
void
clearParameters()
void
close()
void
closeOnCompletion()
boolean
execute()
boolean
execute(String sql)
int[]
executeBatch()
ResultSet
executeQuery()
ResultSet
executeQuery(String sql)
int
executeUpdate()
int
executeUpdate(String sql)
ResultSet
getGeneratedKeys()
ResultSet
getResultSet()
void
setAsciiStream(int index, InputStream stream, int length)
void
setBigDecimal(int index, BigDecimal value)
void
setBinaryStream(int index, InputStream stream, int length)
void
setBoolean(int index, boolean value)
void
setByte(int index, byte value)
void
setBytes(int index, byte[] values)
void
setDate(int index, Date value)
void
setDouble(int index, double value)
void
setFloat(int index, float value)
void
setInt(int index, int value)
void
setLong(int index, long value)
void
setMaxFieldSize(int max)
void
setMaxRows(int max)
void
setNull(int index, int type)
void
setObject(int index, Object value)
void
setObject(int index, Object value, int type)
void
setPoolable(boolean poolable)
void
setQueryTimeout(int seconds)
void
setShort(int index, short value)
void
setString(int index, String value)
void
setTime(int index, Time value)
void
setTimestamp(int index, Timestamp value)
void
setUnicodeStream(int index, InputStream stream, int length)
Deprecated.It not should be used-
Methods inherited from class com.github.fabriciofx.cactoos.jdbc.prepared.PreparedStatementEnvelope
clearBatch, clearWarnings, execute, execute, execute, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getMaxFieldSize, getMaxRows, getMetaData, getMoreResults, getMoreResults, getParameterMetaData, getQueryTimeout, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, setArray, setAsciiStream, setAsciiStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setCursorName, setDate, setEscapeProcessing, setFetchDirection, setFetchSize, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setObject, setRef, setRowId, setSQLXML, setTime, setTimestamp, setURL, unwrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.PreparedStatement
executeLargeUpdate, setObject, setObject
-
Methods inherited from interface java.sql.Statement
enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, getLargeMaxRows, getLargeUpdateCount, isSimpleIdentifier, setLargeMaxRows
-
-
-
-
Constructor Detail
-
Logged
public Logged(PreparedStatement stmt, String src, Logger lggr, Level lvl, int id)
Ctor.- Parameters:
stmt
- Decorated PreparedStatementsrc
- The name of source datalggr
- The loggerlvl
- The connection levelid
- The PreparedStatement id
-
-
Method Detail
-
executeQuery
public ResultSet executeQuery() throws SQLException
- Specified by:
executeQuery
in interfacePreparedStatement
- Overrides:
executeQuery
in classPreparedStatementEnvelope
- Throws:
SQLException
-
executeUpdate
public int executeUpdate() throws SQLException
- Specified by:
executeUpdate
in interfacePreparedStatement
- Overrides:
executeUpdate
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setNull
public void setNull(int index, int type) throws SQLException
- Specified by:
setNull
in interfacePreparedStatement
- Overrides:
setNull
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setBoolean
public void setBoolean(int index, boolean value) throws SQLException
- Specified by:
setBoolean
in interfacePreparedStatement
- Overrides:
setBoolean
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setByte
public void setByte(int index, byte value) throws SQLException
- Specified by:
setByte
in interfacePreparedStatement
- Overrides:
setByte
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setShort
public void setShort(int index, short value) throws SQLException
- Specified by:
setShort
in interfacePreparedStatement
- Overrides:
setShort
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setInt
public void setInt(int index, int value) throws SQLException
- Specified by:
setInt
in interfacePreparedStatement
- Overrides:
setInt
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setLong
public void setLong(int index, long value) throws SQLException
- Specified by:
setLong
in interfacePreparedStatement
- Overrides:
setLong
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setFloat
public void setFloat(int index, float value) throws SQLException
- Specified by:
setFloat
in interfacePreparedStatement
- Overrides:
setFloat
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setDouble
public void setDouble(int index, double value) throws SQLException
- Specified by:
setDouble
in interfacePreparedStatement
- Overrides:
setDouble
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setBigDecimal
public void setBigDecimal(int index, BigDecimal value) throws SQLException
- Specified by:
setBigDecimal
in interfacePreparedStatement
- Overrides:
setBigDecimal
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setString
public void setString(int index, String value) throws SQLException
- Specified by:
setString
in interfacePreparedStatement
- Overrides:
setString
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setBytes
public void setBytes(int index, byte[] values) throws SQLException
- Specified by:
setBytes
in interfacePreparedStatement
- Overrides:
setBytes
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setDate
public void setDate(int index, Date value) throws SQLException
- Specified by:
setDate
in interfacePreparedStatement
- Overrides:
setDate
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setTime
public void setTime(int index, Time value) throws SQLException
- Specified by:
setTime
in interfacePreparedStatement
- Overrides:
setTime
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setTimestamp
public void setTimestamp(int index, Timestamp value) throws SQLException
- Specified by:
setTimestamp
in interfacePreparedStatement
- Overrides:
setTimestamp
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setAsciiStream
public void setAsciiStream(int index, InputStream stream, int length) throws SQLException
- Specified by:
setAsciiStream
in interfacePreparedStatement
- Overrides:
setAsciiStream
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setUnicodeStream
@Deprecated public void setUnicodeStream(int index, InputStream stream, int length) throws SQLException
Deprecated.It not should be usedSet a stream to Unicode.- Specified by:
setUnicodeStream
in interfacePreparedStatement
- Overrides:
setUnicodeStream
in classPreparedStatementEnvelope
- Parameters:
index
- Parameter indexstream
- InputStreamlength
- Data length- Throws:
SQLException
- If fails
-
setBinaryStream
public void setBinaryStream(int index, InputStream stream, int length) throws SQLException
- Specified by:
setBinaryStream
in interfacePreparedStatement
- Overrides:
setBinaryStream
in classPreparedStatementEnvelope
- Throws:
SQLException
-
clearParameters
public void clearParameters() throws SQLException
- Specified by:
clearParameters
in interfacePreparedStatement
- Overrides:
clearParameters
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setObject
public void setObject(int index, Object value, int type) throws SQLException
- Specified by:
setObject
in interfacePreparedStatement
- Overrides:
setObject
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setObject
public void setObject(int index, Object value) throws SQLException
- Specified by:
setObject
in interfacePreparedStatement
- Overrides:
setObject
in classPreparedStatementEnvelope
- Throws:
SQLException
-
execute
public boolean execute() throws SQLException
- Specified by:
execute
in interfacePreparedStatement
- Overrides:
execute
in classPreparedStatementEnvelope
- Throws:
SQLException
-
addBatch
public void addBatch() throws SQLException
- Specified by:
addBatch
in interfacePreparedStatement
- Overrides:
addBatch
in classPreparedStatementEnvelope
- Throws:
SQLException
-
executeQuery
public ResultSet executeQuery(String sql) throws SQLException
- Specified by:
executeQuery
in interfaceStatement
- Overrides:
executeQuery
in classPreparedStatementEnvelope
- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql) throws SQLException
- Specified by:
executeUpdate
in interfaceStatement
- Overrides:
executeUpdate
in classPreparedStatementEnvelope
- Throws:
SQLException
-
close
public void close() throws SQLException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceStatement
- Overrides:
close
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setMaxFieldSize
public void setMaxFieldSize(int max) throws SQLException
- Specified by:
setMaxFieldSize
in interfaceStatement
- Overrides:
setMaxFieldSize
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setMaxRows
public void setMaxRows(int max) throws SQLException
- Specified by:
setMaxRows
in interfaceStatement
- Overrides:
setMaxRows
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setQueryTimeout
public void setQueryTimeout(int seconds) throws SQLException
- Specified by:
setQueryTimeout
in interfaceStatement
- Overrides:
setQueryTimeout
in classPreparedStatementEnvelope
- Throws:
SQLException
-
cancel
public void cancel() throws SQLException
- Specified by:
cancel
in interfaceStatement
- Overrides:
cancel
in classPreparedStatementEnvelope
- Throws:
SQLException
-
execute
public boolean execute(String sql) throws SQLException
- Specified by:
execute
in interfaceStatement
- Overrides:
execute
in classPreparedStatementEnvelope
- Throws:
SQLException
-
getResultSet
public ResultSet getResultSet() throws SQLException
- Specified by:
getResultSet
in interfaceStatement
- Overrides:
getResultSet
in classPreparedStatementEnvelope
- Throws:
SQLException
-
addBatch
public void addBatch(String sql) throws SQLException
- Specified by:
addBatch
in interfaceStatement
- Overrides:
addBatch
in classPreparedStatementEnvelope
- Throws:
SQLException
-
executeBatch
public int[] executeBatch() throws SQLException
- Specified by:
executeBatch
in interfaceStatement
- Overrides:
executeBatch
in classPreparedStatementEnvelope
- Throws:
SQLException
-
getGeneratedKeys
public ResultSet getGeneratedKeys() throws SQLException
- Specified by:
getGeneratedKeys
in interfaceStatement
- Overrides:
getGeneratedKeys
in classPreparedStatementEnvelope
- Throws:
SQLException
-
setPoolable
public void setPoolable(boolean poolable) throws SQLException
- Specified by:
setPoolable
in interfaceStatement
- Overrides:
setPoolable
in classPreparedStatementEnvelope
- Throws:
SQLException
-
closeOnCompletion
public void closeOnCompletion() throws SQLException
- Specified by:
closeOnCompletion
in interfaceStatement
- Overrides:
closeOnCompletion
in classPreparedStatementEnvelope
- Throws:
SQLException
-
-