Ejemplo n.º 1
0
 /**
  * Returns whether or not there are any remaining objects in the table. Can be called before
  * next().
  *
  * @throws SQLException If there was a problem getting more results via SQL.
  */
 public boolean hasNextThrow() throws SQLException {
   if (closed) {
     return false;
   }
   if (alreadyMoved) {
     // we do this so multiple hasNext() calls can be made, result would be true or closed is true
     return true;
   }
   boolean result;
   if (first) {
     first = false;
     result = results.first();
   } else {
     result = results.next();
   }
   if (!result) {
     close();
   }
   alreadyMoved = true;
   return result;
 }
Ejemplo n.º 2
0
 public T nextThrow() throws SQLException {
   if (closed) {
     return null;
   }
   if (!alreadyMoved) {
     boolean hasResult;
     if (first) {
       first = false;
       hasResult = results.first();
     } else {
       hasResult = results.next();
     }
     // move forward
     if (!hasResult) {
       first = false;
       return null;
     }
   }
   first = false;
   return getCurrent();
 }