com.apama.database
Event Query


Event containing the actions to perform a query on a database.

See initQuery(), initNamedQuery(), setReturnType(), setBatchSize(), makeBacktest(), setStatusCallback(), setEventType(), setBatchDoneCallback(), setSchemaCallback(),setExtraParmas(), start(), stop(), pause() and getNextBatch().

Also see stopFull(), pauseFull() and getNextBatchFull() for a version of the call that accepts the complete set of parameters.
Routes:
com.apama.database.GetNextBatch - 
com.apama.database.PauseQuery - 
com.apama.database.StartQuery - 
com.apama.database.StopQuery - 
Listens:
com.apama.database.BatchDone - 
com.apama.database.QueryDone - 
com.apama.database.QueryStatus - 
com.apama.database.ResultEvent - 
com.apama.database.ResultSchema - 

Constant summary
 stringADBC_NULL := "ADBC_NULL"

Constant for param type ADBC_NULL.
 stringHISTORICAL := "Historical"

Constant for return type Historical.
 stringNATIVE := "Native"

Constant for return type Native.
 stringRESULT_EVENT := "ResultEvent"

Constant for return type ResultEvent.
 stringRESULT_EVENT_HETERO := "ResultEventHetero"

Constant for return type ResultEventHetero.
 
Action summary
 stringgetBatchDoneToken()

Retrieves the token that has been assigned to the batchDone callback action.
Deprecated:
[deprecated as this is an unnecessary method.]
 integergetId()

Returns the mesageId of the query.
 voidgetNextBatch(integer batchSize)

Retrieve the next batch of results.
 voidgetNextBatchFull(float statusFrequency, integer batchSize, boolean batchSizeIncludesTimeEvents, float backtestSpeed, float runUntilTime, dictionary<stringstring> extraParams)

Retrieve the next batch of results.This action allows you to pass in any extra parameters.
 stringgetQueryResultToken()

Retrieves the token that has been assigned to the queryResult callback action.
Deprecated:
[deprecated as this is an unnecessary method.]
 voidinitNamedQuery(com.apama.database.Connection conn, string templateName, dictionary<stringstring> parameters)

Initialize the named query with the template name and template paramteres for this database.
 voidinitPreparedQuery(com.apama.database.PreparedQuery preparedQuery)

Initialize the prepared query with pre-created instance of a prepared query.
 voidinitPreSpawnContext(context preSpawnContext)

Set context that is current prior to spawning.
 voidinitQuery(com.apama.database.Connection conn, string queryString)

Initialize the query with the query string for this database.
 voidmakeBacktest(float backtestSpeed)

Set the query results to be back-testable in the data player.
 voidonBeginRecovery()

OnBeginRecovery is called after all objects and listeners of persistent monitors have been recovered and before queued events are processed.
 voidonConcludeRecovery()

OnConcludeRecovery is called after the recovery process has been completed, including all non persistent monitors having being re-loaded.
 voidpause()

Pause the query.
 voidpauseFull(dictionary<stringstring> extraParams)

Pauses the running query.
 voidreset()

Reset the state of this query.
 voidsetBatchDoneCallback(string token, action<com.apama.database.Querystringintegerfloatstringstring> callback)

Set the callback action to handle batch done notifications.
 voidsetBatchSize(integer batchSize)

Set the Batch Size If the query will return a large number of results.
 voidsetEventType(string eventType)

Set the eventType when it is an event query.
 voidsetExtraParams(dictionary<stringstring> extra)

Additional parameters for the query.
 voidsetInputParams(sequence<string> inputParams)

Set the input parameters for this query. This should be set when using a prepared query.
 voidsetResultEventCallback(string token, action<com.apama.database.Querycom.apama.database.ResultEventstring> callback)

Set the callback action to handle result event notifications.
 voidsetReturnType(string returnType)

Set the return type based using the constants provided.
 voidsetRunUntilTime(float runUntilTime)

The following action has been added for running playback queries.
Deprecated:
[deprecated as this is an unnecessary method.]
 voidsetSchemaCallback(action<sequence<string>, dictionary<stringstring>, sequence<string>> callback)

