简体   繁体   English

ResultSet对象是什么样的?

[英]What does a ResultSet object look like?

Is it like an array or is it like a database/excel table ? 它像数组还是数据库/ excel表? Or something else ? 或者是其他东西 ?

I think the best way to know that is to look at the javadoc here 我认为最好的方法是在这里查看javadoc

http://docs.oracle.com/javase/6/docs/api/java/sql/ResultSet.html http://docs.oracle.com/javase/6/docs/api/java/sql/ResultSet.html

In the javadoc you have code sample to get and use such objects. 在javadoc中,您有获取和使用此类对象的代码示例。

It is JDBC driver dependant, ResultSet is just an interface. 它取决于JDBC驱动程序, ResultSet只是一个接口。 But in principle the closest you can get is an Iterator . 但是从原理上讲,最接近的是Iterator ResultSet gives you one result at a time and allows to query whether there are any more results. ResultSet给您一个结果,并允许查询是否还有其他结果。 Theoretically ResultSet can fetch one record at a time as well. 从理论上讲, ResultSet也可以获取一条记录。

Taken from javadocs: 取自javadocs:

A table of data representing a database result set, which is usually generated by executing a statement that queries the database. 代表数据库结果集的数据表,通常通过执行查询数据库的语句来生成。

http://docs.oracle.com/javase/6/docs/api/java/sql/ResultSet.html http://docs.oracle.com/javase/6/docs/api/java/sql/ResultSet.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM