自己建立一个对象,可以从ResultSet中继承,然后覆盖该方法
解决方案 »
- 为什么socket[i].getOutputStream()这样是错的呢?
- 帮忙用java编水仙花数的输出
- ★★急求2个时间相减,100分相赠!!!★★
- 没装sysbase,jdbc怎么直接连它的db数据库?
- applet入门的小问题
- 多线程同步问题--获得在线用户列表异常
- 这里有阿里软件的人吗,或者有谁知道阿里软件互联平台的技术框架和技术细节,
- anonymous class(匿名内隐类)属性,方法覆盖的疑惑
- java 中能不能在文件前面添加些内容?不覆盖原内容!
- 电子商务
- HELP!为什么ResultSet中的getdate只能取到日期!怎样取日期和时间。
- win2000 下 怎么设置 path classpath 路径??
// Decompiled by Jad v1.5.7. Copyright 1997-99 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3)
// Source File Name: ResultSet.javapackage java.sql;import java.io.InputStream;
import java.math.BigDecimal;// Referenced classes of package java.sql:
// SQLException, Date, Time, Timestamp,
// SQLWarning, ResultSetMetaDatapublic interface ResultSet
{ public abstract boolean next()
throws SQLException; public abstract void close()
throws SQLException; public abstract boolean wasNull()
throws SQLException; public abstract String getString(int i)
throws SQLException; public abstract boolean getBoolean(int i)
throws SQLException; public abstract byte getByte(int i)
throws SQLException; public abstract short getShort(int i)
throws SQLException; public abstract int getInt(int i)
throws SQLException; public abstract long getLong(int i)
throws SQLException; public abstract float getFloat(int i)
throws SQLException; public abstract double getDouble(int i)
throws SQLException; public abstract BigDecimal getBigDecimal(int i, int j)
throws SQLException; public abstract byte[] getBytes(int i)
throws SQLException; public abstract Date getDate(int i)
throws SQLException; public abstract Time getTime(int i)
throws SQLException; public abstract Timestamp getTimestamp(int i)
throws SQLException; public abstract InputStream getAsciiStream(int i)
throws SQLException; public abstract InputStream getUnicodeStream(int i)
throws SQLException; public abstract InputStream getBinaryStream(int i)
throws SQLException; public abstract String getString(String s)
throws SQLException; public abstract boolean getBoolean(String s)
throws SQLException; public abstract byte getByte(String s)
throws SQLException; public abstract short getShort(String s)
throws SQLException; public abstract int getInt(String s)
throws SQLException; public abstract long getLong(String s)
throws SQLException; public abstract float getFloat(String s)
throws SQLException; public abstract double getDouble(String s)
throws SQLException; public abstract BigDecimal getBigDecimal(String s, int i)
throws SQLException; public abstract byte[] getBytes(String s)
throws SQLException; public abstract Date getDate(String s)
throws SQLException; public abstract Time getTime(String s)
throws SQLException; public abstract Timestamp getTimestamp(String s)
throws SQLException; public abstract InputStream getAsciiStream(String s)
throws SQLException; public abstract InputStream getUnicodeStream(String s)
throws SQLException; public abstract InputStream getBinaryStream(String s)
throws SQLException; public abstract SQLWarning getWarnings()
throws SQLException; public abstract void clearWarnings()
throws SQLException; public abstract String getCursorName()
throws SQLException; public abstract ResultSetMetaData getMetaData()
throws SQLException; public abstract Object getObject(int i)
throws SQLException; public abstract Object getObject(String s)
throws SQLException; public abstract int findColumn(String s)
throws SQLException;
}
{
void getFloat()
{
if(super.getFloat())=0 return -1;
else return super.getFloat();
}
}
if (a==0.0)
a=-1.0;
请各位大虾指教
class abc extends ResultSet
{
float getFloat()
{
if(super.getFloat())=0 return -1;
else return super.getFloat();
}
}
{
float getFloat(int i)
{
if(super.getFloat(i))=0 return -1;
else return super.getFloat(i);
}
}思路就是这样,具体实现再自己看看
有没有实现的源代码?
if(rs.wasNull())
a = -1.0
float a = ( rs.getFloat("af") == 0.0? -1.0 : rs.getFloat("af") );
是最可行的
float a = rs.getFloat(1);
if(rs.wasNull())
a = -1.0
ResultSet rs = ....
实际上rs并不是ResultSet的这个类,它仅仅是一个实现了这个接口的类
根据不同的数据库厂商实际是不同的,就是说
ResultSet rs = ...;
System.out.println("Class:" + rs.getClass().getName());
你这样就可以看到实际上rs的类是什么了
谢谢。