diff --git a/src/nl/astraeus/jdbc/CallableStatementLogger.java b/src/nl/astraeus/jdbc/CallableStatementLogger.java new file mode 100644 index 0000000..fe50fad --- /dev/null +++ b/src/nl/astraeus/jdbc/CallableStatementLogger.java @@ -0,0 +1,864 @@ +package nl.astraeus.jdbc; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.*; +import java.util.Calendar; +import java.util.Map; + +/** + * User: rnentjes + * Date: 4/17/12 + * Time: 9:48 PM + */ +public class CallableStatementLogger implements CallableStatement { + public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean wasNull() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(int parameterIndex) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(int parameterIndex) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(String parameterName, URL val) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(String parameterName, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(String parameterName, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(String parameterName, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(String parameterName, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(String parameterName, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(String parameterName, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(String parameterName, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(String parameterName, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(String parameterName, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(String parameterName) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(String parameterName) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(String parameterName, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(String parameterName, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(int parameterIndex, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(String parameterName, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(int parameterIndex, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(int parameterIndex, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(int parameterIndex, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(int parameterIndex, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(int parameterIndex, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(int parameterIndex, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(int parameterIndex, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearParameters() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRef(int parameterIndex, Ref x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setArray(int parameterIndex, Array x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSetMetaData getMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(int parameterIndex, URL x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ParameterMetaData getParameterMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(int parameterIndex, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(int parameterIndex, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery(String sql) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void close() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxFieldSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxFieldSize(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxRows() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxRows(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setEscapeProcessing(boolean enable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getQueryTimeout() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setQueryTimeout(int seconds) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void cancel() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLWarning getWarnings() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearWarnings() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCursorName(String name) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getResultSet() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getUpdateCount() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchDirection(int direction) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchDirection() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchSize(int rows) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetConcurrency() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetType() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch(String sql) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int[] executeBatch() throws SQLException { + return new int[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Connection getConnection() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults(int current) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getGeneratedKeys() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, String[] columnNames) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, String[] columnNames) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetHoldability() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isClosed() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setPoolable(boolean poolable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isPoolable() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void closeOnCompletion() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isCloseOnCompletion() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public T unwrap(Class iface) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isWrapperFor(Class iface) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } +} diff --git a/src/nl/astraeus/jdbc/CallableStatementLogger.java b/src/nl/astraeus/jdbc/CallableStatementLogger.java new file mode 100644 index 0000000..fe50fad --- /dev/null +++ b/src/nl/astraeus/jdbc/CallableStatementLogger.java @@ -0,0 +1,864 @@ +package nl.astraeus.jdbc; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.*; +import java.util.Calendar; +import java.util.Map; + +/** + * User: rnentjes + * Date: 4/17/12 + * Time: 9:48 PM + */ +public class CallableStatementLogger implements CallableStatement { + public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean wasNull() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(int parameterIndex) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(int parameterIndex) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(String parameterName, URL val) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(String parameterName, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(String parameterName, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(String parameterName, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(String parameterName, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(String parameterName, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(String parameterName, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(String parameterName, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(String parameterName, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(String parameterName, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(String parameterName) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(String parameterName) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(String parameterName, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(String parameterName, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(int parameterIndex, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(String parameterName, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(int parameterIndex, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(int parameterIndex, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(int parameterIndex, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(int parameterIndex, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(int parameterIndex, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(int parameterIndex, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(int parameterIndex, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearParameters() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRef(int parameterIndex, Ref x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setArray(int parameterIndex, Array x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSetMetaData getMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(int parameterIndex, URL x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ParameterMetaData getParameterMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(int parameterIndex, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(int parameterIndex, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery(String sql) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void close() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxFieldSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxFieldSize(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxRows() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxRows(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setEscapeProcessing(boolean enable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getQueryTimeout() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setQueryTimeout(int seconds) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void cancel() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLWarning getWarnings() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearWarnings() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCursorName(String name) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getResultSet() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getUpdateCount() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchDirection(int direction) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchDirection() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchSize(int rows) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetConcurrency() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetType() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch(String sql) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int[] executeBatch() throws SQLException { + return new int[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Connection getConnection() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults(int current) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getGeneratedKeys() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, String[] columnNames) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, String[] columnNames) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetHoldability() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isClosed() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setPoolable(boolean poolable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isPoolable() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void closeOnCompletion() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isCloseOnCompletion() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public T unwrap(Class iface) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isWrapperFor(Class iface) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } +} diff --git a/src/nl/astraeus/jdbc/ConnectionLogger.java b/src/nl/astraeus/jdbc/ConnectionLogger.java index c3e243f..c359692 100644 --- a/src/nl/astraeus/jdbc/ConnectionLogger.java +++ b/src/nl/astraeus/jdbc/ConnectionLogger.java @@ -89,7 +89,7 @@ } public Statement createStatement() throws SQLException { - return connection.createStatement(); + return new StatementLogger(connection.createStatement()); } public CallableStatement prepareCall(String sql) throws SQLException { @@ -151,7 +151,7 @@ } public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { - return connection.createStatement(resultSetType, resultSetConcurrency); + return new StatementLogger(connection.createStatement(resultSetType, resultSetConcurrency)); } public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { @@ -244,27 +244,22 @@ return connection.createStruct(typeName, attributes); } - @Override public void setSchema(String schema) throws SQLException { connection.setSchema(schema); } - @Override public String getSchema() throws SQLException { return connection.getSchema(); } - @Override public void abort(Executor executor) throws SQLException { connection.abort(executor); } - @Override public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { connection.setNetworkTimeout(executor, milliseconds); } - @Override public int getNetworkTimeout() throws SQLException { return connection.getNetworkTimeout(); } diff --git a/src/nl/astraeus/jdbc/CallableStatementLogger.java b/src/nl/astraeus/jdbc/CallableStatementLogger.java new file mode 100644 index 0000000..fe50fad --- /dev/null +++ b/src/nl/astraeus/jdbc/CallableStatementLogger.java @@ -0,0 +1,864 @@ +package nl.astraeus.jdbc; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.*; +import java.util.Calendar; +import java.util.Map; + +/** + * User: rnentjes + * Date: 4/17/12 + * Time: 9:48 PM + */ +public class CallableStatementLogger implements CallableStatement { + public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean wasNull() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(int parameterIndex) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(int parameterIndex) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(String parameterName, URL val) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(String parameterName, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(String parameterName, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(String parameterName, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(String parameterName, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(String parameterName, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(String parameterName, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(String parameterName, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(String parameterName, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(String parameterName, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(String parameterName) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(String parameterName) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(String parameterName, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(String parameterName, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(int parameterIndex, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(String parameterName, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(int parameterIndex, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(int parameterIndex, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(int parameterIndex, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(int parameterIndex, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(int parameterIndex, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(int parameterIndex, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(int parameterIndex, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearParameters() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRef(int parameterIndex, Ref x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setArray(int parameterIndex, Array x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSetMetaData getMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(int parameterIndex, URL x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ParameterMetaData getParameterMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(int parameterIndex, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(int parameterIndex, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery(String sql) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void close() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxFieldSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxFieldSize(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxRows() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxRows(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setEscapeProcessing(boolean enable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getQueryTimeout() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setQueryTimeout(int seconds) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void cancel() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLWarning getWarnings() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearWarnings() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCursorName(String name) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getResultSet() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getUpdateCount() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchDirection(int direction) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchDirection() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchSize(int rows) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetConcurrency() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetType() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch(String sql) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int[] executeBatch() throws SQLException { + return new int[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Connection getConnection() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults(int current) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getGeneratedKeys() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, String[] columnNames) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, String[] columnNames) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetHoldability() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isClosed() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setPoolable(boolean poolable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isPoolable() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void closeOnCompletion() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isCloseOnCompletion() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public T unwrap(Class iface) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isWrapperFor(Class iface) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } +} diff --git a/src/nl/astraeus/jdbc/ConnectionLogger.java b/src/nl/astraeus/jdbc/ConnectionLogger.java index c3e243f..c359692 100644 --- a/src/nl/astraeus/jdbc/ConnectionLogger.java +++ b/src/nl/astraeus/jdbc/ConnectionLogger.java @@ -89,7 +89,7 @@ } public Statement createStatement() throws SQLException { - return connection.createStatement(); + return new StatementLogger(connection.createStatement()); } public CallableStatement prepareCall(String sql) throws SQLException { @@ -151,7 +151,7 @@ } public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { - return connection.createStatement(resultSetType, resultSetConcurrency); + return new StatementLogger(connection.createStatement(resultSetType, resultSetConcurrency)); } public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { @@ -244,27 +244,22 @@ return connection.createStruct(typeName, attributes); } - @Override public void setSchema(String schema) throws SQLException { connection.setSchema(schema); } - @Override public String getSchema() throws SQLException { return connection.getSchema(); } - @Override public void abort(Executor executor) throws SQLException { connection.abort(executor); } - @Override public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { connection.setNetworkTimeout(executor, milliseconds); } - @Override public int getNetworkTimeout() throws SQLException { return connection.getNetworkTimeout(); } diff --git a/src/nl/astraeus/jdbc/JdbcLogger.java b/src/nl/astraeus/jdbc/JdbcLogger.java index 360d4f0..2a22033 100644 --- a/src/nl/astraeus/jdbc/JdbcLogger.java +++ b/src/nl/astraeus/jdbc/JdbcLogger.java @@ -29,6 +29,7 @@ private long nano; private int hash; private int count; + private StackTraceElement[] stackTrace = null; public LogEntry(int hash, QueryType type, String sql, long milli, long nano) { this.threadId = Thread.currentThread().getId(); @@ -109,11 +110,24 @@ this.nano += le.getNano(); this.timeStamp = 0; } + + public boolean hasStackTrace() { + return stackTrace != null; + } + + public void setStackTrace(StackTraceElement[] stackTrace) { + this.stackTrace = stackTrace; + } + + public StackTraceElement[] getStackTrace() { + return stackTrace; + } } private final List queries; private long startTime; private int cacheSize; + private boolean recording = false; public JdbcLogger() { queries = new LinkedList(); @@ -121,6 +135,14 @@ cacheSize = 2500; } + public boolean isRecording() { + return recording; + } + + public void switchRecording() { + recording = !recording; + } + public void clear() { queries.clear(); } @@ -138,6 +160,14 @@ LogEntry entry = new LogEntry(hash, type, sql, milli, nano); + if (recording) { + try { + throw new IllegalStateException(); + } catch (IllegalStateException e) { + entry.setStackTrace(e.getStackTrace()); + } + } + synchronized (queries) { queries.add(entry); diff --git a/src/nl/astraeus/jdbc/CallableStatementLogger.java b/src/nl/astraeus/jdbc/CallableStatementLogger.java new file mode 100644 index 0000000..fe50fad --- /dev/null +++ b/src/nl/astraeus/jdbc/CallableStatementLogger.java @@ -0,0 +1,864 @@ +package nl.astraeus.jdbc; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.*; +import java.util.Calendar; +import java.util.Map; + +/** + * User: rnentjes + * Date: 4/17/12 + * Time: 9:48 PM + */ +public class CallableStatementLogger implements CallableStatement { + public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean wasNull() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(int parameterIndex) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(int parameterIndex) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(String parameterName, URL val) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(String parameterName, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(String parameterName, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(String parameterName, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(String parameterName, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(String parameterName, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(String parameterName, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(String parameterName, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(String parameterName, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(String parameterName, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(String parameterName) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(String parameterName) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(String parameterName, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(String parameterName, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(int parameterIndex, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(String parameterName, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(int parameterIndex, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(int parameterIndex, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(int parameterIndex, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(int parameterIndex, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(int parameterIndex, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(int parameterIndex, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(int parameterIndex, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearParameters() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRef(int parameterIndex, Ref x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setArray(int parameterIndex, Array x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSetMetaData getMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(int parameterIndex, URL x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ParameterMetaData getParameterMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(int parameterIndex, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(int parameterIndex, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery(String sql) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void close() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxFieldSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxFieldSize(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxRows() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxRows(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setEscapeProcessing(boolean enable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getQueryTimeout() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setQueryTimeout(int seconds) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void cancel() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLWarning getWarnings() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearWarnings() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCursorName(String name) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getResultSet() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getUpdateCount() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchDirection(int direction) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchDirection() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchSize(int rows) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetConcurrency() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetType() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch(String sql) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int[] executeBatch() throws SQLException { + return new int[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Connection getConnection() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults(int current) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getGeneratedKeys() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, String[] columnNames) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, String[] columnNames) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetHoldability() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isClosed() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setPoolable(boolean poolable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isPoolable() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void closeOnCompletion() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isCloseOnCompletion() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public T unwrap(Class iface) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isWrapperFor(Class iface) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } +} diff --git a/src/nl/astraeus/jdbc/ConnectionLogger.java b/src/nl/astraeus/jdbc/ConnectionLogger.java index c3e243f..c359692 100644 --- a/src/nl/astraeus/jdbc/ConnectionLogger.java +++ b/src/nl/astraeus/jdbc/ConnectionLogger.java @@ -89,7 +89,7 @@ } public Statement createStatement() throws SQLException { - return connection.createStatement(); + return new StatementLogger(connection.createStatement()); } public CallableStatement prepareCall(String sql) throws SQLException { @@ -151,7 +151,7 @@ } public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { - return connection.createStatement(resultSetType, resultSetConcurrency); + return new StatementLogger(connection.createStatement(resultSetType, resultSetConcurrency)); } public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { @@ -244,27 +244,22 @@ return connection.createStruct(typeName, attributes); } - @Override public void setSchema(String schema) throws SQLException { connection.setSchema(schema); } - @Override public String getSchema() throws SQLException { return connection.getSchema(); } - @Override public void abort(Executor executor) throws SQLException { connection.abort(executor); } - @Override public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { connection.setNetworkTimeout(executor, milliseconds); } - @Override public int getNetworkTimeout() throws SQLException { return connection.getNetworkTimeout(); } diff --git a/src/nl/astraeus/jdbc/JdbcLogger.java b/src/nl/astraeus/jdbc/JdbcLogger.java index 360d4f0..2a22033 100644 --- a/src/nl/astraeus/jdbc/JdbcLogger.java +++ b/src/nl/astraeus/jdbc/JdbcLogger.java @@ -29,6 +29,7 @@ private long nano; private int hash; private int count; + private StackTraceElement[] stackTrace = null; public LogEntry(int hash, QueryType type, String sql, long milli, long nano) { this.threadId = Thread.currentThread().getId(); @@ -109,11 +110,24 @@ this.nano += le.getNano(); this.timeStamp = 0; } + + public boolean hasStackTrace() { + return stackTrace != null; + } + + public void setStackTrace(StackTraceElement[] stackTrace) { + this.stackTrace = stackTrace; + } + + public StackTraceElement[] getStackTrace() { + return stackTrace; + } } private final List queries; private long startTime; private int cacheSize; + private boolean recording = false; public JdbcLogger() { queries = new LinkedList(); @@ -121,6 +135,14 @@ cacheSize = 2500; } + public boolean isRecording() { + return recording; + } + + public void switchRecording() { + recording = !recording; + } + public void clear() { queries.clear(); } @@ -138,6 +160,14 @@ LogEntry entry = new LogEntry(hash, type, sql, milli, nano); + if (recording) { + try { + throw new IllegalStateException(); + } catch (IllegalStateException e) { + entry.setStackTrace(e.getStackTrace()); + } + } + synchronized (queries) { queries.add(entry); diff --git a/src/nl/astraeus/jdbc/PreparedStatementLogger.java b/src/nl/astraeus/jdbc/PreparedStatementLogger.java index 98aefc7..cc6c2c1 100644 --- a/src/nl/astraeus/jdbc/PreparedStatementLogger.java +++ b/src/nl/astraeus/jdbc/PreparedStatementLogger.java @@ -557,12 +557,10 @@ return statement.isPoolable(); } - @Override public void closeOnCompletion() throws SQLException { statement.closeOnCompletion();; } - @Override public boolean isCloseOnCompletion() throws SQLException { return statement.isCloseOnCompletion(); } diff --git a/src/nl/astraeus/jdbc/CallableStatementLogger.java b/src/nl/astraeus/jdbc/CallableStatementLogger.java new file mode 100644 index 0000000..fe50fad --- /dev/null +++ b/src/nl/astraeus/jdbc/CallableStatementLogger.java @@ -0,0 +1,864 @@ +package nl.astraeus.jdbc; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.*; +import java.util.Calendar; +import java.util.Map; + +/** + * User: rnentjes + * Date: 4/17/12 + * Time: 9:48 PM + */ +public class CallableStatementLogger implements CallableStatement { + public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean wasNull() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(int parameterIndex) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(int parameterIndex) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(String parameterName, URL val) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(String parameterName, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(String parameterName, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(String parameterName, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(String parameterName, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(String parameterName, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(String parameterName, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(String parameterName, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(String parameterName, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(String parameterName, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(String parameterName) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(String parameterName) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(String parameterName, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(String parameterName, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(int parameterIndex, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(String parameterName, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(int parameterIndex, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(int parameterIndex, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(int parameterIndex, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(int parameterIndex, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(int parameterIndex, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(int parameterIndex, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(int parameterIndex, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearParameters() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRef(int parameterIndex, Ref x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setArray(int parameterIndex, Array x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSetMetaData getMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(int parameterIndex, URL x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ParameterMetaData getParameterMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(int parameterIndex, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(int parameterIndex, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery(String sql) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void close() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxFieldSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxFieldSize(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxRows() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxRows(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setEscapeProcessing(boolean enable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getQueryTimeout() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setQueryTimeout(int seconds) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void cancel() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLWarning getWarnings() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearWarnings() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCursorName(String name) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getResultSet() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getUpdateCount() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchDirection(int direction) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchDirection() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchSize(int rows) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetConcurrency() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetType() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch(String sql) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int[] executeBatch() throws SQLException { + return new int[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Connection getConnection() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults(int current) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getGeneratedKeys() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, String[] columnNames) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, String[] columnNames) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetHoldability() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isClosed() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setPoolable(boolean poolable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isPoolable() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void closeOnCompletion() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isCloseOnCompletion() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public T unwrap(Class iface) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isWrapperFor(Class iface) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } +} diff --git a/src/nl/astraeus/jdbc/ConnectionLogger.java b/src/nl/astraeus/jdbc/ConnectionLogger.java index c3e243f..c359692 100644 --- a/src/nl/astraeus/jdbc/ConnectionLogger.java +++ b/src/nl/astraeus/jdbc/ConnectionLogger.java @@ -89,7 +89,7 @@ } public Statement createStatement() throws SQLException { - return connection.createStatement(); + return new StatementLogger(connection.createStatement()); } public CallableStatement prepareCall(String sql) throws SQLException { @@ -151,7 +151,7 @@ } public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { - return connection.createStatement(resultSetType, resultSetConcurrency); + return new StatementLogger(connection.createStatement(resultSetType, resultSetConcurrency)); } public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { @@ -244,27 +244,22 @@ return connection.createStruct(typeName, attributes); } - @Override public void setSchema(String schema) throws SQLException { connection.setSchema(schema); } - @Override public String getSchema() throws SQLException { return connection.getSchema(); } - @Override public void abort(Executor executor) throws SQLException { connection.abort(executor); } - @Override public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { connection.setNetworkTimeout(executor, milliseconds); } - @Override public int getNetworkTimeout() throws SQLException { return connection.getNetworkTimeout(); } diff --git a/src/nl/astraeus/jdbc/JdbcLogger.java b/src/nl/astraeus/jdbc/JdbcLogger.java index 360d4f0..2a22033 100644 --- a/src/nl/astraeus/jdbc/JdbcLogger.java +++ b/src/nl/astraeus/jdbc/JdbcLogger.java @@ -29,6 +29,7 @@ private long nano; private int hash; private int count; + private StackTraceElement[] stackTrace = null; public LogEntry(int hash, QueryType type, String sql, long milli, long nano) { this.threadId = Thread.currentThread().getId(); @@ -109,11 +110,24 @@ this.nano += le.getNano(); this.timeStamp = 0; } + + public boolean hasStackTrace() { + return stackTrace != null; + } + + public void setStackTrace(StackTraceElement[] stackTrace) { + this.stackTrace = stackTrace; + } + + public StackTraceElement[] getStackTrace() { + return stackTrace; + } } private final List queries; private long startTime; private int cacheSize; + private boolean recording = false; public JdbcLogger() { queries = new LinkedList(); @@ -121,6 +135,14 @@ cacheSize = 2500; } + public boolean isRecording() { + return recording; + } + + public void switchRecording() { + recording = !recording; + } + public void clear() { queries.clear(); } @@ -138,6 +160,14 @@ LogEntry entry = new LogEntry(hash, type, sql, milli, nano); + if (recording) { + try { + throw new IllegalStateException(); + } catch (IllegalStateException e) { + entry.setStackTrace(e.getStackTrace()); + } + } + synchronized (queries) { queries.add(entry); diff --git a/src/nl/astraeus/jdbc/PreparedStatementLogger.java b/src/nl/astraeus/jdbc/PreparedStatementLogger.java index 98aefc7..cc6c2c1 100644 --- a/src/nl/astraeus/jdbc/PreparedStatementLogger.java +++ b/src/nl/astraeus/jdbc/PreparedStatementLogger.java @@ -557,12 +557,10 @@ return statement.isPoolable(); } - @Override public void closeOnCompletion() throws SQLException { statement.closeOnCompletion();; } - @Override public boolean isCloseOnCompletion() throws SQLException { return statement.isCloseOnCompletion(); } diff --git a/src/nl/astraeus/jdbc/QueryType.java b/src/nl/astraeus/jdbc/QueryType.java index 744fbfc..d3db21c 100644 --- a/src/nl/astraeus/jdbc/QueryType.java +++ b/src/nl/astraeus/jdbc/QueryType.java @@ -9,7 +9,9 @@ PLAIN("plain"), PREPARED("prepared"), CALLABLE("callable"), - UNKNOWN("unknown"); + STATEMENT("statement"), + UNKNOWN("unknown"), + BATCH("batch"); private String description; diff --git a/src/nl/astraeus/jdbc/CallableStatementLogger.java b/src/nl/astraeus/jdbc/CallableStatementLogger.java new file mode 100644 index 0000000..fe50fad --- /dev/null +++ b/src/nl/astraeus/jdbc/CallableStatementLogger.java @@ -0,0 +1,864 @@ +package nl.astraeus.jdbc; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.*; +import java.util.Calendar; +import java.util.Map; + +/** + * User: rnentjes + * Date: 4/17/12 + * Time: 9:48 PM + */ +public class CallableStatementLogger implements CallableStatement { + public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean wasNull() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(int parameterIndex) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(int parameterIndex) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(String parameterName, URL val) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(String parameterName, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(String parameterName, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(String parameterName, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(String parameterName, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(String parameterName, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(String parameterName, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(String parameterName, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(String parameterName, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(String parameterName, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(String parameterName) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(String parameterName) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(String parameterName, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(String parameterName, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(int parameterIndex, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(String parameterName, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(int parameterIndex, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(int parameterIndex, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(int parameterIndex, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(int parameterIndex, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(int parameterIndex, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(int parameterIndex, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(int parameterIndex, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearParameters() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRef(int parameterIndex, Ref x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setArray(int parameterIndex, Array x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSetMetaData getMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(int parameterIndex, URL x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ParameterMetaData getParameterMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(int parameterIndex, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(int parameterIndex, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery(String sql) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void close() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxFieldSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxFieldSize(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxRows() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxRows(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setEscapeProcessing(boolean enable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getQueryTimeout() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setQueryTimeout(int seconds) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void cancel() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLWarning getWarnings() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearWarnings() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCursorName(String name) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getResultSet() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getUpdateCount() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchDirection(int direction) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchDirection() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchSize(int rows) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetConcurrency() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetType() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch(String sql) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int[] executeBatch() throws SQLException { + return new int[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Connection getConnection() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults(int current) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getGeneratedKeys() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, String[] columnNames) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, String[] columnNames) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetHoldability() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isClosed() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setPoolable(boolean poolable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isPoolable() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void closeOnCompletion() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isCloseOnCompletion() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public T unwrap(Class iface) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isWrapperFor(Class iface) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } +} diff --git a/src/nl/astraeus/jdbc/ConnectionLogger.java b/src/nl/astraeus/jdbc/ConnectionLogger.java index c3e243f..c359692 100644 --- a/src/nl/astraeus/jdbc/ConnectionLogger.java +++ b/src/nl/astraeus/jdbc/ConnectionLogger.java @@ -89,7 +89,7 @@ } public Statement createStatement() throws SQLException { - return connection.createStatement(); + return new StatementLogger(connection.createStatement()); } public CallableStatement prepareCall(String sql) throws SQLException { @@ -151,7 +151,7 @@ } public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { - return connection.createStatement(resultSetType, resultSetConcurrency); + return new StatementLogger(connection.createStatement(resultSetType, resultSetConcurrency)); } public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { @@ -244,27 +244,22 @@ return connection.createStruct(typeName, attributes); } - @Override public void setSchema(String schema) throws SQLException { connection.setSchema(schema); } - @Override public String getSchema() throws SQLException { return connection.getSchema(); } - @Override public void abort(Executor executor) throws SQLException { connection.abort(executor); } - @Override public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { connection.setNetworkTimeout(executor, milliseconds); } - @Override public int getNetworkTimeout() throws SQLException { return connection.getNetworkTimeout(); } diff --git a/src/nl/astraeus/jdbc/JdbcLogger.java b/src/nl/astraeus/jdbc/JdbcLogger.java index 360d4f0..2a22033 100644 --- a/src/nl/astraeus/jdbc/JdbcLogger.java +++ b/src/nl/astraeus/jdbc/JdbcLogger.java @@ -29,6 +29,7 @@ private long nano; private int hash; private int count; + private StackTraceElement[] stackTrace = null; public LogEntry(int hash, QueryType type, String sql, long milli, long nano) { this.threadId = Thread.currentThread().getId(); @@ -109,11 +110,24 @@ this.nano += le.getNano(); this.timeStamp = 0; } + + public boolean hasStackTrace() { + return stackTrace != null; + } + + public void setStackTrace(StackTraceElement[] stackTrace) { + this.stackTrace = stackTrace; + } + + public StackTraceElement[] getStackTrace() { + return stackTrace; + } } private final List queries; private long startTime; private int cacheSize; + private boolean recording = false; public JdbcLogger() { queries = new LinkedList(); @@ -121,6 +135,14 @@ cacheSize = 2500; } + public boolean isRecording() { + return recording; + } + + public void switchRecording() { + recording = !recording; + } + public void clear() { queries.clear(); } @@ -138,6 +160,14 @@ LogEntry entry = new LogEntry(hash, type, sql, milli, nano); + if (recording) { + try { + throw new IllegalStateException(); + } catch (IllegalStateException e) { + entry.setStackTrace(e.getStackTrace()); + } + } + synchronized (queries) { queries.add(entry); diff --git a/src/nl/astraeus/jdbc/PreparedStatementLogger.java b/src/nl/astraeus/jdbc/PreparedStatementLogger.java index 98aefc7..cc6c2c1 100644 --- a/src/nl/astraeus/jdbc/PreparedStatementLogger.java +++ b/src/nl/astraeus/jdbc/PreparedStatementLogger.java @@ -557,12 +557,10 @@ return statement.isPoolable(); } - @Override public void closeOnCompletion() throws SQLException { statement.closeOnCompletion();; } - @Override public boolean isCloseOnCompletion() throws SQLException { return statement.isCloseOnCompletion(); } diff --git a/src/nl/astraeus/jdbc/QueryType.java b/src/nl/astraeus/jdbc/QueryType.java index 744fbfc..d3db21c 100644 --- a/src/nl/astraeus/jdbc/QueryType.java +++ b/src/nl/astraeus/jdbc/QueryType.java @@ -9,7 +9,9 @@ PLAIN("plain"), PREPARED("prepared"), CALLABLE("callable"), - UNKNOWN("unknown"); + STATEMENT("statement"), + UNKNOWN("unknown"), + BATCH("batch"); private String description; diff --git a/src/nl/astraeus/jdbc/StatementLogger.java b/src/nl/astraeus/jdbc/StatementLogger.java new file mode 100644 index 0000000..c440e43 --- /dev/null +++ b/src/nl/astraeus/jdbc/StatementLogger.java @@ -0,0 +1,281 @@ +package nl.astraeus.jdbc; + +import java.sql.*; + +/** + * User: rnentjes + * Date: 4/17/12 + * Time: 9:32 PM + */ +public class StatementLogger implements Statement { + + private Statement statement; + + private String sql; + private long milli; + private long nano; + + public StatementLogger(Statement statement) { + this.statement = statement; + + this.sql = ""; + } + + private void clearTime() { + milli = System.currentTimeMillis(); + nano = System.nanoTime(); + } + + private void log(QueryType type, String sql) { + long m = System.currentTimeMillis() - milli; + long n = System.nanoTime() - nano; + + JdbcLogger.log(type, sql, m, n); + } + + public ResultSet executeQuery(String sql) throws SQLException { + clearTime(); + + ResultSet result = statement.executeQuery(sql); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public int executeUpdate(String sql) throws SQLException { + clearTime(); + + int result = statement.executeUpdate(sql); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public void close() throws SQLException { + clearTime(); + + statement.close(); + + log(QueryType.STATEMENT, "close"); + } + + public int getMaxFieldSize() throws SQLException { + return statement.getMaxFieldSize(); + } + + public void setMaxFieldSize(int max) throws SQLException { + statement.setMaxFieldSize(max); + } + + public int getMaxRows() throws SQLException { + return statement.getMaxRows(); + } + + public void setMaxRows(int max) throws SQLException { + statement.setMaxRows(max); + } + + public void setEscapeProcessing(boolean enable) throws SQLException { + statement.setEscapeProcessing(enable); + } + + public int getQueryTimeout() throws SQLException { + return statement.getQueryTimeout(); + } + + public void setQueryTimeout(int seconds) throws SQLException { + statement.setQueryTimeout(seconds); + } + + public void cancel() throws SQLException { + clearTime(); + + statement.cancel(); + + log(QueryType.STATEMENT, "cancel"); + } + + public SQLWarning getWarnings() throws SQLException { + return statement.getWarnings(); + } + + public void clearWarnings() throws SQLException { + statement.clearWarnings(); + } + + public void setCursorName(String name) throws SQLException { + statement.setCursorName(name); + } + + public boolean execute(String sql) throws SQLException { + clearTime(); + + boolean result = statement.execute(sql); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public ResultSet getResultSet() throws SQLException { + return statement.getResultSet(); + } + + public int getUpdateCount() throws SQLException { + return statement.getUpdateCount(); + } + + public boolean getMoreResults() throws SQLException { + return statement.getMoreResults(); + } + + public void setFetchDirection(int direction) throws SQLException { + statement.setFetchDirection(direction); + } + + public int getFetchDirection() throws SQLException { + return statement.getFetchDirection(); + } + + public void setFetchSize(int rows) throws SQLException { + statement.setFetchSize(rows); + } + + public int getFetchSize() throws SQLException { + return statement.getFetchSize(); + } + + public int getResultSetConcurrency() throws SQLException { + return statement.getResultSetConcurrency(); + } + + public int getResultSetType() throws SQLException { + return statement.getResultSetType(); + } + + public void addBatch(String sql) throws SQLException { + this.sql += "\n"+sql; + statement.addBatch(sql); + } + + public void clearBatch() throws SQLException { + this.sql = ""; + statement.clearBatch(); + } + + public int[] executeBatch() throws SQLException { + clearTime(); + + int [] result = statement.executeBatch(); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public Connection getConnection() throws SQLException { + return statement.getConnection(); + } + + public boolean getMoreResults(int current) throws SQLException { + return statement.getMoreResults(current); + } + + public ResultSet getGeneratedKeys() throws SQLException { + return statement.getGeneratedKeys(); + } + + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + clearTime(); + + int result = statement.executeUpdate(sql, autoGeneratedKeys); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { + clearTime(); + + int result = statement.executeUpdate(sql, columnIndexes); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public int executeUpdate(String sql, String[] columnNames) throws SQLException { + clearTime(); + + int result = statement.executeUpdate(sql, columnNames); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + clearTime(); + + boolean result = statement.execute(sql, autoGeneratedKeys); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + clearTime(); + + boolean result = statement.execute(sql, columnIndexes); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public boolean execute(String sql, String[] columnNames) throws SQLException { + clearTime(); + + boolean result = statement.execute(sql, columnNames); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public int getResultSetHoldability() throws SQLException { + return statement.getResultSetHoldability(); + } + + public boolean isClosed() throws SQLException { + return statement.isClosed(); + } + + public void setPoolable(boolean poolable) throws SQLException { + statement.setPoolable(poolable); + } + + public boolean isPoolable() throws SQLException { + return statement.isPoolable(); + } + + public void closeOnCompletion() throws SQLException { + statement.closeOnCompletion(); + } + + public boolean isCloseOnCompletion() throws SQLException { + return statement.isCloseOnCompletion(); + } + + public T unwrap(Class iface) throws SQLException { + return statement.unwrap(iface); + } + + public boolean isWrapperFor(Class iface) throws SQLException { + return statement.isWrapperFor(iface); + } +} diff --git a/src/nl/astraeus/jdbc/CallableStatementLogger.java b/src/nl/astraeus/jdbc/CallableStatementLogger.java new file mode 100644 index 0000000..fe50fad --- /dev/null +++ b/src/nl/astraeus/jdbc/CallableStatementLogger.java @@ -0,0 +1,864 @@ +package nl.astraeus.jdbc; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.*; +import java.util.Calendar; +import java.util.Map; + +/** + * User: rnentjes + * Date: 4/17/12 + * Time: 9:48 PM + */ +public class CallableStatementLogger implements CallableStatement { + public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean wasNull() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(int parameterIndex) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(int parameterIndex) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(String parameterName, URL val) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(String parameterName, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(String parameterName, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(String parameterName, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(String parameterName, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(String parameterName, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(String parameterName, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(String parameterName, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(String parameterName, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(String parameterName, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(String parameterName) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(String parameterName) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(String parameterName, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(String parameterName, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(int parameterIndex, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(String parameterName, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(int parameterIndex, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(int parameterIndex, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(int parameterIndex, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(int parameterIndex, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(int parameterIndex, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(int parameterIndex, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(int parameterIndex, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearParameters() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRef(int parameterIndex, Ref x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setArray(int parameterIndex, Array x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSetMetaData getMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(int parameterIndex, URL x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ParameterMetaData getParameterMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(int parameterIndex, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(int parameterIndex, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery(String sql) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void close() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxFieldSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxFieldSize(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxRows() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxRows(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setEscapeProcessing(boolean enable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getQueryTimeout() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setQueryTimeout(int seconds) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void cancel() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLWarning getWarnings() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearWarnings() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCursorName(String name) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getResultSet() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getUpdateCount() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchDirection(int direction) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchDirection() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchSize(int rows) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetConcurrency() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetType() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch(String sql) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int[] executeBatch() throws SQLException { + return new int[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Connection getConnection() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults(int current) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getGeneratedKeys() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, String[] columnNames) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, String[] columnNames) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetHoldability() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isClosed() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setPoolable(boolean poolable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isPoolable() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void closeOnCompletion() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isCloseOnCompletion() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public T unwrap(Class iface) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isWrapperFor(Class iface) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } +} diff --git a/src/nl/astraeus/jdbc/ConnectionLogger.java b/src/nl/astraeus/jdbc/ConnectionLogger.java index c3e243f..c359692 100644 --- a/src/nl/astraeus/jdbc/ConnectionLogger.java +++ b/src/nl/astraeus/jdbc/ConnectionLogger.java @@ -89,7 +89,7 @@ } public Statement createStatement() throws SQLException { - return connection.createStatement(); + return new StatementLogger(connection.createStatement()); } public CallableStatement prepareCall(String sql) throws SQLException { @@ -151,7 +151,7 @@ } public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { - return connection.createStatement(resultSetType, resultSetConcurrency); + return new StatementLogger(connection.createStatement(resultSetType, resultSetConcurrency)); } public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { @@ -244,27 +244,22 @@ return connection.createStruct(typeName, attributes); } - @Override public void setSchema(String schema) throws SQLException { connection.setSchema(schema); } - @Override public String getSchema() throws SQLException { return connection.getSchema(); } - @Override public void abort(Executor executor) throws SQLException { connection.abort(executor); } - @Override public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { connection.setNetworkTimeout(executor, milliseconds); } - @Override public int getNetworkTimeout() throws SQLException { return connection.getNetworkTimeout(); } diff --git a/src/nl/astraeus/jdbc/JdbcLogger.java b/src/nl/astraeus/jdbc/JdbcLogger.java index 360d4f0..2a22033 100644 --- a/src/nl/astraeus/jdbc/JdbcLogger.java +++ b/src/nl/astraeus/jdbc/JdbcLogger.java @@ -29,6 +29,7 @@ private long nano; private int hash; private int count; + private StackTraceElement[] stackTrace = null; public LogEntry(int hash, QueryType type, String sql, long milli, long nano) { this.threadId = Thread.currentThread().getId(); @@ -109,11 +110,24 @@ this.nano += le.getNano(); this.timeStamp = 0; } + + public boolean hasStackTrace() { + return stackTrace != null; + } + + public void setStackTrace(StackTraceElement[] stackTrace) { + this.stackTrace = stackTrace; + } + + public StackTraceElement[] getStackTrace() { + return stackTrace; + } } private final List queries; private long startTime; private int cacheSize; + private boolean recording = false; public JdbcLogger() { queries = new LinkedList(); @@ -121,6 +135,14 @@ cacheSize = 2500; } + public boolean isRecording() { + return recording; + } + + public void switchRecording() { + recording = !recording; + } + public void clear() { queries.clear(); } @@ -138,6 +160,14 @@ LogEntry entry = new LogEntry(hash, type, sql, milli, nano); + if (recording) { + try { + throw new IllegalStateException(); + } catch (IllegalStateException e) { + entry.setStackTrace(e.getStackTrace()); + } + } + synchronized (queries) { queries.add(entry); diff --git a/src/nl/astraeus/jdbc/PreparedStatementLogger.java b/src/nl/astraeus/jdbc/PreparedStatementLogger.java index 98aefc7..cc6c2c1 100644 --- a/src/nl/astraeus/jdbc/PreparedStatementLogger.java +++ b/src/nl/astraeus/jdbc/PreparedStatementLogger.java @@ -557,12 +557,10 @@ return statement.isPoolable(); } - @Override public void closeOnCompletion() throws SQLException { statement.closeOnCompletion();; } - @Override public boolean isCloseOnCompletion() throws SQLException { return statement.isCloseOnCompletion(); } diff --git a/src/nl/astraeus/jdbc/QueryType.java b/src/nl/astraeus/jdbc/QueryType.java index 744fbfc..d3db21c 100644 --- a/src/nl/astraeus/jdbc/QueryType.java +++ b/src/nl/astraeus/jdbc/QueryType.java @@ -9,7 +9,9 @@ PLAIN("plain"), PREPARED("prepared"), CALLABLE("callable"), - UNKNOWN("unknown"); + STATEMENT("statement"), + UNKNOWN("unknown"), + BATCH("batch"); private String description; diff --git a/src/nl/astraeus/jdbc/StatementLogger.java b/src/nl/astraeus/jdbc/StatementLogger.java new file mode 100644 index 0000000..c440e43 --- /dev/null +++ b/src/nl/astraeus/jdbc/StatementLogger.java @@ -0,0 +1,281 @@ +package nl.astraeus.jdbc; + +import java.sql.*; + +/** + * User: rnentjes + * Date: 4/17/12 + * Time: 9:32 PM + */ +public class StatementLogger implements Statement { + + private Statement statement; + + private String sql; + private long milli; + private long nano; + + public StatementLogger(Statement statement) { + this.statement = statement; + + this.sql = ""; + } + + private void clearTime() { + milli = System.currentTimeMillis(); + nano = System.nanoTime(); + } + + private void log(QueryType type, String sql) { + long m = System.currentTimeMillis() - milli; + long n = System.nanoTime() - nano; + + JdbcLogger.log(type, sql, m, n); + } + + public ResultSet executeQuery(String sql) throws SQLException { + clearTime(); + + ResultSet result = statement.executeQuery(sql); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public int executeUpdate(String sql) throws SQLException { + clearTime(); + + int result = statement.executeUpdate(sql); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public void close() throws SQLException { + clearTime(); + + statement.close(); + + log(QueryType.STATEMENT, "close"); + } + + public int getMaxFieldSize() throws SQLException { + return statement.getMaxFieldSize(); + } + + public void setMaxFieldSize(int max) throws SQLException { + statement.setMaxFieldSize(max); + } + + public int getMaxRows() throws SQLException { + return statement.getMaxRows(); + } + + public void setMaxRows(int max) throws SQLException { + statement.setMaxRows(max); + } + + public void setEscapeProcessing(boolean enable) throws SQLException { + statement.setEscapeProcessing(enable); + } + + public int getQueryTimeout() throws SQLException { + return statement.getQueryTimeout(); + } + + public void setQueryTimeout(int seconds) throws SQLException { + statement.setQueryTimeout(seconds); + } + + public void cancel() throws SQLException { + clearTime(); + + statement.cancel(); + + log(QueryType.STATEMENT, "cancel"); + } + + public SQLWarning getWarnings() throws SQLException { + return statement.getWarnings(); + } + + public void clearWarnings() throws SQLException { + statement.clearWarnings(); + } + + public void setCursorName(String name) throws SQLException { + statement.setCursorName(name); + } + + public boolean execute(String sql) throws SQLException { + clearTime(); + + boolean result = statement.execute(sql); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public ResultSet getResultSet() throws SQLException { + return statement.getResultSet(); + } + + public int getUpdateCount() throws SQLException { + return statement.getUpdateCount(); + } + + public boolean getMoreResults() throws SQLException { + return statement.getMoreResults(); + } + + public void setFetchDirection(int direction) throws SQLException { + statement.setFetchDirection(direction); + } + + public int getFetchDirection() throws SQLException { + return statement.getFetchDirection(); + } + + public void setFetchSize(int rows) throws SQLException { + statement.setFetchSize(rows); + } + + public int getFetchSize() throws SQLException { + return statement.getFetchSize(); + } + + public int getResultSetConcurrency() throws SQLException { + return statement.getResultSetConcurrency(); + } + + public int getResultSetType() throws SQLException { + return statement.getResultSetType(); + } + + public void addBatch(String sql) throws SQLException { + this.sql += "\n"+sql; + statement.addBatch(sql); + } + + public void clearBatch() throws SQLException { + this.sql = ""; + statement.clearBatch(); + } + + public int[] executeBatch() throws SQLException { + clearTime(); + + int [] result = statement.executeBatch(); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public Connection getConnection() throws SQLException { + return statement.getConnection(); + } + + public boolean getMoreResults(int current) throws SQLException { + return statement.getMoreResults(current); + } + + public ResultSet getGeneratedKeys() throws SQLException { + return statement.getGeneratedKeys(); + } + + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + clearTime(); + + int result = statement.executeUpdate(sql, autoGeneratedKeys); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { + clearTime(); + + int result = statement.executeUpdate(sql, columnIndexes); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public int executeUpdate(String sql, String[] columnNames) throws SQLException { + clearTime(); + + int result = statement.executeUpdate(sql, columnNames); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + clearTime(); + + boolean result = statement.execute(sql, autoGeneratedKeys); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + clearTime(); + + boolean result = statement.execute(sql, columnIndexes); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public boolean execute(String sql, String[] columnNames) throws SQLException { + clearTime(); + + boolean result = statement.execute(sql, columnNames); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public int getResultSetHoldability() throws SQLException { + return statement.getResultSetHoldability(); + } + + public boolean isClosed() throws SQLException { + return statement.isClosed(); + } + + public void setPoolable(boolean poolable) throws SQLException { + statement.setPoolable(poolable); + } + + public boolean isPoolable() throws SQLException { + return statement.isPoolable(); + } + + public void closeOnCompletion() throws SQLException { + statement.closeOnCompletion(); + } + + public boolean isCloseOnCompletion() throws SQLException { + return statement.isCloseOnCompletion(); + } + + public T unwrap(Class iface) throws SQLException { + return statement.unwrap(iface); + } + + public boolean isWrapperFor(Class iface) throws SQLException { + return statement.isWrapperFor(iface); + } +} diff --git a/src/nl/astraeus/jdbc/web/JdbcStatisticsServlet.java b/src/nl/astraeus/jdbc/web/JdbcStatisticsServlet.java index aa7ac30..7785ccf 100644 --- a/src/nl/astraeus/jdbc/web/JdbcStatisticsServlet.java +++ b/src/nl/astraeus/jdbc/web/JdbcStatisticsServlet.java @@ -5,6 +5,7 @@ import nl.astraeus.jdbc.web.page.Menu; import nl.astraeus.jdbc.web.page.Page; import nl.astraeus.jdbc.web.page.QueryOverview; +import nl.astraeus.jdbc.web.page.Settings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -66,6 +67,8 @@ if (page == null || "menumain".equals(req.getParameter("action"))) { page = new QueryOverview(); + } else if ("menusettings".equals(req.getParameter("action"))) { + page = new Settings(); } else if ("diagnostics".equals(req.getParameter("action"))) { //page = new Diagnostics(); } else { diff --git a/src/nl/astraeus/jdbc/CallableStatementLogger.java b/src/nl/astraeus/jdbc/CallableStatementLogger.java new file mode 100644 index 0000000..fe50fad --- /dev/null +++ b/src/nl/astraeus/jdbc/CallableStatementLogger.java @@ -0,0 +1,864 @@ +package nl.astraeus.jdbc; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.*; +import java.util.Calendar; +import java.util.Map; + +/** + * User: rnentjes + * Date: 4/17/12 + * Time: 9:48 PM + */ +public class CallableStatementLogger implements CallableStatement { + public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean wasNull() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(int parameterIndex) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(int parameterIndex) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(int parameterIndex) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(int parameterIndex, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(String parameterName, URL val) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(String parameterName, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(String parameterName, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(String parameterName, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(String parameterName, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(String parameterName, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(String parameterName, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(String parameterName, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(String parameterName, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(String parameterName, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(String parameterName, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public String getString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getBoolean(String parameterName) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte getByte(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public short getShort(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getInt(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public long getLong(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public float getFloat(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public double getDouble(String parameterName) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public byte[] getBytes(String parameterName) throws SQLException { + return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public BigDecimal getBigDecimal(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Object getObject(String parameterName, Map> map) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Ref getRef(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Blob getBlob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Clob getClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Array getArray(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Date getDate(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Time getTime(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public URL getURL(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public RowId getRowId(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(String parameterName, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(String parameterName, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public NClob getNClob(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLXML getSQLXML(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public String getNString(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getNCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(int parameterIndex) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Reader getCharacterStream(String parameterName) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(String parameterName, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(String parameterName, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(String parameterName, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(String parameterName, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(int parameterIndex, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public T getObject(String parameterName, Class type) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setByte(int parameterIndex, byte x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setShort(int parameterIndex, short x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setInt(int parameterIndex, int x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setLong(int parameterIndex, long x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFloat(int parameterIndex, float x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDouble(int parameterIndex, double x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setString(int parameterIndex, String x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearParameters() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRef(int parameterIndex, Ref x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, Blob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Clob x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setArray(int parameterIndex, Array x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSetMetaData getMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setURL(int parameterIndex, URL x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ParameterMetaData getParameterMetaData() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setRowId(int parameterIndex, RowId x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNString(int parameterIndex, String value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, NClob value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet executeQuery(String sql) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void close() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxFieldSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxFieldSize(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getMaxRows() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setMaxRows(int max) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setEscapeProcessing(boolean enable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getQueryTimeout() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setQueryTimeout(int seconds) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void cancel() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public SQLWarning getWarnings() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearWarnings() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void setCursorName(String name) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getResultSet() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getUpdateCount() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchDirection(int direction) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchDirection() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setFetchSize(int rows) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int getFetchSize() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetConcurrency() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetType() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addBatch(String sql) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void clearBatch() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public int[] executeBatch() throws SQLException { + return new int[0]; //To change body of implemented methods use File | Settings | File Templates. + } + + public Connection getConnection() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean getMoreResults(int current) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public ResultSet getGeneratedKeys() throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public int executeUpdate(String sql, String[] columnNames) throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean execute(String sql, String[] columnNames) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public int getResultSetHoldability() throws SQLException { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isClosed() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void setPoolable(boolean poolable) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isPoolable() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public void closeOnCompletion() throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isCloseOnCompletion() throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } + + public T unwrap(Class iface) throws SQLException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public boolean isWrapperFor(Class iface) throws SQLException { + return false; //To change body of implemented methods use File | Settings | File Templates. + } +} diff --git a/src/nl/astraeus/jdbc/ConnectionLogger.java b/src/nl/astraeus/jdbc/ConnectionLogger.java index c3e243f..c359692 100644 --- a/src/nl/astraeus/jdbc/ConnectionLogger.java +++ b/src/nl/astraeus/jdbc/ConnectionLogger.java @@ -89,7 +89,7 @@ } public Statement createStatement() throws SQLException { - return connection.createStatement(); + return new StatementLogger(connection.createStatement()); } public CallableStatement prepareCall(String sql) throws SQLException { @@ -151,7 +151,7 @@ } public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { - return connection.createStatement(resultSetType, resultSetConcurrency); + return new StatementLogger(connection.createStatement(resultSetType, resultSetConcurrency)); } public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { @@ -244,27 +244,22 @@ return connection.createStruct(typeName, attributes); } - @Override public void setSchema(String schema) throws SQLException { connection.setSchema(schema); } - @Override public String getSchema() throws SQLException { return connection.getSchema(); } - @Override public void abort(Executor executor) throws SQLException { connection.abort(executor); } - @Override public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { connection.setNetworkTimeout(executor, milliseconds); } - @Override public int getNetworkTimeout() throws SQLException { return connection.getNetworkTimeout(); } diff --git a/src/nl/astraeus/jdbc/JdbcLogger.java b/src/nl/astraeus/jdbc/JdbcLogger.java index 360d4f0..2a22033 100644 --- a/src/nl/astraeus/jdbc/JdbcLogger.java +++ b/src/nl/astraeus/jdbc/JdbcLogger.java @@ -29,6 +29,7 @@ private long nano; private int hash; private int count; + private StackTraceElement[] stackTrace = null; public LogEntry(int hash, QueryType type, String sql, long milli, long nano) { this.threadId = Thread.currentThread().getId(); @@ -109,11 +110,24 @@ this.nano += le.getNano(); this.timeStamp = 0; } + + public boolean hasStackTrace() { + return stackTrace != null; + } + + public void setStackTrace(StackTraceElement[] stackTrace) { + this.stackTrace = stackTrace; + } + + public StackTraceElement[] getStackTrace() { + return stackTrace; + } } private final List queries; private long startTime; private int cacheSize; + private boolean recording = false; public JdbcLogger() { queries = new LinkedList(); @@ -121,6 +135,14 @@ cacheSize = 2500; } + public boolean isRecording() { + return recording; + } + + public void switchRecording() { + recording = !recording; + } + public void clear() { queries.clear(); } @@ -138,6 +160,14 @@ LogEntry entry = new LogEntry(hash, type, sql, milli, nano); + if (recording) { + try { + throw new IllegalStateException(); + } catch (IllegalStateException e) { + entry.setStackTrace(e.getStackTrace()); + } + } + synchronized (queries) { queries.add(entry); diff --git a/src/nl/astraeus/jdbc/PreparedStatementLogger.java b/src/nl/astraeus/jdbc/PreparedStatementLogger.java index 98aefc7..cc6c2c1 100644 --- a/src/nl/astraeus/jdbc/PreparedStatementLogger.java +++ b/src/nl/astraeus/jdbc/PreparedStatementLogger.java @@ -557,12 +557,10 @@ return statement.isPoolable(); } - @Override public void closeOnCompletion() throws SQLException { statement.closeOnCompletion();; } - @Override public boolean isCloseOnCompletion() throws SQLException { return statement.isCloseOnCompletion(); } diff --git a/src/nl/astraeus/jdbc/QueryType.java b/src/nl/astraeus/jdbc/QueryType.java index 744fbfc..d3db21c 100644 --- a/src/nl/astraeus/jdbc/QueryType.java +++ b/src/nl/astraeus/jdbc/QueryType.java @@ -9,7 +9,9 @@ PLAIN("plain"), PREPARED("prepared"), CALLABLE("callable"), - UNKNOWN("unknown"); + STATEMENT("statement"), + UNKNOWN("unknown"), + BATCH("batch"); private String description; diff --git a/src/nl/astraeus/jdbc/StatementLogger.java b/src/nl/astraeus/jdbc/StatementLogger.java new file mode 100644 index 0000000..c440e43 --- /dev/null +++ b/src/nl/astraeus/jdbc/StatementLogger.java @@ -0,0 +1,281 @@ +package nl.astraeus.jdbc; + +import java.sql.*; + +/** + * User: rnentjes + * Date: 4/17/12 + * Time: 9:32 PM + */ +public class StatementLogger implements Statement { + + private Statement statement; + + private String sql; + private long milli; + private long nano; + + public StatementLogger(Statement statement) { + this.statement = statement; + + this.sql = ""; + } + + private void clearTime() { + milli = System.currentTimeMillis(); + nano = System.nanoTime(); + } + + private void log(QueryType type, String sql) { + long m = System.currentTimeMillis() - milli; + long n = System.nanoTime() - nano; + + JdbcLogger.log(type, sql, m, n); + } + + public ResultSet executeQuery(String sql) throws SQLException { + clearTime(); + + ResultSet result = statement.executeQuery(sql); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public int executeUpdate(String sql) throws SQLException { + clearTime(); + + int result = statement.executeUpdate(sql); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public void close() throws SQLException { + clearTime(); + + statement.close(); + + log(QueryType.STATEMENT, "close"); + } + + public int getMaxFieldSize() throws SQLException { + return statement.getMaxFieldSize(); + } + + public void setMaxFieldSize(int max) throws SQLException { + statement.setMaxFieldSize(max); + } + + public int getMaxRows() throws SQLException { + return statement.getMaxRows(); + } + + public void setMaxRows(int max) throws SQLException { + statement.setMaxRows(max); + } + + public void setEscapeProcessing(boolean enable) throws SQLException { + statement.setEscapeProcessing(enable); + } + + public int getQueryTimeout() throws SQLException { + return statement.getQueryTimeout(); + } + + public void setQueryTimeout(int seconds) throws SQLException { + statement.setQueryTimeout(seconds); + } + + public void cancel() throws SQLException { + clearTime(); + + statement.cancel(); + + log(QueryType.STATEMENT, "cancel"); + } + + public SQLWarning getWarnings() throws SQLException { + return statement.getWarnings(); + } + + public void clearWarnings() throws SQLException { + statement.clearWarnings(); + } + + public void setCursorName(String name) throws SQLException { + statement.setCursorName(name); + } + + public boolean execute(String sql) throws SQLException { + clearTime(); + + boolean result = statement.execute(sql); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public ResultSet getResultSet() throws SQLException { + return statement.getResultSet(); + } + + public int getUpdateCount() throws SQLException { + return statement.getUpdateCount(); + } + + public boolean getMoreResults() throws SQLException { + return statement.getMoreResults(); + } + + public void setFetchDirection(int direction) throws SQLException { + statement.setFetchDirection(direction); + } + + public int getFetchDirection() throws SQLException { + return statement.getFetchDirection(); + } + + public void setFetchSize(int rows) throws SQLException { + statement.setFetchSize(rows); + } + + public int getFetchSize() throws SQLException { + return statement.getFetchSize(); + } + + public int getResultSetConcurrency() throws SQLException { + return statement.getResultSetConcurrency(); + } + + public int getResultSetType() throws SQLException { + return statement.getResultSetType(); + } + + public void addBatch(String sql) throws SQLException { + this.sql += "\n"+sql; + statement.addBatch(sql); + } + + public void clearBatch() throws SQLException { + this.sql = ""; + statement.clearBatch(); + } + + public int[] executeBatch() throws SQLException { + clearTime(); + + int [] result = statement.executeBatch(); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public Connection getConnection() throws SQLException { + return statement.getConnection(); + } + + public boolean getMoreResults(int current) throws SQLException { + return statement.getMoreResults(current); + } + + public ResultSet getGeneratedKeys() throws SQLException { + return statement.getGeneratedKeys(); + } + + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + clearTime(); + + int result = statement.executeUpdate(sql, autoGeneratedKeys); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { + clearTime(); + + int result = statement.executeUpdate(sql, columnIndexes); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public int executeUpdate(String sql, String[] columnNames) throws SQLException { + clearTime(); + + int result = statement.executeUpdate(sql, columnNames); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + clearTime(); + + boolean result = statement.execute(sql, autoGeneratedKeys); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + clearTime(); + + boolean result = statement.execute(sql, columnIndexes); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public boolean execute(String sql, String[] columnNames) throws SQLException { + clearTime(); + + boolean result = statement.execute(sql, columnNames); + + log(QueryType.STATEMENT, sql); + + return result; + } + + public int getResultSetHoldability() throws SQLException { + return statement.getResultSetHoldability(); + } + + public boolean isClosed() throws SQLException { + return statement.isClosed(); + } + + public void setPoolable(boolean poolable) throws SQLException { + statement.setPoolable(poolable); + } + + public boolean isPoolable() throws SQLException { + return statement.isPoolable(); + } + + public void closeOnCompletion() throws SQLException { + statement.closeOnCompletion(); + } + + public boolean isCloseOnCompletion() throws SQLException { + return statement.isCloseOnCompletion(); + } + + public T unwrap(Class iface) throws SQLException { + return statement.unwrap(iface); + } + + public boolean isWrapperFor(Class iface) throws SQLException { + return statement.isWrapperFor(iface); + } +} diff --git a/src/nl/astraeus/jdbc/web/JdbcStatisticsServlet.java b/src/nl/astraeus/jdbc/web/JdbcStatisticsServlet.java index aa7ac30..7785ccf 100644 --- a/src/nl/astraeus/jdbc/web/JdbcStatisticsServlet.java +++ b/src/nl/astraeus/jdbc/web/JdbcStatisticsServlet.java @@ -5,6 +5,7 @@ import nl.astraeus.jdbc.web.page.Menu; import nl.astraeus.jdbc.web.page.Page; import nl.astraeus.jdbc.web.page.QueryOverview; +import nl.astraeus.jdbc.web.page.Settings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -66,6 +67,8 @@ if (page == null || "menumain".equals(req.getParameter("action"))) { page = new QueryOverview(); + } else if ("menusettings".equals(req.getParameter("action"))) { + page = new Settings(); } else if ("diagnostics".equals(req.getParameter("action"))) { //page = new Diagnostics(); } else { diff --git a/src/nl/astraeus/jdbc/web/page/Menu.html b/src/nl/astraeus/jdbc/web/page/Menu.html index c3eca80..1935d6f 100644 --- a/src/nl/astraeus/jdbc/web/page/Menu.html +++ b/src/nl/astraeus/jdbc/web/page/Menu.html @@ -11,6 +11,9 @@ + {if(user.superuser)}