📄 commonresultset.java
字号:
/*
* 创建日期 2003-12-5
*/
package com.dingl.jdbc;
import java.io.InputStream;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Map;
import java.util.Properties;
/**
* @author 丁令(令少爷) http://www.DingL.com
*
* ResultSet接口的实现类
*/
public class CommonResultSet implements ResultSet {
private ResultSet rs = null;
private Properties param = null;
public CommonResultSet(ResultSet rs, Properties param) {
this.rs = rs;
this.param = param;
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getConcurrency()
*/
public int getConcurrency() throws SQLException {
return rs.getConcurrency();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getFetchDirection()
*/
public int getFetchDirection() throws SQLException {
return rs.getFetchDirection();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getFetchSize()
*/
public int getFetchSize() throws SQLException {
return rs.getFetchSize();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getRow()
*/
public int getRow() throws SQLException {
return rs.getRow();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getType()
*/
public int getType() throws SQLException {
return rs.getType();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#afterLast()
*/
public void afterLast() throws SQLException {
rs.afterLast();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#beforeFirst()
*/
public void beforeFirst() throws SQLException {
rs.beforeFirst();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#cancelRowUpdates()
*/
public void cancelRowUpdates() throws SQLException {
rs.cancelRowUpdates();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#clearWarnings()
*/
public void clearWarnings() throws SQLException {
rs.clearWarnings();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#close()
*/
public void close() throws SQLException {
rs.close();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#deleteRow()
*/
public void deleteRow() throws SQLException {
rs.deleteRow();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#insertRow()
*/
public void insertRow() throws SQLException {
rs.insertRow();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#moveToCurrentRow()
*/
public void moveToCurrentRow() throws SQLException {
rs.moveToCurrentRow();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#moveToInsertRow()
*/
public void moveToInsertRow() throws SQLException {
rs.moveToInsertRow();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#refreshRow()
*/
public void refreshRow() throws SQLException {
rs.refreshRow();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateRow()
*/
public void updateRow() throws SQLException {
rs.updateRow();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#first()
*/
public boolean first() throws SQLException {
return rs.first();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#isAfterLast()
*/
public boolean isAfterLast() throws SQLException {
return rs.isAfterLast();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#isBeforeFirst()
*/
public boolean isBeforeFirst() throws SQLException {
return rs.isBeforeFirst();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#isFirst()
*/
public boolean isFirst() throws SQLException {
return rs.isFirst();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#isLast()
*/
public boolean isLast() throws SQLException {
return rs.isLast();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#last()
*/
public boolean last() throws SQLException {
return rs.last();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#next()
*/
public boolean next() throws SQLException {
return rs.next();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#previous()
*/
public boolean previous() throws SQLException {
return rs.previous();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#rowDeleted()
*/
public boolean rowDeleted() throws SQLException {
return rs.rowDeleted();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#rowInserted()
*/
public boolean rowInserted() throws SQLException {
return rs.rowInserted();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#rowUpdated()
*/
public boolean rowUpdated() throws SQLException {
return rs.rowUpdated();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#wasNull()
*/
public boolean wasNull() throws SQLException {
return rs.wasNull();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getByte(int)
*/
public byte getByte(int arg0) throws SQLException {
return rs.getByte(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getDouble(int)
*/
public double getDouble(int arg0) throws SQLException {
return rs.getDouble(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getFloat(int)
*/
public float getFloat(int arg0) throws SQLException {
return rs.getFloat(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getInt(int)
*/
public int getInt(int arg0) throws SQLException {
return rs.getInt(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getLong(int)
*/
public long getLong(int arg0) throws SQLException {
return rs.getLong(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getShort(int)
*/
public short getShort(int arg0) throws SQLException {
return rs.getShort(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#setFetchDirection(int)
*/
public void setFetchDirection(int arg0) throws SQLException {
rs.setFetchDirection(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#setFetchSize(int)
*/
public void setFetchSize(int arg0) throws SQLException {
rs.setFetchSize(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateNull(int)
*/
public void updateNull(int arg0) throws SQLException {
rs.updateNull(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#absolute(int)
*/
public boolean absolute(int arg0) throws SQLException {
return rs.absolute(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getBoolean(int)
*/
public boolean getBoolean(int arg0) throws SQLException {
return rs.getBoolean(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#relative(int)
*/
public boolean relative(int arg0) throws SQLException {
return rs.relative(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getBytes(int)
*/
public byte[] getBytes(int arg0) throws SQLException {
return rs.getBytes(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateByte(int, byte)
*/
public void updateByte(int arg0, byte arg1) throws SQLException {
rs.updateByte(arg0, arg1);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateDouble(int, double)
*/
public void updateDouble(int arg0, double arg1) throws SQLException {
rs.updateDouble(arg0, arg1);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateFloat(int, float)
*/
public void updateFloat(int arg0, float arg1) throws SQLException {
rs.updateFloat(arg0, arg1);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateInt(int, int)
*/
public void updateInt(int arg0, int arg1) throws SQLException {
rs.updateInt(arg1, arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateLong(int, long)
*/
public void updateLong(int arg0, long arg1) throws SQLException {
rs.updateLong(arg0, arg1);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateShort(int, short)
*/
public void updateShort(int arg0, short arg1) throws SQLException {
rs.updateShort(arg0, arg1);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateBoolean(int, boolean)
*/
public void updateBoolean(int arg0, boolean arg1) throws SQLException {
rs.updateBoolean(arg0, arg1);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateBytes(int, byte[])
*/
public void updateBytes(int arg0, byte[] arg1) throws SQLException {
rs.updateBytes(arg0, arg1);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getAsciiStream(int)
*/
public InputStream getAsciiStream(int arg0) throws SQLException {
return rs.getAsciiStream(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getBinaryStream(int)
*/
public InputStream getBinaryStream(int arg0) throws SQLException {
return rs.getBinaryStream(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getUnicodeStream(int)
*/
public InputStream getUnicodeStream(int arg0) throws SQLException {
return rs.getUnicodeStream(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, int)
*/
public void updateAsciiStream(int arg0, InputStream arg1, int arg2) throws SQLException {
rs.updateAsciiStream(arg0, arg1, arg2);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, int)
*/
public void updateBinaryStream(int arg0, InputStream arg1, int arg2) throws SQLException {
rs.updateBinaryStream(arg0, arg1, arg2);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getCharacterStream(int)
*/
public Reader getCharacterStream(int arg0) throws SQLException {
return rs.getCharacterStream(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, int)
*/
public void updateCharacterStream(int arg0, Reader arg1, int arg2) throws SQLException {
rs.updateCharacterStream(arg0, arg1, arg2);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getObject(int)
*/
public Object getObject(int arg0) throws SQLException {
return rs.getObject(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateObject(int, java.lang.Object)
*/
public void updateObject(int arg0, Object arg1) throws SQLException {
rs.updateObject(arg0, arg1);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateObject(int, java.lang.Object, int)
*/
public void updateObject(int arg0, Object arg1, int arg2) throws SQLException {
rs.updateObject(arg0, arg1, arg2);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getCursorName()
*/
public String getCursorName() throws SQLException {
return rs.getCursorName();
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getString(int)
*/
public String getString(int arg0) throws SQLException {
return convertCharacterSet(rs.getString(arg0));
}
/**
* 处理字符的编码问题
* */
private String convertCharacterSet(String arg0) throws SQLException {
if (param.getProperty("charset") == null) {
return arg0;
} else {
String value = arg0;
try {
value = new String(arg0.getBytes(), param.getProperty("charset"));
} catch (UnsupportedEncodingException e) {
throw new SQLException("unknown charset :" + param.getProperty("charset"));
}
return value;
}
}
/* (非 Javadoc)
* @see java.sql.ResultSet#updateString(int, java.lang.String)
*/
public void updateString(int arg0, String arg1) throws SQLException {
rs.updateString(arg0, arg1);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getByte(java.lang.String)
*/
public byte getByte(String arg0) throws SQLException {
return rs.getByte(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getDouble(java.lang.String)
*/
public double getDouble(String arg0) throws SQLException {
return rs.getDouble(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#getFloat(java.lang.String)
*/
public float getFloat(String arg0) throws SQLException {
return rs.getFloat(arg0);
}
/* (非 Javadoc)
* @see java.sql.ResultSet#findColumn(java.lang.String)
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -