📄 loggingstatementwrapper.java
字号:
public void setURL(String parameterName, URL val) throws SQLException { _paramsStr.put(parameterName, val); ((CallableStatement)_stmt).setURL(parameterName, val); } public boolean wasNull() throws SQLException { return ((CallableStatement)_stmt).wasNull(); } public void addBatch() throws SQLException { _stmt.addBatch(); } public void clearParameters() throws SQLException { _paramsStr.clear(); _paramsIdxr.clear(); _stmt.clearParameters(); } public boolean execute() throws SQLException { printParams(); return _stmt.execute(); } public ResultSet executeQuery() throws SQLException { printParams(); return _stmt.executeQuery(); } public int executeUpdate() throws SQLException { printParams(); return _stmt.executeUpdate(); } public ResultSetMetaData getMetaData() throws SQLException { return _stmt.getMetaData(); } public ParameterMetaData getParameterMetaData() throws SQLException { return _stmt.getParameterMetaData(); } public void setArray(int i, Array x) throws SQLException { _paramsIdxr.put(i, x); _stmt.setArray(i, x); } public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { _stmt.setAsciiStream(parameterIndex, x, length); } public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setBigDecimal(parameterIndex, x); } public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { _stmt.setBinaryStream(parameterIndex, x, length); } public void setBlob(int i, Blob x) throws SQLException { _stmt.setBlob(i, x); } public void setBoolean(int parameterIndex, boolean x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setBoolean(parameterIndex, x); } public void setByte(int parameterIndex, byte x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setByte(parameterIndex, x); } public void setBytes(int parameterIndex, byte[] x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setBytes(parameterIndex, x); } public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { _stmt.setCharacterStream(parameterIndex, reader, length); } public void setClob(int i, Clob x) throws SQLException { _stmt.setClob(i, x); } public void setDate(int parameterIndex, Date x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setDate(parameterIndex, x); } public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setDate(parameterIndex, x, cal); } public void setDouble(int parameterIndex, double x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setDouble(parameterIndex, x); } public void setFloat(int parameterIndex, float x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setFloat(parameterIndex, x); } public void setInt(int parameterIndex, int x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setInt(parameterIndex, x); } public void setLong(int parameterIndex, long x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setLong(parameterIndex, x); } public void setNull(int parameterIndex, int sqlType) throws SQLException { _paramsIdxr.put(parameterIndex, "null"); _stmt.setNull(parameterIndex, sqlType); } public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException { _stmt.setNull(paramIndex, sqlType, typeName); } public void setObject(int parameterIndex, Object x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setObject(parameterIndex, x); } public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setObject(parameterIndex, x, targetSqlType); } public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setObject(parameterIndex, x, targetSqlType, scale); } public void setRef(int i, Ref x) throws SQLException { _paramsIdxr.put(i, x); _stmt.setRef(i, x); } public void setShort(int parameterIndex, short x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setShort(parameterIndex, x); } public void setString(int parameterIndex, String x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setString(parameterIndex, x); } public void setTime(int parameterIndex, Time x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setTime(parameterIndex, x); } public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setTime(parameterIndex, x, cal); } public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setTimestamp(parameterIndex, x); } public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setTimestamp(parameterIndex, x, cal); } @SuppressWarnings("deprecation") public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setUnicodeStream(parameterIndex, x, length); } public void setURL(int parameterIndex, URL x) throws SQLException { _paramsIdxr.put(parameterIndex, x); _stmt.setURL(parameterIndex, x); } public void addBatch(String sql) throws SQLException { _stmt.addBatch(sql); } public void cancel() throws SQLException { _stmt.cancel(); } public void clearBatch() throws SQLException { _stmt.clearBatch(); } public void clearWarnings() throws SQLException { _stmt.clearWarnings(); } public void close() throws SQLException { _stmt.close(); } public boolean execute(String sql) throws SQLException { if (shouldPrint()) printParams(); return _stmt.execute(sql); } public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { if (shouldPrint()) printParams(); return _stmt.execute(sql, autoGeneratedKeys); } public boolean execute(String sql, int[] columnIndexes) throws SQLException { if (shouldPrint()) printParams(); return _stmt.execute(sql, columnIndexes); } public boolean execute(String sql, String[] columnNames) throws SQLException { if (shouldPrint()) printParams(); return _stmt.execute(sql, columnNames); } public int[] executeBatch() throws SQLException { if (shouldPrint()) printParams(); return _stmt.executeBatch(); } public ResultSet executeQuery(String sql) throws SQLException { if (shouldPrint()) printParams(); return _stmt.executeQuery(sql); } public int executeUpdate(String sql) throws SQLException { if (shouldPrint()) printParams(); return _stmt.executeUpdate(sql); } public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { if (shouldPrint()) printParams(); return _stmt.executeUpdate(sql, autoGeneratedKeys); } public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { if (shouldPrint()) printParams(); return _stmt.executeUpdate(sql, columnIndexes); } public int executeUpdate(String sql, String[] columnNames) throws SQLException { if (shouldPrint()) printParams(); return _stmt.executeUpdate(sql, columnNames); } public Connection getConnection() throws SQLException { return _stmt.getConnection(); } public int getFetchDirection() throws SQLException { return _stmt.getFetchDirection(); } public int getFetchSize() throws SQLException { return _stmt.getFetchSize(); } public ResultSet getGeneratedKeys() throws SQLException { return _stmt.getGeneratedKeys(); } public int getMaxFieldSize() throws SQLException { return _stmt.getMaxFieldSize(); } public int getMaxRows() throws SQLException { return _stmt.getMaxRows(); } public boolean getMoreResults() throws SQLException { return _stmt.getMoreResults(); } public boolean getMoreResults(int current) throws SQLException { return _stmt.getMoreResults(current); } public int getQueryTimeout() throws SQLException { return _stmt.getQueryTimeout(); } public ResultSet getResultSet() throws SQLException { return _stmt.getResultSet(); } public int getResultSetConcurrency() throws SQLException { return _stmt.getResultSetConcurrency(); } public int getResultSetHoldability() throws SQLException { return _stmt.getResultSetHoldability(); } public int getResultSetType() throws SQLException { return _stmt.getResultSetType(); } public int getUpdateCount() throws SQLException { return _stmt.getUpdateCount(); } public SQLWarning getWarnings() throws SQLException { return _stmt.getWarnings(); } public void setCursorName(String name) throws SQLException { _stmt.setCursorName(name); } public void setEscapeProcessing(boolean enable) throws SQLException { _stmt.setEscapeProcessing(enable); } public void setFetchDirection(int direction) throws SQLException { _stmt.setFetchDirection(direction); } public void setFetchSize(int rows) throws SQLException { _stmt.setFetchSize(rows); } public void setMaxFieldSize(int max) throws SQLException { _stmt.setMaxFieldSize(max); } public void setMaxRows(int max) throws SQLException { _stmt.setMaxRows(max); } public void setQueryTimeout(int seconds) throws SQLException { _stmt.setQueryTimeout(seconds); } private void printParams() { if (_paramsIdxr.size() > 0 || _paramsStr.size() > 0) { StringBuffer buf = new StringBuffer(); buf.append("bound "); for (Map.Entry<Integer, Object> entry : _paramsIdxr.entrySet()) { try { buf.append("(").append(entry.getKey()).append(",").append(entry.getValue()).append(") "); } catch (Throwable e) { // We don't want to mess with the connection just for logging } } for (Map.Entry<String, Object> entry : _paramsStr.entrySet()) { try { buf.append("(").append(entry.getKey()).append(",").append(entry.getValue()).append(") "); } catch (Throwable e) { // We don't want to mess with the connection just for logging } } print(buf.toString()); } } private boolean shouldPrint() { if (_log != null) return _log.isDebugEnabled(); else return true; } private void print(String str) { if (_log != null) _log.debug(str); else System.out.println(str); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -