GemFire 5.7

com.gemstone.gemfire.cache.query
Interface Query


public interface Query

Interface for query objects. Supports execution of queries with optional parameters.

Since:
4.0

Method Summary
 void compile()
          Compiles this Query to achieve higher performance execution.
 Object execute()
          Execute this query and returns an object that represent its result.
 Object execute(Object[] params)
          Executes this query with the given parameters and returns an object that represent its result.
 String getQueryString()
          Return the original query string that was specified in the constructor.
 QueryStatistics getStatistics()
          Get statistics information for this query.
 boolean isCompiled()
          Return whether this query has been compiled into VM bytecodes.
 

Method Detail

getQueryString

String getQueryString()
Return the original query string that was specified in the constructor.

Returns:
the original query string

execute

Object execute()
               throws FunctionDomainException,
                      TypeMismatchException,
                      NameResolutionException,
                      QueryInvocationTargetException
Execute this query and returns an object that represent its result. If the query resolves to a primitive type, an instance of the corresponding wrapper type (Integer, etc.) is returned. If the query resolves to more than one object, a SelectResults is returned.

Returns:
The object that represents the result of the query. Note that if a query is just a select statement then it will return a result that is an instance of SelectResults. However, since a query is not necessarily just a select statement, the return type of this method is Object. For example, the query (select distinct * from /rgn).size returns an instance of java.lang.Integer.
Throws:
FunctionDomainException - A function was applied to a parameter that is improper for that function. For example, the ELEMENT function was applied to a collection of more than one element
TypeMismatchException - If a bound parameter is not of the expected type.
NameResolutionException - If a name in the query cannot be resolved.
IllegalArgumentException - The number of bound parameters does not match the number of placeholders
IllegalStateException - If the query is not permitted on this type of region
QueryInvocationTargetException

execute

Object execute(Object[] params)
               throws FunctionDomainException,
                      TypeMismatchException,
                      NameResolutionException,
                      QueryInvocationTargetException
Executes this query with the given parameters and returns an object that represent its result. If the query resolves to a primitive type, an instance of the corresponding wrapper type (Integer, etc.) is returned. If the query resolves to more than one object, a SelectResults is returned.

Parameters:
params - Values that are bound to parameters (such as $1) in this query.
Returns:
The object that represents the result of the query. Note that if a query is just a select statement then it will return a result that is an instance of SelectResults. However, since a query is not necessarily just a select statement, the return type of this method is Object. For example, the query (select distinct * from /rgn).size returns an instance of java.lang.Integer.
Throws:
FunctionDomainException - A function was applied to a parameter that is improper for that function. For example, the ELEMENT function was applied to a collection of more than one element
TypeMismatchException - If a bound parameter is not of the expected type.
NameResolutionException - If a name in the query cannot be resolved.
IllegalArgumentException - The number of bound parameters does not match the number of placeholders
IllegalStateException - If the query is not permitted on this type of region
QueryInvocationTargetException

compile

void compile()
             throws TypeMismatchException,
                    NameResolutionException
Compiles this Query to achieve higher performance execution.

Throws:
TypeMismatchException - If the compile-time type of a name, parameter, or expression is not the expected type
QueryInvalidException - The syntax of the query string is not correct
NameResolutionException

isCompiled

boolean isCompiled()
Return whether this query has been compiled into VM bytecodes.

Returns:
true if this query has been compiled into bytecodes

getStatistics

QueryStatistics getStatistics()
Get statistics information for this query.


GemFire 5.7

Copyright © 2002-2008 GemStone Systems, Inc. All Rights Reserved.