📄 loggingstatementwrapper.java
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */package org.apache.ode.utils;import org.apache.commons.logging.Log;import java.io.InputStream;import java.io.Reader;import java.math.BigDecimal;import java.net.URL;import java.sql.*;import java.util.Calendar;import java.util.HashMap;import java.util.Map;/** * @author Matthieu Riou <mriou at apache dot org> */public class LoggingStatementWrapper implements CallableStatement { private PreparedStatement _stmt; private Log _log; private HashMap<String,Object> _paramsStr = new HashMap<String,Object>(); private HashMap<Integer,Object> _paramsIdxr = new HashMap<Integer,Object>(); public LoggingStatementWrapper(CallableStatement stmt, Log log) { _stmt = stmt; _log = log; } public LoggingStatementWrapper(PreparedStatement stmt, Log log) { _stmt = stmt; _log = log; } public Array getArray(int i) throws SQLException { return ((CallableStatement)_stmt).getArray(i); } public Array getArray(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getArray(parameterName); } public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getBigDecimal(parameterIndex); } @SuppressWarnings("deprecation") public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { return ((CallableStatement)_stmt).getBigDecimal(parameterIndex, scale); } public BigDecimal getBigDecimal(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getBigDecimal(parameterName); } public Blob getBlob(int i) throws SQLException { return ((CallableStatement)_stmt).getBlob(i); } public Blob getBlob(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getBlob(parameterName); } public boolean getBoolean(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getBoolean(parameterIndex); } public boolean getBoolean(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getBoolean(parameterName); } public byte getByte(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getByte(parameterIndex); } public byte getByte(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getByte(parameterName); } public byte[] getBytes(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getBytes(parameterIndex); } public byte[] getBytes(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getBytes(parameterName); } public Clob getClob(int i) throws SQLException { return ((CallableStatement)_stmt).getClob(i); } public Clob getClob(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getClob(parameterName); } public Date getDate(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getDate(parameterIndex); } public Date getDate(int parameterIndex, Calendar cal) throws SQLException { return ((CallableStatement)_stmt).getDate(parameterIndex, cal); } public Date getDate(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getDate(parameterName); } public Date getDate(String parameterName, Calendar cal) throws SQLException { return ((CallableStatement)_stmt).getDate(parameterName, cal); } public double getDouble(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getDouble(parameterIndex); } public double getDouble(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getDouble(parameterName); } public float getFloat(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getFloat(parameterIndex); } public float getFloat(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getFloat(parameterName); } public int getInt(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getInt(parameterIndex); } public int getInt(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getInt(parameterName); } public long getLong(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getLong(parameterIndex); } public long getLong(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getLong(parameterName); } public Object getObject(int i, Map<String, Class<?>> map) throws SQLException { return ((CallableStatement)_stmt).getObject(i, map); } public Object getObject(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getObject(parameterIndex); } public Object getObject(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getObject(parameterName); } public Object getObject(String parameterName, Map<String, Class<?>> map) throws SQLException { return ((CallableStatement)_stmt).getObject(parameterName, map); } public Ref getRef(int i) throws SQLException { return ((CallableStatement)_stmt).getRef(i); } public Ref getRef(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getRef(parameterName); } public short getShort(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getShort(parameterIndex); } public short getShort(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getShort(parameterName); } public String getString(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getString(parameterIndex); } public String getString(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getString(parameterName); } public Time getTime(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getTime(parameterIndex); } public Time getTime(int parameterIndex, Calendar cal) throws SQLException { return ((CallableStatement)_stmt).getTime(parameterIndex, cal); } public Time getTime(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getTime(parameterName); } public Time getTime(String parameterName, Calendar cal) throws SQLException { return ((CallableStatement)_stmt).getTime(parameterName, cal); } public Timestamp getTimestamp(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getTimestamp(parameterIndex); } public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { return ((CallableStatement)_stmt).getTimestamp(parameterIndex, cal); } public Timestamp getTimestamp(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getTimestamp(parameterName); } public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { return ((CallableStatement)_stmt).getTimestamp(parameterName, cal); } public URL getURL(int parameterIndex) throws SQLException { return ((CallableStatement)_stmt).getURL(parameterIndex); } public URL getURL(String parameterName) throws SQLException { return ((CallableStatement)_stmt).getURL(parameterName); } public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { ((CallableStatement)_stmt).registerOutParameter(parameterIndex, sqlType); } public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { ((CallableStatement)_stmt).registerOutParameter(parameterIndex, sqlType, scale); } public void registerOutParameter(String parameterName, int sqlType) throws SQLException { ((CallableStatement)_stmt).registerOutParameter(parameterName, sqlType); } public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { ((CallableStatement)_stmt).registerOutParameter(parameterName, sqlType, scale); } public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { ((CallableStatement)_stmt).registerOutParameter(parameterName, sqlType, typeName); } public void registerOutParameter(int paramIndex, int sqlType, String typeName) throws SQLException { ((CallableStatement)_stmt).registerOutParameter(paramIndex, sqlType, typeName); } public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { ((CallableStatement)_stmt).setAsciiStream(parameterName, x, length); } public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setBigDecimal(parameterName, x); } public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { ((CallableStatement)_stmt).setBinaryStream(parameterName, x, length); } public void setBoolean(String parameterName, boolean x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setBoolean(parameterName, x); } public void setByte(String parameterName, byte x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setByte(parameterName, x); } public void setBytes(String parameterName, byte[] x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setBytes(parameterName, x); } public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { ((CallableStatement)_stmt).setCharacterStream(parameterName, reader, length); } public void setDate(String parameterName, Date x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setDate(parameterName, x); } public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setDate(parameterName, x, cal); } public void setDouble(String parameterName, double x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setDouble(parameterName, x); } public void setFloat(String parameterName, float x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setFloat(parameterName, x); } public void setInt(String parameterName, int x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setInt(parameterName, x); } public void setLong(String parameterName, long x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setLong(parameterName, x); } public void setNull(String parameterName, int sqlType) throws SQLException { _paramsStr.put(parameterName, "null"); ((CallableStatement)_stmt).setNull(parameterName, sqlType); } public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { _paramsStr.put(parameterName, "null"); ((CallableStatement)_stmt).setNull(parameterName, sqlType, typeName); } public void setObject(String parameterName, Object x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setObject(parameterName, x); } public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setObject(parameterName, x, targetSqlType); } public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setObject(parameterName, x, targetSqlType, scale); } public void setShort(String parameterName, short x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setShort(parameterName, x); } public void setString(String parameterName, String x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setString(parameterName, x); } public void setTime(String parameterName, Time x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setTime(parameterName, x); } public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setTime(parameterName, x, cal); } public void setTimestamp(String parameterName, Timestamp x) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setTimestamp(parameterName, x); } public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { _paramsStr.put(parameterName, x); ((CallableStatement)_stmt).setTimestamp(parameterName, x, cal); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -