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 NativeMessageBuilder
commandBuilder
Fields 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 void
addRow(Row row)
Adds a row.void
afterLast()
Moves to after last.void
beforeFirst()
Moves to before first.void
beforeLast()
Moves to before last.void
close()
We're done.int
getPosition()
Returns the current position.boolean
hasNext()
boolean
isAfterLast()
Returns true if we got the last element.boolean
isBeforeFirst()
Returns if iteration has not occured yet.boolean
isEmpty()
Has no records.boolean
isFirst()
Are we on the first row of the result set?boolean
isLast()
Are we on the last row of the result set?void
moveRowRelative(int rows)
Moves the current position relative 'rows' from the current position.Row
next()
void
setCurrentRow(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, wasEmpty
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:ResultsetRows
Returns true if we got the last element.- Specified by:
isAfterLast
in interfaceResultsetRows
- Returns:
- true if after last row
-
isBeforeFirst
public boolean isBeforeFirst()Description copied from interface:ResultsetRows
Returns if iteration has not occured yet.- Specified by:
isBeforeFirst
in interfaceResultsetRows
- Returns:
- true if before first row
-
getPosition
public int getPosition()Description copied from interface:RowList
Returns the current position.- Specified by:
getPosition
in interfaceRowList
- Returns:
- the current row number
-
isEmpty
public boolean isEmpty()Description copied from interface:ResultsetRows
Has no records.- Specified by:
isEmpty
in interfaceResultsetRows
- Returns:
- true if no records
-
isFirst
public boolean isFirst()Description copied from interface:ResultsetRows
Are we on the first row of the result set?- Specified by:
isFirst
in interfaceResultsetRows
- Returns:
- true if on first row
-
isLast
public boolean isLast()Description copied from interface:ResultsetRows
Are we on the last row of the result set?- Specified by:
isLast
in interfaceResultsetRows
- Returns:
- true if on last row
-
close
public void close()Description copied from interface:ResultsetRows
We're done.- Specified by:
close
in interfaceResultsetRows
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfacejava.util.Iterator<Row>
-
next
- Specified by:
next
in interfacejava.util.Iterator<Row>
-
addRow
Description copied from interface:ResultsetRows
Adds a row.- Specified by:
addRow
in interfaceResultsetRows
- Parameters:
row
- the row to add
-
afterLast
public void afterLast()Description copied from interface:ResultsetRows
Moves to after last.- Specified by:
afterLast
in interfaceResultsetRows
-
beforeFirst
public void beforeFirst()Description copied from interface:ResultsetRows
Moves to before first.- Specified by:
beforeFirst
in interfaceResultsetRows
-
beforeLast
public void beforeLast()Description copied from interface:ResultsetRows
Moves to before last.- Specified by:
beforeLast
in interfaceResultsetRows
-
moveRowRelative
public void moveRowRelative(int rows)Description copied from interface:ResultsetRows
Moves the current position relative 'rows' from the current position.- Specified by:
moveRowRelative
in interfaceResultsetRows
- Parameters:
rows
- the relative number of rows to move
-
setCurrentRow
public void setCurrentRow(int rowNumber)Description copied from interface:ResultsetRows
Moves the current position in the result set to the given row number.- Specified by:
setCurrentRow
in interfaceResultsetRows
- Parameters:
rowNumber
- row to move to
-