Pivotal GemFire Native Client Cache Reference  9.0.6
gemfire::CqQuery Class Referenceabstract

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

Inherits gemfire::SharedBase.

Public Member Functions

virtual void close ()=0
 Close the CQ and stop execution. More...
 
virtual void execute ()=0
 Executes the OQL Query on the cache server and returns the results. More...
 
virtual CqResultsPtr executeWithInitialResults (uint32_t timeout=DEFAULT_QUERY_RESPONSE_TIMEOUT)=0
 Start executing the CQ or if this CQ is stopped earlier, resumes execution of the CQ. More...
 
virtual const CqAttributesPtr getCqAttributes () const =0
 Get the Attributes of this CQ. More...
 
virtual const CqAttributesMutatorPtr getCqAttributesMutator () const =0
 Get the AttributesMutator of this CQ. More...
 
virtual const char * getName () const =0
 Get the name of the CQ. More...
 
virtual QueryPtr getQuery () const =0
 Get teh query object generated for this CQs query. More...
 
virtual const char * getQueryString () const =0
 Get the query string provided when a new Query was created from a QueryService. More...
 
virtual CqState::StateType getState ()=0
 Get the state of the CQ in CqState object form. More...
 
virtual const CqStatisticsPtr getStatistics () const =0
 Get the statistics information of this CQ. More...
 
virtual bool isClosed ()=0
 This allows to check if the CQ is closed. More...
 
virtual bool isDurable ()=0
 This allows to check if the CQ is durable. More...
 
virtual bool isRunning ()=0
 This allows to check if the CQ is in running or active. More...
 
virtual bool isStopped ()=0
 This allows to check if the CQ is in stopped. More...
 
void preserveSB () const
 Atomically increment reference count. More...
 
int32_t refCount ()
 
void releaseSB () const
 Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero. More...
 
virtual void stop ()=0
 Stops this CqQuery without releasing resources. 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, 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

virtual void gemfire::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.
virtual void gemfire::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.
virtual CqResultsPtr gemfire::CqQuery::executeWithInitialResults ( uint32_t  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 (in seconds) to wait for query response, optional. This should be less than or equal to 2^31/1000 i.e. 2147483.
Exceptions
IllegalArgumentExceptionif timeout parameter is greater than 2^31/1000.
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.
virtual const CqAttributesPtr gemfire::CqQuery::getCqAttributes ( ) const
pure virtual

Get the Attributes of this CQ.

Returns
CqAttributes, the CqAttributes object.
virtual const CqAttributesMutatorPtr gemfire::CqQuery::getCqAttributesMutator ( ) const
pure virtual

Get the AttributesMutator of this CQ.

Returns
CqAttributesMutator, the CqAttributesMutator object.
virtual const char* gemfire::CqQuery::getName ( ) const
pure virtual

Get the name of the CQ.

Returns
the name of the CQ.
virtual QueryPtr gemfire::CqQuery::getQuery ( ) const
pure virtual

Get teh query object generated for this CQs query.

Returns
Query object fort he query string
virtual const char* gemfire::CqQuery::getQueryString ( ) const
pure virtual

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

Returns
The query string.
virtual CqState::StateType gemfire::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.
virtual const CqStatisticsPtr gemfire::CqQuery::getStatistics ( ) const
pure virtual

Get the statistics information of this CQ.

Returns
CqStatistics, the CqStatistics object.
virtual bool gemfire::CqQuery::isClosed ( )
pure virtual

This allows to check if the CQ is closed.

Returns
boolean true if closed, false otherwise
virtual bool gemfire::CqQuery::isDurable ( )
pure virtual

This allows to check if the CQ is durable.

Returns
boolean true if durable, false otherwise
Since
5.5
virtual bool gemfire::CqQuery::isRunning ( )
pure virtual

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

Returns
boolean true if running, false otherwise
virtual bool gemfire::CqQuery::isStopped ( )
pure virtual

This allows to check if the CQ is in stopped.

Returns
boolean true if stopped, false otherwise
void gemfire::SharedBase::preserveSB ( ) const
inherited

Atomically increment reference count.

int32_t gemfire::SharedBase::refCount ( )
inlineinherited
Returns
the reference count
void gemfire::SharedBase::releaseSB ( ) const
inherited

Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero.

virtual void gemfire::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.

GemFire C++ Cache API Documentation