Package com.mysql.cj.xdevapi
Class SqlMultiResult
java.lang.Object
com.mysql.cj.xdevapi.SqlMultiResult
- All Implemented Interfaces:
ResultStreamer
,QueryResult
,FetchResult<Row>
,InsertResult
,Result
,RowResult
,SqlResult
,java.lang.Iterable<Row>
,java.util.Iterator<Row>
public class SqlMultiResult extends java.lang.Object implements SqlResult, ResultStreamer
SqlResult
representing a multiple result sets.-
Constructor Summary
Constructors Constructor Description SqlMultiResult(java.util.function.Supplier<SqlResult> resultStream)
Constructor. -
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<Row>
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.java.lang.Long
getAutoIncrementValue()
Get the auto-increment value if one was generated from a row insert statement.int
getColumnCount()
Count of columns.java.util.List<java.lang.String>
getColumnNames()
Names of columns.java.util.List<Column>
getColumns()
Metadata.java.util.Iterator<Warning>
getWarnings()
Get warnings generated during statement execution.int
getWarningsCount()
Get the number of warnings generated during statement execution.boolean
hasData()
Does this result have data? This indicates that the result was produced from a data-returning query.boolean
hasNext()
Row
next()
boolean
nextResult()
Move to the next result.
-
Constructor Details
-
SqlMultiResult
Constructor.- Parameters:
resultStream
- Supplies the result stream depending on query type. Could beSqlSingleResult
,SqlUpdateResult
etc.
-
-
Method Details
-
nextResult
public boolean nextResult()Description copied from interface:SqlResult
Move to the next result. This method has no effect after returningfalse
for the first time.- Specified by:
nextResult
in interfaceSqlResult
- Returns:
- was there a next result that we moved to?
-
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
-
hasData
public boolean hasData()Description copied from interface:FetchResult
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.- Specified by:
hasData
in interfaceFetchResult<Row>
- Returns:
- true if has data
-
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
-
getAutoIncrementValue
public java.lang.Long getAutoIncrementValue()Description copied from interface:InsertResult
Get the auto-increment value if one was generated from a row insert statement.- Specified by:
getAutoIncrementValue
in interfaceInsertResult
- Specified by:
getAutoIncrementValue
in interfaceSqlResult
- Returns:
- auto-increment value
-
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
-
getColumnCount
public int getColumnCount()Description copied from interface:RowResult
Count of columns.- Specified by:
getColumnCount
in interfaceRowResult
- Returns:
- count
-
getColumns
Description copied from interface:RowResult
Metadata.- Specified by:
getColumns
in interfaceRowResult
- Returns:
- list of result
Column
objects
-
getColumnNames
public java.util.List<java.lang.String> getColumnNames()Description copied from interface:RowResult
Names of columns.- Specified by:
getColumnNames
in interfaceRowResult
- Returns:
- list of result column names
-
count
public long count()Description copied from interface:FetchResult
How many items are in this result? This method forces internal buffering of the entire result.- Specified by:
count
in interfaceFetchResult<Row>
- Returns:
- number of elements in result
-
fetchAll
Description copied from interface:FetchResult
Create a list of all elements in the result forcing internal buffering.- Specified by:
fetchAll
in interfaceFetchResult<Row>
- Returns:
- list of result elements
-
next
- Specified by:
next
in interfacejava.util.Iterator<Row>
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfacejava.util.Iterator<Row>
-