VMware Tanzu GemFire Native C++ Reference 10.2.7
apache::geode::client::Query Class Referenceabstract

A Query is obtained from a QueryService which in turn is obtained from the Cache. More...

#include <Query.hpp>

Public Member Functions

virtual void compile ()=0
 Compile the Query - client side query compilation is not supported. More...
 
virtual std::shared_ptr< SelectResultsexecute (std::chrono::milliseconds timeout=DEFAULT_QUERY_RESPONSE_TIMEOUT)=0
 Executes the OQL Query on the cache server and returns the results. More...
 
virtual std::shared_ptr< SelectResultsexecute (std::shared_ptr< CacheableVector > paramList, std::chrono::milliseconds timeout=DEFAULT_QUERY_RESPONSE_TIMEOUT)=0
 Executes the parameterized OQL Query on the cache server and returns the results. More...
 
virtual const std::string & getQueryString () const =0
 Get the query string provided when a new Query was created from a QueryService. More...
 
virtual bool isCompiled ()=0
 Check whether the Query is compiled - client side query compilation is not supported. More...
 

Detailed Description

A Query is obtained from a QueryService which in turn is obtained from the Cache.

This can be executed to return SelectResults which can be either a ResultSet or a StructSet.

This class is intentionally not thread-safe. So multiple threads should not operate on the same Query object concurrently rather should have their own Query objects.

Member Function Documentation

◆ compile()

virtual void apache::geode::client::Query::compile ( )
pure virtual

Compile the Query - client side query compilation is not supported.

Exceptions
UnsupportedOperationExceptionbecause this is not currently supported.

◆ execute() [1/2]

virtual std::shared_ptr< SelectResults > apache::geode::client::Query::execute ( std::chrono::milliseconds  timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT)
pure virtual

Executes the OQL Query on the cache server and returns the results.

Parameters
timeoutThe time to wait for query response, optional.
Exceptions
IllegalArgumentExceptionIf timeout exceeds 2147483647ms.
QueryExceptionif some query error occurred at the server.
IllegalStateExceptionif some error occurred.
NotConnectedExceptionif no java cache server is available. For pools configured with locators, if no locators are available, the cause of NotConnectedException is set to NoAvailableLocatorsException.
Returns
A smart pointer to the SelectResults which can either be a ResultSet or a StructSet.

◆ execute() [2/2]

virtual std::shared_ptr< SelectResults > apache::geode::client::Query::execute ( std::shared_ptr< CacheableVector paramList,
std::chrono::milliseconds  timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT 
)
pure virtual

Executes the parameterized OQL Query on the cache server and returns the results.

Parameters
paramListThe query parameters list
timeoutThe time to wait for query response, optional.
Exceptions
IllegalArgumentExceptionIf timeout exceeds 2147483647ms.
QueryExceptionif some query error occurred at the server.
IllegalStateExceptionif some error occurred.
NotConnectedExceptionif no java cache server is available. For pools configured with locators, if no locators are available, the cause of NotConnectedException is set to NoAvailableLocatorsException. returns A smart pointer to the SelectResults which can either be a ResultSet or a StructSet.

◆ getQueryString()

virtual const std::string & apache::geode::client::Query::getQueryString ( ) const
pure virtual

Get the query string provided when a new Query was created from a QueryService.

Returns
The query string.

◆ isCompiled()

virtual bool apache::geode::client::Query::isCompiled ( )
pure virtual

Check whether the Query is compiled - client side query compilation is not supported.

Exceptions
UnsupportedOperationExceptionbecause this is not currently supported.

Apache Geode C++ Cache API Documentation