/**
   * Returns the next row.
   *
   * @return the next row value
   * @throws SQLException if a database error occurs
   */
  public ResultSetRow next() throws SQLException {
    if (this.fetchedRows == null && this.currentPositionInEntireResult != BEFORE_START_OF_ROWS) {
      throw SQLError.createSQLException(
          Messages.getString(
              "ResultSet.Operation_not_allowed_after_ResultSet_closed_144"), //$NON-NLS-1$
          SQLError.SQL_STATE_GENERAL_ERROR,
          mysql.getExceptionInterceptor());
    }

    if (!hasNext()) {
      return null;
    }

    this.currentPositionInEntireResult++;
    this.currentPositionInFetchedRows++;

    // Catch the forced scroll-passed-end
    if (this.fetchedRows != null && this.fetchedRows.size() == 0) {
      return null;
    }

    if (this.currentPositionInFetchedRows > (this.fetchedRows.size() - 1)) {
      fetchMoreRows();
      this.currentPositionInFetchedRows = 0;
    }

    ResultSetRow row = this.fetchedRows.get(this.currentPositionInFetchedRows);

    row.setMetadata(this.metadata);

    return row;
  }
示例#2
0
  public ResultSetRow setMetadata(Field[] f) throws SQLException {
    super.setMetadata(f);

    if (this.isBinaryEncoded) {
      setupIsNullBitmask();
    }

    return this;
  }