更新时间:2023-11-28 19:34:10
没错,最初 ResultSet
的光标指向第一行之前,如果第一次调用 next()
返回 false
那么 ResultSet
中没有数据.
That's correct, initially the ResultSet
's cursor is pointing to before the first row, if the first call to next()
returns false
then there was no data in the ResultSet
.
如果您使用此方法,您可能必须在重置它之后立即调用 beforeFirst()
,因为它现在已经将自己定位到第一行之后.
If you use this method, you may have to call beforeFirst()
immediately after to reset it, since it has positioned itself past the first row now.
然而,应该注意的是,下面的Seifer 的回答是这个问题的更优雅的解决方案.
It should be noted however, that Seifer's answer below is a more elegant solution to this question.