com.neeve.query
Interface QueryResultSet<REC>

Type Parameters:
REC - The lower bound on the result type
All Known Subinterfaces:
IStoreQueryResultSet, RogLogResultSet

public interface QueryResultSet<REC>

Encapsulates the results of a QueryEngine query. This class allows navigation of the results and access to the selected fields as columns.


Nested Class Summary
static class QueryResultSet.Collation
          The ways in which the results of multiple Repositories can be combined.
static interface QueryResultSet.Row<REC>
          Models a result row.
 
Method Summary
 boolean absolute(int row)
          Moves the cursor to the given row number in this ResultSet object.
 void beforeFirst()
          Resets the cursor to the beginning of this QueryResultSet object, just before the first row.
 void close()
          Close the result set and release any associated resources.
 void describePlan(PrintStream out)
          Prints the query plan for this QueryResultSet.
 boolean first()
          Set the cursor to the beginning of this QueryResultSet to the first result.
<S> S[]
getArray(int columnIndex)
          Gets the value for columnIndex as an array.
<S> S[]
getArray(String columnName)
          Gets the value for columnName as an int.
 BigDecimal getBigDecimal(int columnIndex)
          Gets the value for columnIndex as a BigDecimal.
 BigDecimal getBigDecimal(String columnName)
          Gets the value for columnName as an BigDecimal.
 BigInteger getBigInteger(int columnIndex)
          Gets the value for columnIndex as a BigInteger.
 BigInteger getBigInteger(String columnName)
          Gets the value for columnName as an BigInteger.
 boolean getBoolean(int columnIndex)
          Gets the value for columnIndex as a boolean.
 boolean getBoolean(String columnName)
          Gets the value for columnName as an boolean.
 byte getByte(int columnIndex)
          Gets the value for columnIndex as a byte.
 byte getByte(String columnName)
          Gets the value for columnName as a byte.
 char getChar(int columnIndex)
          Gets the value for columnIndex as a char.
 char getChar(String columnName)
          Gets the value for columnName as an char.
 int getCount()
          Returns the number of results in this result set.
 Currency getCurrency(int columnIndex)
          Gets the value for columnIndex as a Currency.
 Currency getCurrency(String columnName)
          Gets the value for columnName as a Currency.
 Date getDate(int columnIndex)
          Gets the value for columnIndex as a Date.
 Date getDate(String columnName)
          Gets the value for columnName as an Date.
 double getDouble(int columnIndex)
          Gets the value for columnIndex as a double.
 double getDouble(String columnName)
          Gets the value for columnName as an double.
 int getEstimatedCount()
          Returns the estimated number rows that need to be scanned to fulfill this query.
 float getFloat(int columnIndex)
          Gets the value for columnIndex as a float.
 float getFloat(String columnName)
          Gets the value for columnName as a float.
 int getInteger(int columnIndex)
          Gets the value for columnIndex as an int.
 int getInteger(String columnName)
          Gets the value for columnName as an int.
 long getLong(int columnIndex)
          Gets the value for columnIndex as a long.
 long getLong(String columnName)
          Gets the value for columnName as an long.
<S> S
getObject(int columnIndex)
          Gets the value for columnIndex as an object.
<S> S
getObject(String columnName)
          Gets the value for columnName as an Object.
 QueryPlan getPlan(String repository)
          Retrieve the QueryPlan for a specific repository.
 QueryResult<REC> getQueryResult()
          Accesses the raw QueryResult for the Query.
 REC getRawResult()
          Gets the raw result object from which query results have been projected.
 List<IdxField<REC,?>> getSelectedFields()
          Gets the fields selected for this QueryResult.
 short getShort(int columnIndex)
          Gets the value for columnIndex as a short.
 short getShort(String columnName)
          Gets the value for columnName as a short.
 String getString(int columnIndex)
          Gets the value for columnIndex as a String.
 String getString(String columnName)
          Gets the value for columnName as an String.
 boolean isFullScan()
          Indicates whether the query must perform a full scan of the repository.
 boolean next()
          Move to the next record.
 void setCollation(QueryResultSet.Collation collation)
          Set the QueryResultSet.Collation.
 

Method Detail

setCollation

void setCollation(QueryResultSet.Collation collation)
Set the QueryResultSet.Collation.

Parameters:
collation - The collation to use for results when operating on multiple repositories.

getSelectedFields

List<IdxField<REC,?>> getSelectedFields()
Gets the fields selected for this QueryResult. The returned list should not be mutated.

Returns:
the fields selected for this QueryResult.

getPlan

QueryPlan getPlan(String repository)
Retrieve the QueryPlan for a specific repository.

Parameters:
repository -
Returns:
The QueryPlan

close

void close()
Close the result set and release any associated resources.


absolute

boolean absolute(int row)
Moves the cursor to the given row number in this ResultSet object.

If the row number is positive, the cursor moves to the given row number with respect to the beginning of the result set. The first row is row 1, the second is row 2, and so on.

If the given row number is negative, the cursor moves to an absolute row position with respect to the end of the result set. For example, calling the method absolute(-1) positions the cursor on the last row; calling the method absolute(-2) moves the cursor to the next-to-last row, and so on.

If the row number specified is zero, the cursor is moved to before the first row.

An attempt to position the cursor beyond the first/last row in the result set leaves the cursor before the first row or after the last row.

Note: Calling absolute(1) is the same as calling first(). Calling absolute(-1) is the same as calling last().

Parameters:
row - the number of the row to which the cursor should move. A value of zero indicates that the cursor will be positioned before the first row; a positive number indicates the row number counting from the beginning of the result set; a negative number indicates the row number counting from the end of the result set
Returns:
true if the cursor is moved to a position in this ResultSet object; false if the cursor is before the first row or after the last row

beforeFirst

void beforeFirst()
Resets the cursor to the beginning of this QueryResultSet object, just before the first row.


first

boolean first()
Set the cursor to the beginning of this QueryResultSet to the first result.

Returns:
True if there is a result.

next

boolean next()
Move to the next record.

Returns:
false If there is no next record.

getQueryResult

QueryResult<REC> getQueryResult()
Accesses the raw QueryResult for the Query. The raw result holds the backing object from which the individual fields projected in the result were retrieved. All fields that have selected in via the select operation that produces this result are guaranteed to be present in the returned object, the presence of non selected fields in the returned object is dependent on the QueryEngine implementation.

Example

For a query like:
SELECT Customer FROM Repositories WHERE Customer.lastName = "Jones"
 QueryResultSet result = engine.select(query);
 for(Customer customer : result) {
  System.out.println("Found: " + customer.getFirstName() + " " + customer.getLastName());
 }
 

Returns:
An iterable QueryResult.

getRawResult

REC getRawResult()
Gets the raw result object from which query results have been projected.

Example

For a query like:
SELECT Customer.firstName FROM repository WHERE Customer.lastName = "Jones"
 QueryResultSet result = engine.select(query);
 if(result.next()) {
  Customer customer = (Customer) result.getRawResult();
 }
 

Returns:
The raw result.

getCount

int getCount()
Returns the number of results in this result set.

NOTE: This may result in a full scan of the results to determine the result size. You might consider calling getEstimatedCount() instead.

Returns:
The number of results in this result set.
See Also:


getEstimatedCount

int getEstimatedCount()
Returns the estimated number rows that need to be scanned to fulfill this query. A value of Integer.MAX_VALUE indicates that a full scan will be required.

NOTE: This may result in a full scan of the results to determine the result size.

Returns:
The number of results in this result set.

isFullScan

boolean isFullScan()
Indicates whether the query must perform a full scan of the repository.


getShort

short getShort(String columnName)
Gets the value for columnName as a short.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a short.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getByte

byte getByte(String columnName)
Gets the value for columnName as a byte.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a byte.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getInteger

int getInteger(String columnName)
Gets the value for columnName as an int.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a int.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getLong

long getLong(String columnName)
Gets the value for columnName as an long.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a long.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getFloat

float getFloat(String columnName)
Gets the value for columnName as a float.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a float.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getDouble

double getDouble(String columnName)
Gets the value for columnName as an double.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a double.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getBoolean

boolean getBoolean(String columnName)
Gets the value for columnName as an boolean.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a boolean.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getChar

char getChar(String columnName)
Gets the value for columnName as an char.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a char.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getArray

<S> S[] getArray(String columnName)
Gets the value for columnName as an int.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a int.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getObject

<S> S getObject(String columnName)
Gets the value for columnName as an Object.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a Object.
Throws:
QueryException - If this result set doesn't have such a column.

getString

String getString(String columnName)
Gets the value for columnName as an String.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a String.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getDate

Date getDate(String columnName)
Gets the value for columnName as an Date.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a Date.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getBigInteger

BigInteger getBigInteger(String columnName)
Gets the value for columnName as an BigInteger.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a BigInteger.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getBigDecimal

BigDecimal getBigDecimal(String columnName)
Gets the value for columnName as an BigDecimal.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a BigDecimal.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getCurrency

Currency getCurrency(String columnName)
Gets the value for columnName as a Currency.

Parameters:
columnName - The name of the column.
Returns:
The value value for columnName as a Currency.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getShort

short getShort(int columnIndex)
Gets the value for columnIndex as a short.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as a short.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getByte

byte getByte(int columnIndex)
Gets the value for columnIndex as a byte.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as a byte.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getInteger

int getInteger(int columnIndex)
Gets the value for columnIndex as an int.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as a int.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getLong

long getLong(int columnIndex)
Gets the value for columnIndex as a long.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as a long.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getFloat

float getFloat(int columnIndex)
Gets the value for columnIndex as a float.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as a float.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getDouble

double getDouble(int columnIndex)
Gets the value for columnIndex as a double.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as a double.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getBoolean

boolean getBoolean(int columnIndex)
Gets the value for columnIndex as a boolean.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as a boolean.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getChar

char getChar(int columnIndex)
Gets the value for columnIndex as a char.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as a char.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getArray

<S> S[] getArray(int columnIndex)
Gets the value for columnIndex as an array.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as an array.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getObject

<S> S getObject(int columnIndex)
Gets the value for columnIndex as an object.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as an object.
Throws:
QueryException - If this result set doesn't have such a column.

getString

String getString(int columnIndex)
Gets the value for columnIndex as a String.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as a String.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getDate

Date getDate(int columnIndex)
Gets the value for columnIndex as a Date.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as a Date.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getBigInteger

BigInteger getBigInteger(int columnIndex)
Gets the value for columnIndex as a BigInteger.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as a BigInteger.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getBigDecimal

BigDecimal getBigDecimal(int columnIndex)
Gets the value for columnIndex as a BigDecimal.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as a BigDecimal.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

getCurrency

Currency getCurrency(int columnIndex)
Gets the value for columnIndex as a Currency.

Parameters:
columnIndex - The name of the column.
Returns:
The value value for columnIndex as a Currency.
Throws:
QueryException - If this result set doesn't have such a column or the type is incorrect.

describePlan

void describePlan(PrintStream out)
Prints the query plan for this QueryResultSet.

Parameters:
out - The print stream to which to write results.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.