VMware VMware GemFire Native C++ Reference 10.4.3
Loading...
Searching...
No Matches
apache::geode::client::CqQuery Class Referenceabstract

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

#include <CqQuery.hpp>

Public Member Functions

virtual void close ()=0
 Close the CQ and stop execution.
 
virtual void execute ()=0
 Executes the OQL Query on the cache server and returns the results.
 
virtual std::shared_ptr< CqResultsexecuteWithInitialResults (std::chrono::milliseconds timeout=DEFAULT_QUERY_RESPONSE_TIMEOUT)=0
 Start executing the CQ or if this CQ is stopped earlier, resumes execution of the CQ.
 
virtual std::shared_ptr< CqAttributesgetCqAttributes () const =0
 Get the Attributes of this CQ.
 
virtual CqAttributesMutator getCqAttributesMutator () const =0
 Get the AttributesMutator of this CQ.
 
virtual const std::string & getName () const =0
 Get the name of the CQ.
 
virtual std::shared_ptr< QuerygetQuery () const =0
 Get the query object generated for this CQs query.
 
virtual const std::string & getQueryString () const =0
 Get the query string provided when a new Query was created from a QueryService.
 
virtual CqState getState ()=0
 Get the state of the CQ in CqState object form.
 
virtual std::shared_ptr< CqStatisticsgetStatistics () const =0
 Get the statistics information of this CQ.
 
virtual bool isClosed () const =0
 This allows to check if the CQ is closed.
 
virtual bool isDurable () const =0
 This allows to check if the CQ is durable.
 
virtual bool isRunning () const =0
 This allows to check if the CQ is in running or active.
 
virtual bool isStopped () const =0
 This allows to check if the CQ is in stopped.
 
virtual void stop ()=0
 Stops this CqQuery without releasing resources.
 

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, or it can be just registered on the java server without returning results immediately rather only the incremental results.

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

Member Function Documentation

◆ close()

virtual void apache::geode::client::CqQuery::close ( )
pure virtual

Close the CQ and stop execution.

Releases the resources associated with this CqQuery.

Exceptions
CqClosedExceptionFurther calls on this CqQuery instance except for getState() or getName().
CqException- if failure during cleanup of CQ resources.

◆ execute()

virtual void apache::geode::client::CqQuery::execute ( )
pure virtual

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

Exceptions
RegionNotFoundExceptionif the specified region in the query string is not found.
CqClosedExceptionif this CqQuery is closed.
CqExceptionif 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.

◆ executeWithInitialResults()

virtual std::shared_ptr< CqResults > apache::geode::client::CqQuery::executeWithInitialResults ( std::chrono::milliseconds  timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT)
pure virtual

Start executing the CQ or if this CQ is stopped earlier, resumes execution of the CQ.

Get the resultset associated with CQ query. The CQ is executed on primary and redundant servers, if CQ execution fails on all the server then a CqException is thrown.

Parameters
timeoutThe time to wait for query response, optional.
Exceptions
IllegalArgumentExceptionIf timeout exceeds 2147483647ms.
CqClosedExceptionif this CqQuery is closed.
RegionNotFoundExceptionif the specified region in the query string is not found.
IllegalStateExceptionif the CqQuery is in the RUNNING state already.
CqExceptionif failed to execute and get initial results.
Returns
CqResults resultset obtained by executing the query.

◆ getCqAttributes()

virtual std::shared_ptr< CqAttributes > apache::geode::client::CqQuery::getCqAttributes ( ) const
pure virtual

Get the Attributes of this CQ.

Returns
CqAttributes, the CqAttributes object.

◆ getCqAttributesMutator()

virtual CqAttributesMutator apache::geode::client::CqQuery::getCqAttributesMutator ( ) const
pure virtual

Get the AttributesMutator of this CQ.

Returns
CqAttributesMutator, the CqAttributesMutator object.

◆ getName()

virtual const std::string & apache::geode::client::CqQuery::getName ( ) const
pure virtual

Get the name of the CQ.

Returns
the name of the CQ.

◆ getQuery()

virtual std::shared_ptr< Query > apache::geode::client::CqQuery::getQuery ( ) const
pure virtual

Get the query object generated for this CQs query.

Returns
Query object for the query string

◆ getQueryString()

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

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

Returns
The query string.

◆ getState()

virtual CqState apache::geode::client::CqQuery::getState ( )
pure virtual

Get the state of the CQ in CqState object form.

CqState supports methods like isClosed(), isRunning(), isStopped().

See also
CqState
Returns
CqState state object of the CQ.

◆ getStatistics()

virtual std::shared_ptr< CqStatistics > apache::geode::client::CqQuery::getStatistics ( ) const
pure virtual

Get the statistics information of this CQ.

Returns
CqStatistics, the CqStatistics object.

◆ isClosed()

virtual bool apache::geode::client::CqQuery::isClosed ( ) const
pure virtual

This allows to check if the CQ is closed.

Returns
boolean true if closed, false otherwise

◆ isDurable()

virtual bool apache::geode::client::CqQuery::isDurable ( ) const
pure virtual

This allows to check if the CQ is durable.

Returns
boolean true if durable, false otherwise
Since
5.5

◆ isRunning()

virtual bool apache::geode::client::CqQuery::isRunning ( ) const
pure virtual

This allows to check if the CQ is in running or active.

Returns
boolean true if running, false otherwise

◆ isStopped()

virtual bool apache::geode::client::CqQuery::isStopped ( ) const
pure virtual

This allows to check if the CQ is in stopped.

Returns
boolean true if stopped, false otherwise

◆ stop()

virtual void apache::geode::client::CqQuery::stop ( )
pure virtual

Stops this CqQuery without releasing resources.

Puts the CqQuery into the STOPPED state. Can be resumed by calling execute or executeWithInitialResults.

Exceptions
IllegalStateExceptionif the CqQuery is in the STOPPED state already.
CqClosedExceptionif the CQ is CLOSED.

Apache Geode C++ Cache API Documentation