callablestatementwrapper.java

来自「RESIN 3.2 最新源码」· Java 代码 · 共 2,278 行 · 第 1/4 页

JAVA
2,278
字号
/* * Copyright (c) 1998-2005 Caucho Technology -- all rights reserved * * This file is part of Resin(R) Open Source * * Each copy or derived work must preserve the copyright notice and this * notice unmodified. * * Resin Open Source is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Resin Open Source is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty * of NON-INFRINGEMENT.  See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License * along with Resin Open Source; if not, write to the *   Free SoftwareFoundation, Inc. *   59 Temple Place, Suite 330 *   Boston, MA 02111-1307  USA * * @author Sam */package com.caucho.tools.profiler;import java.io.InputStream;import java.io.Reader;import java.math.BigDecimal;import java.net.URL;import java.sql.*;import java.util.Calendar;import java.util.Map;public class CallableStatementWrapper  implements CallableStatement{  private final CallableStatement _callableStatement;  private final ProfilerPoint _profilerPoint;  public CallableStatementWrapper(ProfilerPoint profilerPoint,                                  CallableStatement callableStatement)  {    _profilerPoint = profilerPoint;    _callableStatement = callableStatement;  }  public void registerOutParameter(int parameterIndex, int sqlType)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.registerOutParameter(parameterIndex, sqlType);    }    finally {      profiler.finish();    }  }  public void registerOutParameter(int parameterIndex, int sqlType, int scale)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.registerOutParameter(parameterIndex, sqlType, scale);    }    finally {      profiler.finish();    }  }  public boolean wasNull()    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.wasNull();    }    finally {      profiler.finish();    }  }  public String getString(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getString(parameterIndex);    }    finally {      profiler.finish();    }  }  public boolean getBoolean(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getBoolean(parameterIndex);    }    finally {      profiler.finish();    }  }  public byte getByte(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getByte(parameterIndex);    }    finally {      profiler.finish();    }  }  public short getShort(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getShort(parameterIndex);    }    finally {      profiler.finish();    }  }  public int getInt(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getInt(parameterIndex);    }    finally {      profiler.finish();    }  }  public long getLong(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getLong(parameterIndex);    }    finally {      profiler.finish();    }  }  public float getFloat(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getFloat(parameterIndex);    }    finally {      profiler.finish();    }  }  public double getDouble(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getDouble(parameterIndex);    }    finally {      profiler.finish();    }  }  public BigDecimal getBigDecimal(int parameterIndex, int scale)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getBigDecimal(parameterIndex, scale);    }    finally {      profiler.finish();    }  }  public byte[] getBytes(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getBytes(parameterIndex);    }    finally {      profiler.finish();    }  }  public Date getDate(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getDate(parameterIndex);    }    finally {      profiler.finish();    }  }  public Time getTime(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getTime(parameterIndex);    }    finally {      profiler.finish();    }  }  public Timestamp getTimestamp(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getTimestamp(parameterIndex);    }    finally {      profiler.finish();    }  }  public Object getObject(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getObject(parameterIndex);    }    finally {      profiler.finish();    }  }  public BigDecimal getBigDecimal(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getBigDecimal(parameterIndex);    }    finally {      profiler.finish();    }  }  public Object getObject(int i, Map<String, Class<?>> map)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getObject(i, map);    }    finally {      profiler.finish();    }  }  public Ref getRef(int i)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getRef(i);    }    finally {      profiler.finish();    }  }  public Blob getBlob(int i)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getBlob(i);    }    finally {      profiler.finish();    }  }  public Clob getClob(int i)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getClob(i);    }    finally {      profiler.finish();    }  }  public Array getArray(int i)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getArray(i);    }    finally {      profiler.finish();    }  }  public Date getDate(int parameterIndex, Calendar cal)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getDate(parameterIndex, cal);    }    finally {      profiler.finish();    }  }  public Time getTime(int parameterIndex, Calendar cal)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getTime(parameterIndex, cal);    }    finally {      profiler.finish();    }  }  public Timestamp getTimestamp(int parameterIndex, Calendar cal)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getTimestamp(parameterIndex, cal);    }    finally {      profiler.finish();    }  }  public void registerOutParameter(int paramIndex, int sqlType, String typeName)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.registerOutParameter(paramIndex, sqlType, typeName);    }    finally {      profiler.finish();    }  }  public void registerOutParameter(String parameterName, int sqlType)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.registerOutParameter(parameterName, sqlType);    }    finally {      profiler.finish();    }  }  public void registerOutParameter(String parameterName, int sqlType, int scale)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.registerOutParameter(parameterName, sqlType, scale);    }    finally {      profiler.finish();    }  }  public void registerOutParameter(String parameterName,                                   int sqlType,                                   String typeName)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.registerOutParameter(parameterName, sqlType, typeName);    }    finally {      profiler.finish();    }  }  public URL getURL(int parameterIndex)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      return _callableStatement.getURL(parameterIndex);    }    finally {      profiler.finish();    }  }  public void setURL(String parameterName, URL val)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.setURL(parameterName, val);    }    finally {      profiler.finish();    }  }  public void setNull(String parameterName, int sqlType)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.setNull(parameterName, sqlType);    }    finally {      profiler.finish();    }  }  public void setBoolean(String parameterName, boolean x)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.setBoolean(parameterName, x);    }    finally {      profiler.finish();    }  }  public void setByte(String parameterName, byte x)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.setByte(parameterName, x);    }    finally {      profiler.finish();    }  }  public void setShort(String parameterName, short x)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.setShort(parameterName, x);    }    finally {      profiler.finish();    }  }  public void setInt(String parameterName, int x)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.setInt(parameterName, x);    }    finally {      profiler.finish();    }  }  public void setLong(String parameterName, long x)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.setLong(parameterName, x);    }    finally {      profiler.finish();    }  }  public void setFloat(String parameterName, float x)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.setFloat(parameterName, x);    }    finally {      profiler.finish();    }  }  public void setDouble(String parameterName, double x)    throws SQLException  {    Profiler profiler = _profilerPoint.start();    try {      _callableStatement.setDouble(parameterName, x);    }    finally {

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?