public interface StatementResult extends Iterator<Record>
records
.
The standard way of navigating through the result returned by the database is to
iterate
over it.
Results are valid until the next statement is run or until the end of the current transaction,
whichever comes first. To keep a result around while further statements are run, or to use a result outside the scope
of the current transaction, see list()
.
StatementRunner
for
important details on the effects of this.
The short version is that, if you want a hard guarantee that the underlying statement
has completed, you need to either call Resource.close()
on the Transaction
or Session
that created this result, or you need to use the result.
Calling any method on this interface will guarantee that any write operation has completed on
the remote database.Modifier and Type | Method and Description |
---|---|
org.neo4j.driver.v1.summary.ResultSummary |
consume()
Consume the entire result, yielding a summary of it.
|
boolean |
hasNext()
Test if there is another record we can navigate to in this result.
|
List<String> |
keys()
Retrieve the keys of the records this result contains.
|
List<Record> |
list()
Retrieve and store the entire result stream.
|
<T> List<T> |
list(org.neo4j.driver.v1.util.Function<Record,T> mapFunction)
Retrieve and store a projection of the entire result.
|
Record |
next()
Navigate to and retrieve the next
Record in this result. |
Record |
peek()
Investigate the next upcoming record without moving forward in the result.
|
Record |
single()
Return the first record in the result, failing if there is not exactly
one record left in the stream
Calling this method always exhausts the result, even when
NoSuchRecordException is thrown. |
boolean hasNext()
Record next()
Record
in this result.next
in interface Iterator<Record>
NoSuchRecordException
- if there is no record left in the streamRecord single() throws NoSuchRecordException
NoSuchRecordException
is thrown.NoSuchRecordException
- if there is not exactly one record left in the streamRecord peek()
NoSuchRecordException
- if there is no record left in the streamList<Record> list()
<T> List<T> list(org.neo4j.driver.v1.util.Function<Record,T> mapFunction)
T
- the type of result list elementsmapFunction
- a function to map from Value to T. See Values
for some predefined functions, such
as Values.ofBoolean()
, Values.ofList(Function)
.org.neo4j.driver.v1.summary.ResultSummary consume()
ResultSummary summary = session.run( "PROFILE MATCH (n:User {id: 12345}) RETURN n" ).consume();
Copyright © 2016. All rights reserved.