On this page
          
          
        The Result object in the Polypheny JDBC Multimodel Extension encapsulates the outcome of queries executed using the PolyStatement object. It serves as a wrapper for different types of results such as RelationalResult, DocumentResult, GraphResult, and ScalarResult.
  
  
    getResultType 
  
  
    
public ResultType getResultType()
Returns the type of the encapsulated result.
Return Type:
- Returns one of the following 
ResultTypeconstants:Result.RELATIONAL,Result.DOCUMENT,Result.GRAPH,Result.SCALAR. 
Usage:
ResultType type = result.getResultType();
  
  
    unwrap 
  
  
    
public <T> T unwrap(Class<T> aClass) throws ProtoInterfaceServiceException
Unwraps the encapsulated result to its specific type, based on the type parameter passed to the unwrap method.
Parameters:
| Parameter | Type | Description | 
|---|---|---|
aClass | 
      Class<T> | 
      The class to which the result should be unwrapped. | 
Return Type:
Returns an instance of the specified class.
Exceptions:
Throws a ProtoInterfaceServiceException if the result cannot be unwrapped to the specified class type.
Result Types:
| Result Type | Unwrap To | Description | 
|---|---|---|
Result.RELATIONAL | 
      RelationalResult.class | 
      The result contains relational data and can be unwrapped to a RelationalResult object. | 
    
Result.DOCUMENT | 
      DocumentResult.class | 
      The result contains document-based data and can be unwrapped to a DocumentResult object. | 
    
Result.GRAPH | 
      GraphResult.class | 
      The result contains graph-based data and can be unwrapped to a GraphResult object. | 
    
Result.SCALAR | 
      ScalarResult.class | 
      The result contains scalar values and can be unwrapped to a ScalarResult object. | 
    
Usage:
try {
    switch (result.getResultType()) {
        case Result.RELATIONAL:
            RelationalResult relationalResult = result.unwrap(RelationalResult.class);
            // Process the relational result...
            break;
        case Result.DOCUMENT:
            DocumentResult documentResult = result.unwrap(DocumentResult.class);
            // Process the document result...
            break;
        case Result.GRAPH:
            GraphResult graphResult = result.unwrap(GraphResult.class);
            // Process the graph result...
            break;
        case Result.SCALAR:
            ScalarResult scalarResult = result.unwrap(ScalarResult.class);
            // Process the scalar result...
            break;
        default:
            // Handle other types...
    }
} catch (ProtoInterfaceServiceException e) {
    e.printStackTrace();
}
          
          
          
            © Polypheny GmbH. All Rights Reserved.