commonstatement.java
来自「工厂版本管理系统,STRUTS2框架,用于管理商品的版本,便于有效的控制版本」· Java 代码 · 共 311 行
JAVA
311 行
/*
* 创建日期 2003-12-5
*/
package com.dingl.jdbc;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.Properties;
/**
* @author tooy 修改了对中文sql的支持
* @author 丁令(令少爷) http://www.DingL.com
*
* Statement接口的实现类
*/
public class CommonStatement implements Statement {
private Statement st = null;
private Properties param = null;
public CommonStatement(Statement st, Properties param) {
this.st = st;
this.param = param;
}
/* (非 Javadoc)
* @see java.sql.Statement#getFetchDirection()
*/
public int getFetchDirection() throws SQLException {
return st.getFetchDirection();
}
/* (非 Javadoc)
* @see java.sql.Statement#getFetchSize()
*/
public int getFetchSize() throws SQLException {
return st.getFetchSize();
}
/* (非 Javadoc)
* @see java.sql.Statement#getMaxFieldSize()
*/
public int getMaxFieldSize() throws SQLException {
return st.getMaxFieldSize();
}
/* (非 Javadoc)
* @see java.sql.Statement#getMaxRows()
*/
public int getMaxRows() throws SQLException {
return st.getMaxRows();
}
/* (非 Javadoc)
* @see java.sql.Statement#getQueryTimeout()
*/
public int getQueryTimeout() throws SQLException {
return st.getQueryTimeout();
}
/* (非 Javadoc)
* @see java.sql.Statement#getResultSetConcurrency()
*/
public int getResultSetConcurrency() throws SQLException {
return st.getResultSetConcurrency();
}
/* (非 Javadoc)
* @see java.sql.Statement#getResultSetHoldability()
*/
public int getResultSetHoldability() throws SQLException {
return st.getResultSetHoldability();
}
/* (非 Javadoc)
* @see java.sql.Statement#getResultSetType()
*/
public int getResultSetType() throws SQLException {
return st.getResultSetType();
}
/* (非 Javadoc)
* @see java.sql.Statement#getUpdateCount()
*/
public int getUpdateCount() throws SQLException {
return st.getUpdateCount();
}
/* (非 Javadoc)
* @see java.sql.Statement#cancel()
*/
public void cancel() throws SQLException {
st.cancel();
}
/* (非 Javadoc)
* @see java.sql.Statement#clearBatch()
*/
public void clearBatch() throws SQLException {
st.clearBatch();
}
/* (非 Javadoc)
* @see java.sql.Statement#clearWarnings()
*/
public void clearWarnings() throws SQLException {
st.clearWarnings();
}
/* (非 Javadoc)
* @see java.sql.Statement#close()
*/
public void close() throws SQLException {
st.close();
}
/* (非 Javadoc)
* @see java.sql.Statement#getMoreResults()
*/
public boolean getMoreResults() throws SQLException {
return st.getMoreResults();
}
/* (非 Javadoc)
* @see java.sql.Statement#executeBatch()
*/
public int[] executeBatch() throws SQLException {
return st.executeBatch();
}
/* (非 Javadoc)
* @see java.sql.Statement#setFetchDirection(int)
*/
public void setFetchDirection(int arg0) throws SQLException {
st.setFetchDirection(arg0);
}
/* (非 Javadoc)
* @see java.sql.Statement#setFetchSize(int)
*/
public void setFetchSize(int arg0) throws SQLException {
st.setFetchSize(arg0);
}
/* (非 Javadoc)
* @see java.sql.Statement#setMaxFieldSize(int)
*/
public void setMaxFieldSize(int arg0) throws SQLException {
st.setMaxFieldSize(arg0);
}
/* (非 Javadoc)
* @see java.sql.Statement#setMaxRows(int)
*/
public void setMaxRows(int arg0) throws SQLException {
st.setMaxRows(arg0);
}
/* (非 Javadoc)
* @see java.sql.Statement#setQueryTimeout(int)
*/
public void setQueryTimeout(int arg0) throws SQLException {
st.setQueryTimeout(arg0);
}
/* (非 Javadoc)
* @see java.sql.Statement#getMoreResults(int)
*/
public boolean getMoreResults(int arg0) throws SQLException {
return st.getMoreResults(arg0);
}
/* (非 Javadoc)
* @see java.sql.Statement#setEscapeProcessing(boolean)
*/
public void setEscapeProcessing(boolean arg0) throws SQLException {
st.setEscapeProcessing(arg0);
}
/* (非 Javadoc)
* @see java.sql.Statement#executeUpdate(java.lang.String)
*/
public int executeUpdate(String sql) throws SQLException {
return st.executeUpdate(processChinese(sql));
}
/* (非 Javadoc)
* @see java.sql.Statement#addBatch(java.lang.String)
*/
public void addBatch(String sql) throws SQLException {
st.addBatch(processChinese(sql));
}
/* (非 Javadoc)
* @see java.sql.Statement#setCursorName(java.lang.String)
*/
public void setCursorName(String arg0) throws SQLException {
st.setCursorName(arg0);
}
/* (非 Javadoc)
* @see java.sql.Statement#execute(java.lang.String)
*/
public boolean execute(String sql) throws SQLException {
return st.execute(processChinese(sql));
}
/* (非 Javadoc)
* @see java.sql.Statement#executeUpdate(java.lang.String, int)
*/
public int executeUpdate(String sql, int arg1) throws SQLException {
return st.executeUpdate(processChinese(sql), arg1);
}
/* (非 Javadoc)
* @see java.sql.Statement#execute(java.lang.String, int)
*/
public boolean execute(String sql, int arg1) throws SQLException {
return st.execute(processChinese(sql), arg1);
}
/* (非 Javadoc)
* @see java.sql.Statement#executeUpdate(java.lang.String, int[])
*/
public int executeUpdate(String sql, int[] arg1) throws SQLException {
return st.executeUpdate(processChinese(sql), arg1);
}
/* (非 Javadoc)
* @see java.sql.Statement#execute(java.lang.String, int[])
*/
public boolean execute(String sql, int[] arg1) throws SQLException {
return st.execute(processChinese(sql), arg1);
}
/* (非 Javadoc)
* @see java.sql.Statement#getConnection()
*/
public Connection getConnection() throws SQLException {
return new CommonConnection(st.getConnection(), param);
}
/* (非 Javadoc)
* @see java.sql.Statement#getGeneratedKeys()
*/
public ResultSet getGeneratedKeys() throws SQLException {
return new CommonResultSet(st.getGeneratedKeys(), param);
}
/* (非 Javadoc)
* @see java.sql.Statement#getResultSet()
*/
public ResultSet getResultSet() throws SQLException {
return new CommonResultSet(st.getResultSet(), param);
}
/* (非 Javadoc)
* @see java.sql.Statement#getWarnings()
*/
public SQLWarning getWarnings() throws SQLException {
return st.getWarnings();
}
/* (非 Javadoc)
* @see java.sql.Statement#executeUpdate(java.lang.String, java.lang.String[])
*/
public int executeUpdate(String sql, String[] arg1) throws SQLException {
return st.executeUpdate(processChinese(sql), arg1);
}
/* (非 Javadoc)
* @see java.sql.Statement#execute(java.lang.String, java.lang.String[])
*/
public boolean execute(String sql, String[] arg1) throws SQLException {
return st.execute(processChinese(sql), arg1);
}
/* (非 Javadoc)
* @see java.sql.Statement#executeQuery(java.lang.String)
*/
public ResultSet executeQuery(String sql) throws SQLException {
return new CommonResultSet(st.executeQuery(processChinese(sql)), param);
}
private String processChinese(String sql) throws SQLException {
return Java2Db.convert2db(sql, param);
}
public boolean isClosed() throws SQLException {
return st.isClosed();
}
public boolean isPoolable() throws SQLException {
return st.isPoolable();
}
public void setPoolable(boolean poolable) throws SQLException {
st.setPoolable(poolable);
}
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return st.isWrapperFor(iface);
}
public <T> T unwrap(Class<T> iface) throws SQLException {
return st.unwrap(iface);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?