Package com.mysql.cj.protocol.a.result
Class ResultsetRowsStatic
java.lang.Object
com.mysql.cj.protocol.a.result.AbstractResultsetRows
com.mysql.cj.protocol.a.result.ResultsetRowsStatic
- All Implemented Interfaces:
ProtocolEntity,ResultsetRows,RowList,java.util.Iterator<Row>
public class ResultsetRowsStatic extends AbstractResultsetRows implements ResultsetRows
Represents an in-memory result set
-
Field Summary
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 ResultsetRowsStatic(java.util.List<? extends Row> rows, ColumnDefinition columnDefinition)Creates a new RowDataStatic object. -
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.Rowget(int atIndex)Optionally retrieve Row at index n.intgetPosition()Returns the current position.booleanhasNext()booleanisAfterLast()Returns true if we got the last element.booleanisBeforeFirst()Returns if iteration has not occured yet.booleanisDynamic()Returns true if the result set is dynamic.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 rowsToMove)Moves the current position relative 'rows' from the current position.Rownext()voidremove()voidsetCurrentRow(int newIndex)Moves the current position in the result set to the given row number.intsize()Only works on non dynamic row lists.booleanwasEmpty()Did this result set have no rows?Methods inherited from class com.mysql.cj.protocol.a.result.AbstractResultsetRows
getMetadata, getOwner, setMetadata, setOwnerMethods 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
close, getMetadata, getOwner, setMetadata, setOwner
-
Constructor Details
-
ResultsetRowsStatic
Creates a new RowDataStatic object.- Parameters:
rows- list ofRowinstancescolumnDefinition-ColumnDefinitionfor this result set
-
-
Method Details
-
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
-
get
Description copied from interface:RowListOptionally retrieve Row at index n. Only works on non dynamic row lists. -
getPosition
public int getPosition()Description copied from interface:RowListReturns the current position.- Specified by:
getPositionin interfaceRowList- Returns:
- the current row number
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfacejava.util.Iterator<Row>
-
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
-
isDynamic
public boolean isDynamic()Description copied from interface:ResultsetRowsReturns 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:
isDynamicin interfaceResultsetRows- Returns:
- true if this result set is streaming from the server
-
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
-
moveRowRelative
public void moveRowRelative(int rowsToMove)Description copied from interface:ResultsetRowsMoves the current position relative 'rows' from the current position.- Specified by:
moveRowRelativein interfaceResultsetRows- Parameters:
rowsToMove- the relative number of rows to move
-
next
- Specified by:
nextin interfacejava.util.Iterator<Row>
-
remove
public void remove()- Specified by:
removein interfacejava.util.Iterator<Row>
-
setCurrentRow
public void setCurrentRow(int newIndex)Description copied from interface:ResultsetRowsMoves the current position in the result set to the given row number.- Specified by:
setCurrentRowin interfaceResultsetRows- Parameters:
newIndex- row to move to
-
size
public int size()Description copied from interface:RowListOnly works on non dynamic row lists. -
wasEmpty
public boolean wasEmpty()Description copied from interface:ResultsetRowsDid this result set have no rows?- Specified by:
wasEmptyin interfaceResultsetRows- Overrides:
wasEmptyin classAbstractResultsetRows- Returns:
- true if the result set did not have rows
-