You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@OverridepublicObjectgetObject(finalintcolumnIndex) throwsSQLException {
Preconditions.checkState(!isClosed(), "Result set is closed");
Preconditions.checkState(!beforeFirst, "Before start of result set");
Preconditions.checkState(null != currentRow, "After end of result set");
Preconditions.checkArgument(currentRow.inRange(columnIndex), String.format("Column Index %d out of range", columnIndex));
Objectresult = currentRow.getCell(columnIndex);
wasNull = null == result;
returnresult;
}
当然还有其他的几个方法同样存在这样的问题。
Java中对此接口的定义如下:
/** * Reports whether * the last column read had a value of SQL <code>NULL</code>. * Note that you must first call one of the getter methods * on a column to try to read its value and then call * the method <code>wasNull</code> to see if the value read was * SQL <code>NULL</code>. * * @return <code>true</code> if the last column value read was SQL * <code>NULL</code> and <code>false</code> otherwise * @exception SQLException if a database access error occurs or this method is * called on a closed result set */booleanwasNull() throwsSQLException;
The text was updated successfully, but these errors were encountered:
标志位wasNull是在结果集中某个字段的值是
SQLNULL
的时候会被设置为true,用来表示从ResultSet中获取的值是null。但是当某个字段的值不是null的时候应该及时修改此标志位。但是
AbstractMemoryResultSet
的实现中没有及时修正此flag,导致查询的数据会出现一连串的null。比如,getObject方法应该这样处理wasNull。
当然还有其他的几个方法同样存在这样的问题。
Java中对此接口的定义如下:
The text was updated successfully, but these errors were encountered: