public V next ( ) throws SQLException { // if we closed everything up after the last call to next(), // table will be null here and we should bail immediately if ( _table == null ) { return null ; } if ( _result == null ) { if ( _qbeObject != null ) { PreparedStatement qbeStmt = _conn . prepareStatement ( _query ) ; _table . bindQueryVariables ( qbeStmt , _qbeObject , _qbeMask ) ; _result = qbeStmt . executeQuery ( ) ; _stmt = qbeStmt ; } else { if ( _stmt == null ) { _stmt = _conn . createStatement ( ) ; } _result = _stmt . executeQuery ( _query ) ; } } if ( _result . next ( ) ) { return _currObject = _table . load ( _result ) ; } _result . close ( ) ; _result = null ; _currObject = null ; _table = null ; if ( _stmt != null ) { _stmt . close ( ) ; } return null ; }
A cursor is initially positioned before its first row ; the first call to next makes the first row the current row ; the second call makes the second row the current row etc .