Package com.mysql.cj.xdevapi
Class AbstractDataResult<T>
java.lang.Object
com.mysql.cj.xdevapi.AbstractDataResult<T>
- Type Parameters:
T
- Result entry type
- All Implemented Interfaces:
ResultStreamer
,QueryResult
,Result
,java.util.Iterator<T>
- Direct Known Subclasses:
DocResultImpl
,RowResultImpl
public abstract class AbstractDataResult<T> extends java.lang.Object implements ResultStreamer, java.util.Iterator<T>, Result
Base class for data set results.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<T>
all
List of all elements.protected java.util.function.Supplier<ProtocolEntity>
completer
protected int
count
protected StatementExecuteOk
ok
protected int
position
protected RowList
rows
protected ProtocolEntityFactory<T,XMessage>
rowToData
-
Constructor Summary
Constructors Constructor Description AbstractDataResult(RowList rows, java.util.function.Supplier<ProtocolEntity> completer, ProtocolEntityFactory<T,XMessage> rowToData)
Constructor. -
Method Summary
Modifier and Type Method Description long
count()
Return the number of items in this result.java.util.List<T>
fetchAll()
Create a list of all elements in the result forcing internal buffering.void
finishStreaming()
Finish the result streaming.long
getAffectedItemsCount()
Get the count of affected items from manipulation statements.StatementExecuteOk
getStatementExecuteOk()
Get StatementExecuteOk object finalizing the result transfer.java.util.Iterator<Warning>
getWarnings()
Get warnings generated during statement execution.int
getWarningsCount()
Get the number of warnings generated during statement execution.boolean
hasNext()
T
next()
-
Field Details
-
Constructor Details
-
AbstractDataResult
public AbstractDataResult(RowList rows, java.util.function.Supplier<ProtocolEntity> completer, ProtocolEntityFactory<T,XMessage> rowToData)Constructor.- Parameters:
rows
-RowList
objectcompleter
- Supplier for StatementExecuteOk objectrowToData
-ProtocolEntityFactory
-
-
Method Details
-
next
- Specified by:
next
in interfacejava.util.Iterator<T>
-
fetchAll
Create a list of all elements in the result forcing internal buffering.- Returns:
- list of result elements
-
count
public long count()Return the number of items in this result. Forces internal buffering of the entire result.- Returns:
- number of elements in result
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfacejava.util.Iterator<T>
-
getStatementExecuteOk
Get StatementExecuteOk object finalizing the result transfer. Forces internal buffering of the entire result.- Returns:
- StatementExecuteOk object
-
finishStreaming
public void finishStreaming()Description copied from interface:ResultStreamer
Finish the result streaming. This happens if a new command is started or the warnings/etc are requested. This is safe to call multiple times and only has an effect the first time.- Specified by:
finishStreaming
in interfaceResultStreamer
-
getAffectedItemsCount
public long getAffectedItemsCount()Description copied from interface:Result
Get the count of affected items from manipulation statements. This method forces internal buffering of the result.- Specified by:
getAffectedItemsCount
in interfaceResult
- Returns:
- count
-
getWarningsCount
public int getWarningsCount()Description copied from interface:Result
Get the number of warnings generated during statement execution. This method forces internal buffering of the result.- Specified by:
getWarningsCount
in interfaceResult
- Returns:
- number of warnings
-
getWarnings
Description copied from interface:Result
Get warnings generated during statement execution. This method forces internal buffering of the result.- Specified by:
getWarnings
in interfaceResult
- Returns:
- iterator over warnings
-