OResultSet

This class provides an interface for operating on data returned by OrientDB queries and commands.

Managing Result-sets

Whenever you issue a query or command to an OrientDB database, (through the ODatabaseDocument class, for instance), OrientDB returns results as an OResultSet instance. You can then operate on this instance to retrieve data or further process it before returning it to the user.

To use OResultSet, you need to import it to your code.

import com.orientechnologies.orient.core.sql.executor.OResultSet;

Once you've imported it, you can set variables with this class and retrieve results.

Example

private ODatabaseDocument db;
...

// Return Count of Accounts 
public long fetchAccountCount(){

	// Fetch Data
	OResultSet data = db.query("SELECT FROM Accounts");

	return data.elementStream().count();
}

Methods

MethodReturn TypeDescription
close()voidCloses the result-set
edgeStreamStream<OEdge>Returns a stream of edges from the result-set
elementStream()Stream<OElement>Returns a stream of elements from the result-set
estimateSize()longEstimates the number of records in the result-set
hasNext()booleanDetermines whether the Iterator contains additional values
next()OResultReturns the next result in the result-set
remove()voidRemoves the last value returned by the Iterator
stream()Stream<OResult>Streams the results in the result-set
vertexStream()Stream<OVertex>Streams vertices from the result-set