diff --git a/.idea/ant.xml b/.idea/ant.xml index 48b830b..962ec30 100644 --- a/.idea/ant.xml +++ b/.idea/ant.xml @@ -2,8 +2,5 @@ - - - - + \ No newline at end of file diff --git a/.idea/ant.xml b/.idea/ant.xml index 48b830b..962ec30 100644 --- a/.idea/ant.xml +++ b/.idea/ant.xml @@ -2,8 +2,5 @@ - - - - + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..1c24f9a --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/ant.xml b/.idea/ant.xml index 48b830b..962ec30 100644 --- a/.idea/ant.xml +++ b/.idea/ant.xml @@ -2,8 +2,5 @@ - - - - + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..1c24f9a --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/ant.xml b/.idea/ant.xml index 48b830b..962ec30 100644 --- a/.idea/ant.xml +++ b/.idea/ant.xml @@ -2,8 +2,5 @@ - - - - + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..1c24f9a --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml new file mode 100644 index 0000000..69734e5 --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/ant.xml b/.idea/ant.xml index 48b830b..962ec30 100644 --- a/.idea/ant.xml +++ b/.idea/ant.xml @@ -2,8 +2,5 @@ - - - - + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..1c24f9a --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml new file mode 100644 index 0000000..69734e5 --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 3c73706..c6f0260 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,7 +5,7 @@ http://www.w3.org/1999/xhtml - + diff --git a/.idea/ant.xml b/.idea/ant.xml index 48b830b..962ec30 100644 --- a/.idea/ant.xml +++ b/.idea/ant.xml @@ -2,8 +2,5 @@ - - - - + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..1c24f9a --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml new file mode 100644 index 0000000..69734e5 --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 3c73706..c6f0260 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,7 +5,7 @@ http://www.w3.org/1999/xhtml - + diff --git a/.idea/modules/simple-jdbc-stats.iml b/.idea/modules/simple-jdbc-stats.iml index cbcf482..f475070 100644 --- a/.idea/modules/simple-jdbc-stats.iml +++ b/.idea/modules/simple-jdbc-stats.iml @@ -1,5 +1,5 @@ - + diff --git a/.idea/ant.xml b/.idea/ant.xml index 48b830b..962ec30 100644 --- a/.idea/ant.xml +++ b/.idea/ant.xml @@ -2,8 +2,5 @@ - - - - + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..1c24f9a --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml new file mode 100644 index 0000000..69734e5 --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 3c73706..c6f0260 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,7 +5,7 @@ http://www.w3.org/1999/xhtml - + diff --git a/.idea/modules/simple-jdbc-stats.iml b/.idea/modules/simple-jdbc-stats.iml index cbcf482..f475070 100644 --- a/.idea/modules/simple-jdbc-stats.iml +++ b/.idea/modules/simple-jdbc-stats.iml @@ -1,5 +1,5 @@ - + diff --git a/.idea/modules/simple-jdbc-stats_main.iml b/.idea/modules/simple-jdbc-stats_main.iml index e9dc0d4..880a282 100644 --- a/.idea/modules/simple-jdbc-stats_main.iml +++ b/.idea/modules/simple-jdbc-stats_main.iml @@ -1,6 +1,6 @@ - - + + diff --git a/.idea/ant.xml b/.idea/ant.xml index 48b830b..962ec30 100644 --- a/.idea/ant.xml +++ b/.idea/ant.xml @@ -2,8 +2,5 @@ - - - - + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..1c24f9a --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml new file mode 100644 index 0000000..69734e5 --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 3c73706..c6f0260 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,7 +5,7 @@ http://www.w3.org/1999/xhtml - + diff --git a/.idea/modules/simple-jdbc-stats.iml b/.idea/modules/simple-jdbc-stats.iml index cbcf482..f475070 100644 --- a/.idea/modules/simple-jdbc-stats.iml +++ b/.idea/modules/simple-jdbc-stats.iml @@ -1,5 +1,5 @@ - + diff --git a/.idea/modules/simple-jdbc-stats_main.iml b/.idea/modules/simple-jdbc-stats_main.iml index e9dc0d4..880a282 100644 --- a/.idea/modules/simple-jdbc-stats_main.iml +++ b/.idea/modules/simple-jdbc-stats_main.iml @@ -1,6 +1,6 @@ - - + + diff --git a/.idea/modules/simple-jdbc-stats_test.iml b/.idea/modules/simple-jdbc-stats_test.iml index f5ab325..4465e5c 100644 --- a/.idea/modules/simple-jdbc-stats_test.iml +++ b/.idea/modules/simple-jdbc-stats_test.iml @@ -1,6 +1,6 @@ - - + + @@ -17,7 +17,7 @@ - + diff --git a/.idea/ant.xml b/.idea/ant.xml index 48b830b..962ec30 100644 --- a/.idea/ant.xml +++ b/.idea/ant.xml @@ -2,8 +2,5 @@ - - - - + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..1c24f9a --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml new file mode 100644 index 0000000..69734e5 --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 3c73706..c6f0260 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,7 +5,7 @@ http://www.w3.org/1999/xhtml - + diff --git a/.idea/modules/simple-jdbc-stats.iml b/.idea/modules/simple-jdbc-stats.iml index cbcf482..f475070 100644 --- a/.idea/modules/simple-jdbc-stats.iml +++ b/.idea/modules/simple-jdbc-stats.iml @@ -1,5 +1,5 @@ - + diff --git a/.idea/modules/simple-jdbc-stats_main.iml b/.idea/modules/simple-jdbc-stats_main.iml index e9dc0d4..880a282 100644 --- a/.idea/modules/simple-jdbc-stats_main.iml +++ b/.idea/modules/simple-jdbc-stats_main.iml @@ -1,6 +1,6 @@ - - + + diff --git a/.idea/modules/simple-jdbc-stats_test.iml b/.idea/modules/simple-jdbc-stats_test.iml index f5ab325..4465e5c 100644 --- a/.idea/modules/simple-jdbc-stats_test.iml +++ b/.idea/modules/simple-jdbc-stats_test.iml @@ -1,6 +1,6 @@ - - + + @@ -17,7 +17,7 @@ - + diff --git a/src/nl/astraeus/jdbc/CallableStatementLogger.java b/src/nl/astraeus/jdbc/CallableStatementLogger.java index 797c9fe..2e9f173 100644 --- a/src/nl/astraeus/jdbc/CallableStatementLogger.java +++ b/src/nl/astraeus/jdbc/CallableStatementLogger.java @@ -1,26 +1,13 @@ package nl.astraeus.jdbc; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.Date; -import java.sql.NClob; -import java.sql.ParameterMetaData; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Time; -import java.sql.Timestamp; +import java.sql.*; import java.util.Calendar; import java.util.Map; @@ -30,851 +17,971 @@ * Time: 9:48 PM */ public class CallableStatementLogger implements CallableStatement { + private final static Logger log = LoggerFactory.getLogger(PreparedStatementLogger.class); + + private JdbcLogger logger; + private CallableStatement statement; + + private String sql; + private QueryType type; + private boolean autocommit; + private long milli; + private long nano; + + public CallableStatementLogger(JdbcLogger logger, Connection connection, String sql) throws SQLException { + this.logger = logger; + this.sql = sql; + this.type = QueryType.CALLABLE; + clearTime(); + statement = connection.prepareCall(sql); + } + + public CallableStatementLogger(JdbcLogger logger, Connection connection, String sql, int resultSetType, int resultSetConcurrency) throws SQLException { + this.logger = logger; + this.sql = sql; + this.type = QueryType.CALLABLE; + clearTime(); + statement = connection.prepareCall(sql, resultSetType, resultSetConcurrency); + } + + public CallableStatementLogger(JdbcLogger logger, Connection connection, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + this.logger = logger; + this.sql = sql; + this.type = QueryType.CALLABLE; + clearTime(); + statement = connection.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability); + } + + private void clearTime() { + milli = System.currentTimeMillis(); + nano = System.nanoTime(); + } + + private void log(QueryType type, String sql) throws SQLException { + long m = System.currentTimeMillis() - milli; + long n = System.nanoTime() - nano; + + logger.logEntry(type, sql, m, n, autocommit); + } + public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.registerOutParameter(parameterIndex, sqlType); } public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.registerOutParameter(parameterIndex, sqlType, scale); } public boolean wasNull() throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.wasNull(); } public String getString(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getString(parameterIndex); } public boolean getBoolean(int parameterIndex) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBoolean(parameterIndex); } public byte getByte(int parameterIndex) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getByte(parameterIndex); } public short getShort(int parameterIndex) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getShort(parameterIndex); } public int getInt(int parameterIndex) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getInt(parameterIndex); } public long getLong(int parameterIndex) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getLong(parameterIndex); } public float getFloat(int parameterIndex) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getFloat(parameterIndex); } public double getDouble(int parameterIndex) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getDouble(parameterIndex); } public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBigDecimal(parameterIndex, scale); } public byte[] getBytes(int parameterIndex) throws SQLException { - return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBytes(parameterIndex); } public Date getDate(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getDate(parameterIndex); } public Time getTime(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTime(parameterIndex); } public Timestamp getTimestamp(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTimestamp(parameterIndex); } public Object getObject(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getObject(parameterIndex); } public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBigDecimal(parameterIndex); } public Object getObject(int parameterIndex, Map> map) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getObject(parameterIndex, map); } public Ref getRef(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getRef(parameterIndex); } public Blob getBlob(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBlob(parameterIndex); } public Clob getClob(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getClob(parameterIndex); } public Array getArray(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getArray(parameterIndex); } public Date getDate(int parameterIndex, Calendar cal) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getDate(parameterIndex, cal); } public Time getTime(int parameterIndex, Calendar cal) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTime(parameterIndex, cal); } public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTimestamp(parameterIndex, cal); } public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.registerOutParameter(parameterIndex, sqlType, typeName); } public void registerOutParameter(String parameterName, int sqlType) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.registerOutParameter(parameterName, sqlType); } public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.registerOutParameter(parameterName, sqlType, scale); } public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.registerOutParameter(parameterName, sqlType, typeName); } public URL getURL(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getURL(parameterIndex); } public void setURL(String parameterName, URL val) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setURL(parameterName, val); } public void setNull(String parameterName, int sqlType) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNull(parameterName, sqlType); } public void setBoolean(String parameterName, boolean x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBoolean(parameterName, x); } public void setByte(String parameterName, byte x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setByte(parameterName, x); } public void setShort(String parameterName, short x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setShort(parameterName, x); } public void setInt(String parameterName, int x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setInt(parameterName, x); } public void setLong(String parameterName, long x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setLong(parameterName, x); } public void setFloat(String parameterName, float x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setFloat(parameterName, x); } public void setDouble(String parameterName, double x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setDouble(parameterName, x); } public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBigDecimal(parameterName, x); } public void setString(String parameterName, String x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setString(parameterName, x); } public void setBytes(String parameterName, byte[] x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBytes(parameterName, x); } public void setDate(String parameterName, Date x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setDate(parameterName, x); } public void setTime(String parameterName, Time x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTime(parameterName, x); } public void setTimestamp(String parameterName, Timestamp x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTimestamp(parameterName, x); } public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setAsciiStream(parameterName, x, length); } public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBinaryStream(parameterName, x, length); } public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setObject(parameterName, x, targetSqlType, scale); } public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setObject(parameterName, x, targetSqlType); } public void setObject(String parameterName, Object x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setObject(parameterName, x); } public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCharacterStream(parameterName, reader, length); } public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setDate(parameterName, x, cal); } public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTime(parameterName, x, cal); } public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTimestamp(parameterName, x, cal); } public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNull(parameterName, sqlType, typeName); } public String getString(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getString(parameterName); } public boolean getBoolean(String parameterName) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBoolean(parameterName); } public byte getByte(String parameterName) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getByte(parameterName); } public short getShort(String parameterName) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getShort(parameterName); } public int getInt(String parameterName) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getShort(parameterName); } public long getLong(String parameterName) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getLong(parameterName); } public float getFloat(String parameterName) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getFloat(parameterName); } public double getDouble(String parameterName) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getDouble(parameterName); } public byte[] getBytes(String parameterName) throws SQLException { - return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBytes(parameterName); } public Date getDate(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getDate(parameterName); } public Time getTime(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTime(parameterName); } public Timestamp getTimestamp(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTimestamp(parameterName); } public Object getObject(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getObject(parameterName); } public BigDecimal getBigDecimal(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBigDecimal(parameterName); } public Object getObject(String parameterName, Map> map) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getObject(parameterName, map); } public Ref getRef(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getRef(parameterName); } public Blob getBlob(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBlob(parameterName); } public Clob getClob(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getClob(parameterName); } public Array getArray(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getArray(parameterName); } public Date getDate(String parameterName, Calendar cal) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getDate(parameterName, cal); } public Time getTime(String parameterName, Calendar cal) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTime(parameterName, cal); } public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTimestamp(parameterName, cal); } public URL getURL(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getURL(parameterName); } public RowId getRowId(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getRowId(parameterIndex); } public RowId getRowId(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getRowId(parameterName); } public void setRowId(String parameterName, RowId x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setRowId(parameterName, x); } public void setNString(String parameterName, String value) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNString(parameterName, value); } public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNCharacterStream(parameterName, value, length); } public void setNClob(String parameterName, NClob value) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNClob(parameterName, value); } public void setClob(String parameterName, Reader reader, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setClob(parameterName, reader, length); } public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBlob(parameterName, inputStream, length); } public void setNClob(String parameterName, Reader reader, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNClob(parameterName, reader, length); } public NClob getNClob(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getNClob(parameterIndex); } public NClob getNClob(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getNClob(parameterName); } public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setSQLXML(parameterName, xmlObject); } public SQLXML getSQLXML(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getSQLXML(parameterIndex); } public SQLXML getSQLXML(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getSQLXML(parameterName); } public String getNString(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getNString(parameterIndex); } public String getNString(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getNString(parameterName); } public Reader getNCharacterStream(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getNCharacterStream(parameterIndex); } public Reader getNCharacterStream(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getNCharacterStream(parameterName); } public Reader getCharacterStream(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getCharacterStream(parameterIndex); } public Reader getCharacterStream(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getCharacterStream(parameterName); } public void setBlob(String parameterName, Blob x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBlob(parameterName, x); } public void setClob(String parameterName, Clob x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setClob(parameterName, x); } public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setAsciiStream(parameterName, x, length); } public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBinaryStream(parameterName, x, length); } public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCharacterStream(parameterName, reader, length); } public void setAsciiStream(String parameterName, InputStream x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setAsciiStream(parameterName, x); } public void setBinaryStream(String parameterName, InputStream x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBinaryStream(parameterName, x); } public void setCharacterStream(String parameterName, Reader reader) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCharacterStream(parameterName, reader); } public void setNCharacterStream(String parameterName, Reader value) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNCharacterStream(parameterName, value); } public void setClob(String parameterName, Reader reader) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setClob(parameterName, reader); } public void setBlob(String parameterName, InputStream inputStream) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBlob(parameterName, inputStream); } public void setNClob(String parameterName, Reader reader) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNClob(parameterName, reader); } public T getObject(int parameterIndex, Class type) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getObject(parameterIndex, type); } public T getObject(String parameterName, Class type) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getObject(parameterName, type); } public ResultSet executeQuery() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeQuery(); + } finally { + log(QueryType.CALLABLE, sql); + } } public int executeUpdate() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeUpdate(); + } finally { + log(QueryType.CALLABLE, sql); + } } public void setNull(int parameterIndex, int sqlType) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNull(parameterIndex, sqlType); } public void setBoolean(int parameterIndex, boolean x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBoolean(parameterIndex, x); } public void setByte(int parameterIndex, byte x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setByte(parameterIndex, x); } public void setShort(int parameterIndex, short x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setShort(parameterIndex, x); } public void setInt(int parameterIndex, int x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setInt(parameterIndex, x); } public void setLong(int parameterIndex, long x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setLong(parameterIndex, x); } public void setFloat(int parameterIndex, float x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setFloat(parameterIndex, x); } public void setDouble(int parameterIndex, double x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setDouble(parameterIndex, x); } public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBigDecimal(parameterIndex, x); } public void setString(int parameterIndex, String x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setString(parameterIndex, x); } public void setBytes(int parameterIndex, byte[] x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBytes(parameterIndex, x); } public void setDate(int parameterIndex, Date x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setDate(parameterIndex, x); } public void setTime(int parameterIndex, Time x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTime(parameterIndex, x); } public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTimestamp(parameterIndex, x); } public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setAsciiStream(parameterIndex, x, length); } public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setUnicodeStream(parameterIndex, x, length); } public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBinaryStream(parameterIndex, x, length); } public void clearParameters() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.clearParameters(); } public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setObject(parameterIndex, x, targetSqlType); } public void setObject(int parameterIndex, Object x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setObject(parameterIndex, x); } public boolean execute() throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.execute(); + } finally { + log(QueryType.CALLABLE, sql); + } } public void addBatch() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.addBatch(); } public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCharacterStream(parameterIndex, reader, length); } public void setRef(int parameterIndex, Ref x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setRef(parameterIndex, x); } public void setBlob(int parameterIndex, Blob x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBlob(parameterIndex, x); } public void setClob(int parameterIndex, Clob x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setClob(parameterIndex, x); } public void setArray(int parameterIndex, Array x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setArray(parameterIndex, x); } public ResultSetMetaData getMetaData() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getMetaData(); } public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setDate(parameterIndex, x, cal); } public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTime(parameterIndex, x, cal); } public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTimestamp(parameterIndex, x, cal); } public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNull(parameterIndex, sqlType, typeName); } public void setURL(int parameterIndex, URL x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setURL(parameterIndex, x); } public ParameterMetaData getParameterMetaData() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getParameterMetaData(); } public void setRowId(int parameterIndex, RowId x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setRowId(parameterIndex, x); } public void setNString(int parameterIndex, String value) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNString(parameterIndex, value); } public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNCharacterStream(parameterIndex, value, length); } public void setNClob(int parameterIndex, NClob value) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNClob(parameterIndex, value); } public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setClob(parameterIndex, reader, length); } public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBlob(parameterIndex, inputStream, length); } public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNClob(parameterIndex, reader, length); } public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setSQLXML(parameterIndex, xmlObject); } public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setObject(parameterIndex, x, targetSqlType, scaleOrLength); } public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setAsciiStream(parameterIndex, x, length); } public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBinaryStream(parameterIndex, x, length); } public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCharacterStream(parameterIndex, reader, length); } public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setAsciiStream(parameterIndex, x); } public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBinaryStream(parameterIndex, x); } public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCharacterStream(parameterIndex, reader); } public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNCharacterStream(parameterIndex, value); } public void setClob(int parameterIndex, Reader reader) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setClob(parameterIndex, reader); } public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBlob(parameterIndex, inputStream); } public void setNClob(int parameterIndex, Reader reader) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNClob(parameterIndex, reader); } public ResultSet executeQuery(String sql) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeQuery(sql); + } finally { + log(QueryType.CALLABLE, sql); + } } public int executeUpdate(String sql) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeUpdate(sql); + } finally { + log(QueryType.CALLABLE, sql); + } } public void close() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + clearTime(); + statement.close(); } public int getMaxFieldSize() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getMaxFieldSize(); } public void setMaxFieldSize(int max) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setMaxFieldSize(max); } public int getMaxRows() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getMaxRows(); } public void setMaxRows(int max) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setMaxRows(max); } public void setEscapeProcessing(boolean enable) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setEscapeProcessing(enable); } public int getQueryTimeout() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getQueryTimeout(); } public void setQueryTimeout(int seconds) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setQueryTimeout(seconds); } public void cancel() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.cancel(); } public SQLWarning getWarnings() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getWarnings(); } public void clearWarnings() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.clearWarnings(); } public void setCursorName(String name) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCursorName(name); } public boolean execute(String sql) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.execute(sql); + } finally { + log(QueryType.CALLABLE, sql); + } } public ResultSet getResultSet() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.getResultSet(); + } finally { + log(QueryType.CALLABLE, sql); + } } public int getUpdateCount() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getUpdateCount(); } public boolean getMoreResults() throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.getMoreResults(); } public void setFetchDirection(int direction) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setFetchDirection(direction); } public int getFetchDirection() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getFetchDirection(); } public void setFetchSize(int rows) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setFetchSize(rows); } public int getFetchSize() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getFetchSize(); } public int getResultSetConcurrency() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getResultSetConcurrency(); } public int getResultSetType() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getResultSetType(); } public void addBatch(String sql) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + this.sql += "\n\n" + sql; + statement.addBatch(sql); } public void clearBatch() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.clearBatch(); } public int[] executeBatch() throws SQLException { - return new int[0]; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeBatch(); + } finally { + log(QueryType.CALLABLE, sql); + } } public Connection getConnection() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getConnection(); } public boolean getMoreResults(int current) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.getMoreResults(current); } public ResultSet getGeneratedKeys() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getGeneratedKeys(); } public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeUpdate(sql, autoGeneratedKeys); + } finally { + log(QueryType.CALLABLE, sql); + } } public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeUpdate(sql, columnIndexes); + } finally { + log(QueryType.CALLABLE, sql); + } } public int executeUpdate(String sql, String[] columnNames) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeUpdate(sql, columnNames); + } finally { + log(QueryType.CALLABLE, sql); + } } public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.execute(sql, autoGeneratedKeys); + } finally { + log(QueryType.CALLABLE, sql); + } } public boolean execute(String sql, int[] columnIndexes) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.execute(sql, columnIndexes); + } finally { + log(QueryType.CALLABLE, sql); + } } public boolean execute(String sql, String[] columnNames) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.execute(sql, columnNames); + } finally { + log(QueryType.CALLABLE, sql); + } } public int getResultSetHoldability() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getResultSetHoldability(); } public boolean isClosed() throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.isClosed(); } public void setPoolable(boolean poolable) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setPoolable(poolable); } public boolean isPoolable() throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.isPoolable(); } public void closeOnCompletion() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.closeOnCompletion(); } public boolean isCloseOnCompletion() throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.isCloseOnCompletion(); } public T unwrap(Class iface) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.unwrap(iface); } public boolean isWrapperFor(Class iface) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.isWrapperFor(iface); } + } diff --git a/.idea/ant.xml b/.idea/ant.xml index 48b830b..962ec30 100644 --- a/.idea/ant.xml +++ b/.idea/ant.xml @@ -2,8 +2,5 @@ - - - - + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..1c24f9a --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml new file mode 100644 index 0000000..69734e5 --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_194.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 3c73706..c6f0260 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,7 +5,7 @@ http://www.w3.org/1999/xhtml - + diff --git a/.idea/modules/simple-jdbc-stats.iml b/.idea/modules/simple-jdbc-stats.iml index cbcf482..f475070 100644 --- a/.idea/modules/simple-jdbc-stats.iml +++ b/.idea/modules/simple-jdbc-stats.iml @@ -1,5 +1,5 @@ - + diff --git a/.idea/modules/simple-jdbc-stats_main.iml b/.idea/modules/simple-jdbc-stats_main.iml index e9dc0d4..880a282 100644 --- a/.idea/modules/simple-jdbc-stats_main.iml +++ b/.idea/modules/simple-jdbc-stats_main.iml @@ -1,6 +1,6 @@ - - + + diff --git a/.idea/modules/simple-jdbc-stats_test.iml b/.idea/modules/simple-jdbc-stats_test.iml index f5ab325..4465e5c 100644 --- a/.idea/modules/simple-jdbc-stats_test.iml +++ b/.idea/modules/simple-jdbc-stats_test.iml @@ -1,6 +1,6 @@ - - + + @@ -17,7 +17,7 @@ - + diff --git a/src/nl/astraeus/jdbc/CallableStatementLogger.java b/src/nl/astraeus/jdbc/CallableStatementLogger.java index 797c9fe..2e9f173 100644 --- a/src/nl/astraeus/jdbc/CallableStatementLogger.java +++ b/src/nl/astraeus/jdbc/CallableStatementLogger.java @@ -1,26 +1,13 @@ package nl.astraeus.jdbc; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.Date; -import java.sql.NClob; -import java.sql.ParameterMetaData; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Time; -import java.sql.Timestamp; +import java.sql.*; import java.util.Calendar; import java.util.Map; @@ -30,851 +17,971 @@ * Time: 9:48 PM */ public class CallableStatementLogger implements CallableStatement { + private final static Logger log = LoggerFactory.getLogger(PreparedStatementLogger.class); + + private JdbcLogger logger; + private CallableStatement statement; + + private String sql; + private QueryType type; + private boolean autocommit; + private long milli; + private long nano; + + public CallableStatementLogger(JdbcLogger logger, Connection connection, String sql) throws SQLException { + this.logger = logger; + this.sql = sql; + this.type = QueryType.CALLABLE; + clearTime(); + statement = connection.prepareCall(sql); + } + + public CallableStatementLogger(JdbcLogger logger, Connection connection, String sql, int resultSetType, int resultSetConcurrency) throws SQLException { + this.logger = logger; + this.sql = sql; + this.type = QueryType.CALLABLE; + clearTime(); + statement = connection.prepareCall(sql, resultSetType, resultSetConcurrency); + } + + public CallableStatementLogger(JdbcLogger logger, Connection connection, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + this.logger = logger; + this.sql = sql; + this.type = QueryType.CALLABLE; + clearTime(); + statement = connection.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability); + } + + private void clearTime() { + milli = System.currentTimeMillis(); + nano = System.nanoTime(); + } + + private void log(QueryType type, String sql) throws SQLException { + long m = System.currentTimeMillis() - milli; + long n = System.nanoTime() - nano; + + logger.logEntry(type, sql, m, n, autocommit); + } + public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.registerOutParameter(parameterIndex, sqlType); } public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.registerOutParameter(parameterIndex, sqlType, scale); } public boolean wasNull() throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.wasNull(); } public String getString(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getString(parameterIndex); } public boolean getBoolean(int parameterIndex) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBoolean(parameterIndex); } public byte getByte(int parameterIndex) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getByte(parameterIndex); } public short getShort(int parameterIndex) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getShort(parameterIndex); } public int getInt(int parameterIndex) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getInt(parameterIndex); } public long getLong(int parameterIndex) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getLong(parameterIndex); } public float getFloat(int parameterIndex) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getFloat(parameterIndex); } public double getDouble(int parameterIndex) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getDouble(parameterIndex); } public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBigDecimal(parameterIndex, scale); } public byte[] getBytes(int parameterIndex) throws SQLException { - return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBytes(parameterIndex); } public Date getDate(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getDate(parameterIndex); } public Time getTime(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTime(parameterIndex); } public Timestamp getTimestamp(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTimestamp(parameterIndex); } public Object getObject(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getObject(parameterIndex); } public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBigDecimal(parameterIndex); } public Object getObject(int parameterIndex, Map> map) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getObject(parameterIndex, map); } public Ref getRef(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getRef(parameterIndex); } public Blob getBlob(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBlob(parameterIndex); } public Clob getClob(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getClob(parameterIndex); } public Array getArray(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getArray(parameterIndex); } public Date getDate(int parameterIndex, Calendar cal) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getDate(parameterIndex, cal); } public Time getTime(int parameterIndex, Calendar cal) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTime(parameterIndex, cal); } public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTimestamp(parameterIndex, cal); } public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.registerOutParameter(parameterIndex, sqlType, typeName); } public void registerOutParameter(String parameterName, int sqlType) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.registerOutParameter(parameterName, sqlType); } public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.registerOutParameter(parameterName, sqlType, scale); } public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.registerOutParameter(parameterName, sqlType, typeName); } public URL getURL(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getURL(parameterIndex); } public void setURL(String parameterName, URL val) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setURL(parameterName, val); } public void setNull(String parameterName, int sqlType) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNull(parameterName, sqlType); } public void setBoolean(String parameterName, boolean x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBoolean(parameterName, x); } public void setByte(String parameterName, byte x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setByte(parameterName, x); } public void setShort(String parameterName, short x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setShort(parameterName, x); } public void setInt(String parameterName, int x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setInt(parameterName, x); } public void setLong(String parameterName, long x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setLong(parameterName, x); } public void setFloat(String parameterName, float x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setFloat(parameterName, x); } public void setDouble(String parameterName, double x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setDouble(parameterName, x); } public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBigDecimal(parameterName, x); } public void setString(String parameterName, String x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setString(parameterName, x); } public void setBytes(String parameterName, byte[] x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBytes(parameterName, x); } public void setDate(String parameterName, Date x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setDate(parameterName, x); } public void setTime(String parameterName, Time x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTime(parameterName, x); } public void setTimestamp(String parameterName, Timestamp x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTimestamp(parameterName, x); } public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setAsciiStream(parameterName, x, length); } public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBinaryStream(parameterName, x, length); } public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setObject(parameterName, x, targetSqlType, scale); } public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setObject(parameterName, x, targetSqlType); } public void setObject(String parameterName, Object x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setObject(parameterName, x); } public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCharacterStream(parameterName, reader, length); } public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setDate(parameterName, x, cal); } public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTime(parameterName, x, cal); } public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTimestamp(parameterName, x, cal); } public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNull(parameterName, sqlType, typeName); } public String getString(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getString(parameterName); } public boolean getBoolean(String parameterName) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBoolean(parameterName); } public byte getByte(String parameterName) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getByte(parameterName); } public short getShort(String parameterName) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getShort(parameterName); } public int getInt(String parameterName) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getShort(parameterName); } public long getLong(String parameterName) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getLong(parameterName); } public float getFloat(String parameterName) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getFloat(parameterName); } public double getDouble(String parameterName) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getDouble(parameterName); } public byte[] getBytes(String parameterName) throws SQLException { - return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBytes(parameterName); } public Date getDate(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getDate(parameterName); } public Time getTime(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTime(parameterName); } public Timestamp getTimestamp(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTimestamp(parameterName); } public Object getObject(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getObject(parameterName); } public BigDecimal getBigDecimal(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBigDecimal(parameterName); } public Object getObject(String parameterName, Map> map) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getObject(parameterName, map); } public Ref getRef(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getRef(parameterName); } public Blob getBlob(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getBlob(parameterName); } public Clob getClob(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getClob(parameterName); } public Array getArray(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getArray(parameterName); } public Date getDate(String parameterName, Calendar cal) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getDate(parameterName, cal); } public Time getTime(String parameterName, Calendar cal) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTime(parameterName, cal); } public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getTimestamp(parameterName, cal); } public URL getURL(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getURL(parameterName); } public RowId getRowId(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getRowId(parameterIndex); } public RowId getRowId(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getRowId(parameterName); } public void setRowId(String parameterName, RowId x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setRowId(parameterName, x); } public void setNString(String parameterName, String value) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNString(parameterName, value); } public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNCharacterStream(parameterName, value, length); } public void setNClob(String parameterName, NClob value) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNClob(parameterName, value); } public void setClob(String parameterName, Reader reader, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setClob(parameterName, reader, length); } public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBlob(parameterName, inputStream, length); } public void setNClob(String parameterName, Reader reader, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNClob(parameterName, reader, length); } public NClob getNClob(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getNClob(parameterIndex); } public NClob getNClob(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getNClob(parameterName); } public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setSQLXML(parameterName, xmlObject); } public SQLXML getSQLXML(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getSQLXML(parameterIndex); } public SQLXML getSQLXML(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getSQLXML(parameterName); } public String getNString(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getNString(parameterIndex); } public String getNString(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getNString(parameterName); } public Reader getNCharacterStream(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getNCharacterStream(parameterIndex); } public Reader getNCharacterStream(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getNCharacterStream(parameterName); } public Reader getCharacterStream(int parameterIndex) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getCharacterStream(parameterIndex); } public Reader getCharacterStream(String parameterName) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getCharacterStream(parameterName); } public void setBlob(String parameterName, Blob x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBlob(parameterName, x); } public void setClob(String parameterName, Clob x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setClob(parameterName, x); } public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setAsciiStream(parameterName, x, length); } public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBinaryStream(parameterName, x, length); } public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCharacterStream(parameterName, reader, length); } public void setAsciiStream(String parameterName, InputStream x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setAsciiStream(parameterName, x); } public void setBinaryStream(String parameterName, InputStream x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBinaryStream(parameterName, x); } public void setCharacterStream(String parameterName, Reader reader) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCharacterStream(parameterName, reader); } public void setNCharacterStream(String parameterName, Reader value) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNCharacterStream(parameterName, value); } public void setClob(String parameterName, Reader reader) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setClob(parameterName, reader); } public void setBlob(String parameterName, InputStream inputStream) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBlob(parameterName, inputStream); } public void setNClob(String parameterName, Reader reader) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNClob(parameterName, reader); } public T getObject(int parameterIndex, Class type) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getObject(parameterIndex, type); } public T getObject(String parameterName, Class type) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getObject(parameterName, type); } public ResultSet executeQuery() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeQuery(); + } finally { + log(QueryType.CALLABLE, sql); + } } public int executeUpdate() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeUpdate(); + } finally { + log(QueryType.CALLABLE, sql); + } } public void setNull(int parameterIndex, int sqlType) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNull(parameterIndex, sqlType); } public void setBoolean(int parameterIndex, boolean x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBoolean(parameterIndex, x); } public void setByte(int parameterIndex, byte x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setByte(parameterIndex, x); } public void setShort(int parameterIndex, short x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setShort(parameterIndex, x); } public void setInt(int parameterIndex, int x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setInt(parameterIndex, x); } public void setLong(int parameterIndex, long x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setLong(parameterIndex, x); } public void setFloat(int parameterIndex, float x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setFloat(parameterIndex, x); } public void setDouble(int parameterIndex, double x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setDouble(parameterIndex, x); } public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBigDecimal(parameterIndex, x); } public void setString(int parameterIndex, String x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setString(parameterIndex, x); } public void setBytes(int parameterIndex, byte[] x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBytes(parameterIndex, x); } public void setDate(int parameterIndex, Date x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setDate(parameterIndex, x); } public void setTime(int parameterIndex, Time x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTime(parameterIndex, x); } public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTimestamp(parameterIndex, x); } public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setAsciiStream(parameterIndex, x, length); } public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setUnicodeStream(parameterIndex, x, length); } public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBinaryStream(parameterIndex, x, length); } public void clearParameters() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.clearParameters(); } public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setObject(parameterIndex, x, targetSqlType); } public void setObject(int parameterIndex, Object x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setObject(parameterIndex, x); } public boolean execute() throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.execute(); + } finally { + log(QueryType.CALLABLE, sql); + } } public void addBatch() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.addBatch(); } public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCharacterStream(parameterIndex, reader, length); } public void setRef(int parameterIndex, Ref x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setRef(parameterIndex, x); } public void setBlob(int parameterIndex, Blob x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBlob(parameterIndex, x); } public void setClob(int parameterIndex, Clob x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setClob(parameterIndex, x); } public void setArray(int parameterIndex, Array x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setArray(parameterIndex, x); } public ResultSetMetaData getMetaData() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getMetaData(); } public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setDate(parameterIndex, x, cal); } public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTime(parameterIndex, x, cal); } public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setTimestamp(parameterIndex, x, cal); } public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNull(parameterIndex, sqlType, typeName); } public void setURL(int parameterIndex, URL x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setURL(parameterIndex, x); } public ParameterMetaData getParameterMetaData() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getParameterMetaData(); } public void setRowId(int parameterIndex, RowId x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setRowId(parameterIndex, x); } public void setNString(int parameterIndex, String value) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNString(parameterIndex, value); } public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNCharacterStream(parameterIndex, value, length); } public void setNClob(int parameterIndex, NClob value) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNClob(parameterIndex, value); } public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setClob(parameterIndex, reader, length); } public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBlob(parameterIndex, inputStream, length); } public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNClob(parameterIndex, reader, length); } public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setSQLXML(parameterIndex, xmlObject); } public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setObject(parameterIndex, x, targetSqlType, scaleOrLength); } public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setAsciiStream(parameterIndex, x, length); } public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBinaryStream(parameterIndex, x, length); } public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCharacterStream(parameterIndex, reader, length); } public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setAsciiStream(parameterIndex, x); } public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBinaryStream(parameterIndex, x); } public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCharacterStream(parameterIndex, reader); } public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNCharacterStream(parameterIndex, value); } public void setClob(int parameterIndex, Reader reader) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setClob(parameterIndex, reader); } public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setBlob(parameterIndex, inputStream); } public void setNClob(int parameterIndex, Reader reader) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setNClob(parameterIndex, reader); } public ResultSet executeQuery(String sql) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeQuery(sql); + } finally { + log(QueryType.CALLABLE, sql); + } } public int executeUpdate(String sql) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeUpdate(sql); + } finally { + log(QueryType.CALLABLE, sql); + } } public void close() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + clearTime(); + statement.close(); } public int getMaxFieldSize() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getMaxFieldSize(); } public void setMaxFieldSize(int max) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setMaxFieldSize(max); } public int getMaxRows() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getMaxRows(); } public void setMaxRows(int max) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setMaxRows(max); } public void setEscapeProcessing(boolean enable) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setEscapeProcessing(enable); } public int getQueryTimeout() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getQueryTimeout(); } public void setQueryTimeout(int seconds) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setQueryTimeout(seconds); } public void cancel() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.cancel(); } public SQLWarning getWarnings() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getWarnings(); } public void clearWarnings() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.clearWarnings(); } public void setCursorName(String name) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setCursorName(name); } public boolean execute(String sql) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.execute(sql); + } finally { + log(QueryType.CALLABLE, sql); + } } public ResultSet getResultSet() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.getResultSet(); + } finally { + log(QueryType.CALLABLE, sql); + } } public int getUpdateCount() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getUpdateCount(); } public boolean getMoreResults() throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.getMoreResults(); } public void setFetchDirection(int direction) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setFetchDirection(direction); } public int getFetchDirection() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getFetchDirection(); } public void setFetchSize(int rows) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setFetchSize(rows); } public int getFetchSize() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getFetchSize(); } public int getResultSetConcurrency() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getResultSetConcurrency(); } public int getResultSetType() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getResultSetType(); } public void addBatch(String sql) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + this.sql += "\n\n" + sql; + statement.addBatch(sql); } public void clearBatch() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.clearBatch(); } public int[] executeBatch() throws SQLException { - return new int[0]; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeBatch(); + } finally { + log(QueryType.CALLABLE, sql); + } } public Connection getConnection() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getConnection(); } public boolean getMoreResults(int current) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.getMoreResults(current); } public ResultSet getGeneratedKeys() throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.getGeneratedKeys(); } public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeUpdate(sql, autoGeneratedKeys); + } finally { + log(QueryType.CALLABLE, sql); + } } public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeUpdate(sql, columnIndexes); + } finally { + log(QueryType.CALLABLE, sql); + } } public int executeUpdate(String sql, String[] columnNames) throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.executeUpdate(sql, columnNames); + } finally { + log(QueryType.CALLABLE, sql); + } } public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.execute(sql, autoGeneratedKeys); + } finally { + log(QueryType.CALLABLE, sql); + } } public boolean execute(String sql, int[] columnIndexes) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.execute(sql, columnIndexes); + } finally { + log(QueryType.CALLABLE, sql); + } } public boolean execute(String sql, String[] columnNames) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + try { + clearTime(); + return statement.execute(sql, columnNames); + } finally { + log(QueryType.CALLABLE, sql); + } } public int getResultSetHoldability() throws SQLException { - return 0; //To change body of implemented methods use File | Settings | File Templates. + return statement.getResultSetHoldability(); } public boolean isClosed() throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.isClosed(); } public void setPoolable(boolean poolable) throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.setPoolable(poolable); } public boolean isPoolable() throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.isPoolable(); } public void closeOnCompletion() throws SQLException { - //To change body of implemented methods use File | Settings | File Templates. + statement.closeOnCompletion(); } public boolean isCloseOnCompletion() throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.isCloseOnCompletion(); } public T unwrap(Class iface) throws SQLException { - return null; //To change body of implemented methods use File | Settings | File Templates. + return statement.unwrap(iface); } public boolean isWrapperFor(Class iface) throws SQLException { - return false; //To change body of implemented methods use File | Settings | File Templates. + return statement.isWrapperFor(iface); } + } diff --git a/src/nl/astraeus/jdbc/ConnectionLogger.java b/src/nl/astraeus/jdbc/ConnectionLogger.java index ae8e3ce..c7466a9 100644 --- a/src/nl/astraeus/jdbc/ConnectionLogger.java +++ b/src/nl/astraeus/jdbc/ConnectionLogger.java @@ -112,7 +112,8 @@ public CallableStatement prepareCall(String sql) throws SQLException { lastSql = sql; - return connection.prepareCall(sql); + + return new CallableStatementLogger(logger, connection, sql); } public String nativeSQL(String sql) throws SQLException { @@ -174,7 +175,8 @@ public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { lastSql = sql; - return connection.prepareCall(sql, resultSetType, resultSetConcurrency); + + return new CallableStatementLogger(logger, connection, sql, resultSetType, resultSetConcurrency); } public Map> getTypeMap() throws SQLException { @@ -210,12 +212,13 @@ } public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { - return connection.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability); + return new StatementLogger(logger, connection.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability)); } public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { lastSql = sql; - return connection.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability); + + return new CallableStatementLogger(logger, connection, sql, resultSetType, resultSetConcurrency, resultSetHoldability); } public Clob createClob() throws SQLException {