Package com.mysql.cj.protocol.a.result
Class ResultsetRowsCursor
java.lang.Object
com.mysql.cj.protocol.a.result.AbstractResultsetRows
com.mysql.cj.protocol.a.result.ResultsetRowsCursor
- All Implemented Interfaces:
ProtocolEntity,ResultsetRows,RowList,java.util.Iterator<Row>
public class ResultsetRowsCursor extends AbstractResultsetRows implements ResultsetRows
Model for result set data backed by a cursor (see http://dev.mysql.com/doc/refman/5.7/en/cursors.html and
SERVER_STATUS_CURSOR_EXISTS flag description on http://dev.mysql.com/doc/internals/en/status-flags.html).
Only works for forward-only result sets (but still works with updatable concurrency).
-
Field Summary
Fields Modifier and Type Field Description protected NativeMessageBuildercommandBuilderFields inherited from class com.mysql.cj.protocol.a.result.AbstractResultsetRows
BEFORE_START_OF_ROWS, currentPositionInFetchedRows, metadata, owner, rowFactory, wasEmpty -
Constructor Summary
Constructors Constructor Description ResultsetRowsCursor(NativeProtocol ioChannel, ColumnDefinition columnDefinition)Creates a new cursor-backed row provider. -
Method Summary
Modifier and Type Method Description voidaddRow(Row row)Adds a row.voidafterLast()Moves to after last.voidbeforeFirst()Moves to before first.voidbeforeLast()Moves to before last.voidclose()We're done.intgetPosition()Returns the current position.booleanhasNext()booleanisAfterLast()Returns true if we got the last element.booleanisBeforeFirst()Returns if iteration has not occured yet.booleanisEmpty()Has no records.booleanisFirst()Are we on the first row of the result set?booleanisLast()Are we on the last row of the result set?voidmoveRowRelative(int rows)Moves the current position relative 'rows' from the current position.Rownext()voidsetCurrentRow(int rowNumber)Moves the current position in the result set to the given row number.Methods inherited from class com.mysql.cj.protocol.a.result.AbstractResultsetRows
getMetadata, getOwner, setMetadata, setOwner, wasEmptyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.mysql.cj.protocol.ResultsetRows
getMetadata, getOwner, isDynamic, setMetadata, setOwner, wasEmpty
-
Field Details
-
Constructor Details
-
ResultsetRowsCursor
Creates a new cursor-backed row provider.- Parameters:
ioChannel- connection to the server.columnDefinition- field-level metadata for the results that this cursor covers.
-
-
Method Details
-
isAfterLast
public boolean isAfterLast()Description copied from interface:ResultsetRowsReturns true if we got the last element.- Specified by:
isAfterLastin interfaceResultsetRows- Returns:
- true if after last row
-
isBeforeFirst
public boolean isBeforeFirst()Description copied from interface:ResultsetRowsReturns if iteration has not occured yet.- Specified by:
isBeforeFirstin interfaceResultsetRows- Returns:
- true if before first row
-
getPosition
public int getPosition()Description copied from interface:RowListReturns the current position.- Specified by:
getPositionin interfaceRowList- Returns:
- the current row number
-
isEmpty
public boolean isEmpty()Description copied from interface:ResultsetRowsHas no records.- Specified by:
isEmptyin interfaceResultsetRows- Returns:
- true if no records
-
isFirst
public boolean isFirst()Description copied from interface:ResultsetRowsAre we on the first row of the result set?- Specified by:
isFirstin interfaceResultsetRows- Returns:
- true if on first row
-
isLast
public boolean isLast()Description copied from interface:ResultsetRowsAre we on the last row of the result set?- Specified by:
isLastin interfaceResultsetRows- Returns:
- true if on last row
-
close
public void close()Description copied from interface:ResultsetRowsWe're done.- Specified by:
closein interfaceResultsetRows
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfacejava.util.Iterator<Row>
-
next
- Specified by:
nextin interfacejava.util.Iterator<Row>
-
addRow
Description copied from interface:ResultsetRowsAdds a row.- Specified by:
addRowin interfaceResultsetRows- Parameters:
row- the row to add
-
afterLast
public void afterLast()Description copied from interface:ResultsetRowsMoves to after last.- Specified by:
afterLastin interfaceResultsetRows
-
beforeFirst
public void beforeFirst()Description copied from interface:ResultsetRowsMoves to before first.- Specified by:
beforeFirstin interfaceResultsetRows
-
beforeLast
public void beforeLast()Description copied from interface:ResultsetRowsMoves to before last.- Specified by:
beforeLastin interfaceResultsetRows
-
moveRowRelative
public void moveRowRelative(int rows)Description copied from interface:ResultsetRowsMoves the current position relative 'rows' from the current position.- Specified by:
moveRowRelativein interfaceResultsetRows- Parameters:
rows- the relative number of rows to move
-
setCurrentRow
public void setCurrentRow(int rowNumber)Description copied from interface:ResultsetRowsMoves the current position in the result set to the given row number.- Specified by:
setCurrentRowin interfaceResultsetRows- Parameters:
rowNumber- row to move to
-