Package com.mysql.cj.xdevapi
Interface FetchResult<T>
- Type Parameters:
T
- the type of element returned from the query (doc or row)
- All Superinterfaces:
java.lang.Iterable<T>
,java.util.Iterator<T>
- All Known Implementing Classes:
DocResultImpl
,RowResultImpl
,SqlMultiResult
,SqlSingleResult
,SqlUpdateResult
public interface FetchResult<T>
extends java.util.Iterator<T>, java.lang.Iterable<T>
A set of elements from a query command.
-
Method Summary
Modifier and Type Method Description long
count()
How many items are in this result? This method forces internal buffering of the entire result.java.util.List<T>
fetchAll()
Create a list of all elements in the result forcing internal buffering.default T
fetchOne()
Fetch the next element.default boolean
hasData()
Does this result have data? This indicates that the result was produced from a data-returning query.default java.util.Iterator<T>
iterator()
Create an iterator over all elements of the result.
-
Method Details
-
hasData
default boolean hasData()Does this result have data? This indicates that the result was produced from a data-returning query. It does not indicate whether there are more than 0 rows in the result.- Returns:
- true if has data
-
fetchOne
Fetch the next element.- Returns:
- element of type T
-
iterator
Create an iterator over all elements of the result.- Specified by:
iterator
in interfacejava.lang.Iterable<T>
- Returns:
- iterator over result items
-
count
long count()How many items are in this result? This method forces internal buffering of the entire result.- Returns:
- number of elements in result
-
fetchAll
java.util.List<T> fetchAll()Create a list of all elements in the result forcing internal buffering.- Returns:
- list of result elements
-