Class RowDataCursor

java.lang.Object
com.mysql.jdbc.RowDataCursor
All Implemented Interfaces:
RowData

public class RowDataCursor extends Object implements RowData
Model for result set data backed by a cursor. Only works for forward-only result sets (but still works with updatable concurrency).
  • Constructor Details

    • RowDataCursor

      public RowDataCursor(MysqlIO ioChannel, ServerPreparedStatement creatingStatement, Field[] metadata)
      Creates a new cursor-backed row provider.
      Parameters:
      ioChannel - connection to the server.
      creatingStatement - statement that opened the cursor.
      metadata - field-level metadata for the results that this cursor covers.
  • Method Details

    • isAfterLast

      public boolean isAfterLast()
      Returns true if we got the last element.
      Specified by:
      isAfterLast in interface RowData
      Returns:
      true if after last row
    • getAt

      public ResultSetRow getAt(int ind) throws SQLException
      Only works on non dynamic result sets.
      Specified by:
      getAt in interface RowData
      Parameters:
      ind - row number to get at
      index - row number to get at
      Returns:
      row data at index
      Throws:
      SQLException - if a database error occurs
    • isBeforeFirst

      public boolean isBeforeFirst() throws SQLException
      Returns if iteration has not occured yet.
      Specified by:
      isBeforeFirst in interface RowData
      Returns:
      true if before first row
      Throws:
      SQLException - if a database error occurs
    • setCurrentRow

      public void setCurrentRow(int rowNumber) throws SQLException
      Moves the current position in the result set to the given row number.
      Specified by:
      setCurrentRow in interface RowData
      Parameters:
      rowNumber - row to move to
      Throws:
      SQLException - if a database error occurs
    • getCurrentRowNumber

      public int getCurrentRowNumber() throws SQLException
      Returns the current position in the result set as a row number.
      Specified by:
      getCurrentRowNumber in interface RowData
      Returns:
      the current row number
      Throws:
      SQLException - if a database error occurs
    • isDynamic

      public boolean isDynamic()
      Returns true if the result set is dynamic. This means that move back and move forward won't work because we do not hold on to the records.
      Specified by:
      isDynamic in interface RowData
      Returns:
      true if this result set is streaming from the server
    • isEmpty

      public boolean isEmpty() throws SQLException
      Has no records.
      Specified by:
      isEmpty in interface RowData
      Returns:
      true if no records
      Throws:
      SQLException - if a database error occurs
    • isFirst

      public boolean isFirst() throws SQLException
      Are we on the first row of the result set?
      Specified by:
      isFirst in interface RowData
      Returns:
      true if on first row
      Throws:
      SQLException - if a database error occurs
    • isLast

      public boolean isLast() throws SQLException
      Are we on the last row of the result set?
      Specified by:
      isLast in interface RowData
      Returns:
      true if on last row
      Throws:
      SQLException - if a database error occurs
    • addRow

      public void addRow(ResultSetRow row) throws SQLException
      Adds a row to this row data.
      Specified by:
      addRow in interface RowData
      Parameters:
      row - the row to add
      Throws:
      SQLException - if a database error occurs
    • afterLast

      public void afterLast() throws SQLException
      Moves to after last.
      Specified by:
      afterLast in interface RowData
      Throws:
      SQLException - if a database error occurs
    • beforeFirst

      public void beforeFirst() throws SQLException
      Moves to before first.
      Specified by:
      beforeFirst in interface RowData
      Throws:
      SQLException - if a database error occurs
    • beforeLast

      public void beforeLast() throws SQLException
      Moves to before last so next el is the last el.
      Specified by:
      beforeLast in interface RowData
      Throws:
      SQLException - if a database error occurs
    • close

      public void close() throws SQLException
      We're done.
      Specified by:
      close in interface RowData
      Throws:
      SQLException - if a database error occurs
    • hasNext

      public boolean hasNext() throws SQLException
      Returns true if another row exists.
      Specified by:
      hasNext in interface RowData
      Returns:
      true if more rows
      Throws:
      SQLException - if a database error occurs
    • moveRowRelative

      public void moveRowRelative(int rows) throws SQLException
      Moves the current position relative 'rows' from the current position.
      Specified by:
      moveRowRelative in interface RowData
      Parameters:
      rows - the relative number of rows to move
      Throws:
      SQLException - if a database error occurs
    • next

      public ResultSetRow next() throws SQLException
      Returns the next row.
      Specified by:
      next in interface RowData
      Returns:
      the next row value
      Throws:
      SQLException - if a database error occurs
    • removeRow

      public void removeRow(int ind) throws SQLException
      Removes the row at the given index.
      Specified by:
      removeRow in interface RowData
      Parameters:
      ind - the row to move to
      index - the row to move to
      Throws:
      SQLException - if a database error occurs
    • size

      public int size()
      Only works on non dynamic result sets.
      Specified by:
      size in interface RowData
      Returns:
      the size of this row data
    • nextRecord

      protected void nextRecord() throws SQLException
      Throws:
      SQLException
    • setOwner

      public void setOwner(ResultSetImpl rs)
      Description copied from interface: RowData
      Set the result set that 'owns' this RowData
      Specified by:
      setOwner in interface RowData
      Parameters:
      rs - the result set that 'owns' this RowData
    • getOwner

      public ResultSetInternalMethods getOwner()
      Description copied from interface: RowData
      Returns the result set that 'owns' this RowData
      Specified by:
      getOwner in interface RowData
    • wasEmpty

      public boolean wasEmpty()
      Description copied from interface: RowData
      Did this result set have no rows?
      Specified by:
      wasEmpty in interface RowData
    • setMetadata

      public void setMetadata(Field[] metadata)
      Description copied from interface: RowData
      Sometimes the driver doesn't have metadata until after the statement has the result set in-hand (because it's cached), so it can call this to set it after the fact.
      Specified by:
      setMetadata in interface RowData
      Parameters:
      metadata - field-level metadata for the result set