Set the callback action to handle schema notifications.
 voidsetStatusCallback(float statusFreq, action<integerfloat> callback)

Set the callback action to handle status notifications.
 voidsetTimeColumn(string timeColumn)

If the return type is Native specify the database table column that stores the event's timestamp.
 voidstart(action<com.apama.database.Querystringintegerfloat> callback)

Start the execution of this query, with information passed in using set and init actions.
 booleanstop()

Stops the running query.
 booleanstopFull(dictionary<stringstring> extraParams)

Stops the running query.This action allows you to pass in any extra parameters.
 
Constant detail

ADBC_NULL

string ADBC_NULL := "ADBC_NULL"
Constant for param type ADBC_NULL.

This can be used when you require passing null to the database, for example when using prepared queries and stored procedures, as EPL doesn't support null values.

HISTORICAL

string HISTORICAL := "Historical"
Constant for return type Historical.

This return type is most commonly used for playback.

The Matching event will be 'wrapped' in a container event. The container event will have a name based on that of the event name.

NATIVE

string NATIVE := "Native"
Constant for return type Native.

This return type is also used for playback.

The query needs to specify the event type to be returned and the name of the database table's column that contains the event's time stamp.

RESULT_EVENT

string RESULT_EVENT := "ResultEvent"
Constant for return type ResultEvent.

This return type is used for general database queries.

RESULT_EVENT_HETERO

string RESULT_EVENT_HETERO := "ResultEventHetero"
Constant for return type ResultEventHetero.

This return type is intended for advanced database queries. It is not applicable to SQL databases.
Action detail

getBatchDoneToken

string getBatchDoneToken()
Deprecated:
[deprecated as this is an unnecessary method.]
Retrieves the token that has been assigned to the batchDone callback action.

getId

integer getId()
Returns the mesageId of the query.

getNextBatch

void getNextBatch(integer batchSize)
Retrieve the next batch of results.

The number of which is based on the batchSize, and will result in that amount of results to be sent to the dedicated callback method which was set up using setBatchCallback.
Parameters:
batchSize - The maximum size of a batch.

See also getNextBatchFull.


getNextBatchFull

void getNextBatchFull(float statusFrequency, integer batchSize, boolean batchSizeIncludesTimeEvents, float backtestSpeed, float runUntilTime, dictionary<stringstring> extraParams)
Retrieve the next batch of results.This action allows you to pass in any extra parameters.

The number of which is based on the batchSize, and will result in that amount of results to be sent to the dedicated callback method which was set up using setBatchCallback.
Parameters:
statusFrequency - The frequency of status events.
batchSize - The maximum size of a batch.
batchSizeIncludesTimeEvents - If true the batch size will count &Time events, if false it will not.
backtestSpeed - Speed for back testing: <= 0.0 is as fast as possible, > 0.0 is some multiple of playback speed.
runUntilTime - The time the playback query should run.
extraParams - This is currently a container to allow additional information in the future.
Routes:
com.apama.database.GetNextBatch - 

getQueryResultToken

string getQueryResultToken()
Deprecated:
[deprecated as this is an unnecessary method.]
Retrieves the token that has been assigned to the queryResult callback action.

initNamedQuery

void initNamedQuery(com.apama.database.Connection conn, string templateName, dictionary<stringstring> parameters)
Initialize the named query with the template name and template paramteres for this database.
Parameters:
conn - The database connection.
templateName - The name of the query template.
parameters - Additional named query's parameters.

initPreparedQuery

void initPreparedQuery(com.apama.database.PreparedQuery preparedQuery)
Initialize the prepared query with pre-created instance of a prepared query.
Parameters:
preparedQuery - The prepared query to be initialized from.

initPreSpawnContext

void initPreSpawnContext(context preSpawnContext)
Set context that is current prior to spawning.

Optional: Only needed when using parallel processing.
Parameters:
preSpawnContext - Current context prior to spawning.

initQuery

void initQuery(com.apama.database.Connection conn, string queryString)
Initialize the query with the query string for this database.
Parameters:
conn - The database connection.
queryString - The SQL query string.

makeBacktest

void makeBacktest(float backtestSpeed)
Set the query results to be back-testable in the data player.
Parameters:
backtestSpeed - The playback speed of the events.

