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
Method | Return Type | Description |
---|---|---|
close() | void | Closes the result-set |
edgeStream | Stream <OEdge> | Returns a stream of edges from the result-set |
elementStream() | Stream <OElement> | Returns a stream of elements from the result-set |
estimateSize() | long | Estimates the number of records in the result-set |
hasNext() | boolean | Determines whether the Iterator contains additional values |
next() | OResult | Returns the next result in the result-set |
remove() | void | Removes 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 |