웹 개발/웹&프로그래밍

ResultSet이란?(짧막 정리)

희랍인 조르바 2018. 4. 26. 14:24

A table of data representing a database result set, which is usually generated by executing a statement that queries the database.


데이터베이스에서 쿼리문을 실행하면서 발생한  결과값을 데이터의 표로 나타낸다. 


ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. The next method moves the cursor to the next row, and because it returns false when there are no more rows in the ResultSet object, it can be used in a while loop to iterate through the result set.

(출처: 오라클 docs)


ResultSet 객체는 커서를 현재 데이터의 행까지 가리키도록 반복한다. 초기에 커서는 첫번째 행 전에 위치한다. next Method는 커서를 다음 행으로 이동시킨다.


그리고 더이상 ResultSet 객체에서 행이 없을 경우 false를 리턴한다. 이 next method는 결과값들을 통하여 while문을 실행하는 것과 같다.(나름 의역?)



* ResultSet이란 쿼리문을 실행하면 얻을 수 있는 결과값으로 이해하면 될 거 같다.