onBeginRecovery

void onBeginRecovery()
OnBeginRecovery is called after all objects and listeners of persistent monitors have been recovered and before queued events are processed.

onConcludeRecovery

void onConcludeRecovery()
OnConcludeRecovery is called after the recovery process has been completed, including all non persistent monitors having being re-loaded.

pause

void pause()
Pause the query.

See also PauseQueryFull.

pauseFull

void pauseFull(dictionary<stringstring> extraParams)
Pauses the running query.
Parameters:
extraParams - This is currently a container to allow additional information in the future.
Routes:
com.apama.database.PauseQuery - 

reset

void reset()
Reset the state of this query.

Reset including all listeners and allow another Query to be setup.

setBatchDoneCallback

void setBatchDoneCallback(string token, action<com.apama.database.Querystringintegerfloatstringstring> callback)
Set the callback action to handle batch done notifications.
Parameters:
token - A user-defined string to be passed in that will be returned in the callback action.
callback - User defined action called when the current action completes.
Listens:
com.apama.database.BatchDone - 

setBatchSize

void setBatchSize(integer batchSize)
Set the Batch Size If the query will return a large number of results.

If you set a batchsize, also use the Query event's setBatchDoneCallback action passing in values for the token and callback parameters.
Parameters:
batchSize - The maximum size of a batch.

setEventType

void setEventType(string eventType)
Set the eventType when it is an event query.

This should be set when the returnType is NATIVE. Also in this case you should set the TimeColumn. In addition, you need to add mapping rules to the ADBC adapter's configuration file for the event type being returned.
Parameters:
eventType - The type of this query when working with event queries.

setExtraParams

void setExtraParams(dictionary<stringstring> extra)
Additional parameters for the query.
Parameters:
extra - This is currently a container to allow additional information in the future.

setInputParams

void setInputParams(sequence<string> inputParams)
Set the input parameters for this query. This should be set when using a prepared query.
Parameters:
inputParams - The values to be used for the replaceable parameters.

setResultEventCallback

void setResultEventCallback(string token, action<com.apama.database.Querycom.apama.database.ResultEventstring> callback)
Set the callback action to handle result event notifications.
Parameters:
token - A user-defined string to be passed in that will be returned in the callback action.
callback - User defined action called when the current action completes.
Listens:
com.apama.database.ResultEvent - 

setReturnType

void setReturnType(string returnType)
Set the return type based using the constants provided.
Parameters:
returnType - The return type of this query.

setRunUntilTime

void setRunUntilTime(float runUntilTime)
Deprecated:
[deprecated as this is an unnecessary method.]
The following action has been added for running playback queries.
Parameters:
runUntilTime - The time the playback query should run.

setSchemaCallback

void setSchemaCallback(action<sequence<string>, dictionary<stringstring>, sequence<string>> callback)
Set the callback action to handle schema notifications.
Parameters:
callback - User defined action called when the current action completes.
Listens:
com.apama.database.ResultSchema - 

setStatusCallback

void setStatusCallback(float statusFreq, action<integerfloat> callback)
Set the callback action to handle status notifications.
Parameters:
statusFreq - The frequency of status events.
callback - User defined action called when the current action completes.
Listens:
com.apama.database.QueryStatus - 

setTimeColumn

void setTimeColumn(string timeColumn)
If the return type is Native specify the database table column that stores the event's timestamp.

You also need to add mapping rules for this event type to the ADBC adapter's configuration file.
Parameters:
timeColumn - The name of the database table's column that contains the event's time stamp.

start

void start(action<com.apama.database.Querystringintegerfloat> callback)
Start the execution of this query, with information passed in using set and init actions.
Parameters:
callback - Callback action for when query fully completes.
Routes:
com.apama.database.StartQuery - 
Listens:
com.apama.database.QueryDone - 

stop

boolean stop()
Stops the running query.

Return true.

stopFull

boolean stopFull(dictionary<stringstring> extraParams)
Stops the running query.This action allows you to pass in any extra parameters.

Return true.
Parameters:
extraParams - This is currently a container to allow additional information in the future.
Routes:
com.apama.database.StopQuery -