com.apama.database
Event Connection


Event containing the actions to perform operations on a database. All operations except query are performed using this event. The Query event is used for queries.

See openDatabase(), closeDatabase(), forceCloseDatabase(), createStoreStatement(), deleteStoreStatement(), storeEvent(), storeData(), setStoreErrorCallback(), commitRequest(), runCommand(), and stopAllQueries().

Also see the "*Full" versions of the above for versions of the calls that accept the complete set of parameters.
Routes:
com.apama.database.CloseDatabase - 
com.apama.database.Command - 
com.apama.database.CommitRequest - 
com.apama.database.CreateStoreStatement - 
com.apama.database.DeleteStoreStatement - 
com.apama.database.OpenDatabase - 
com.apama.database.RollbackRequest - 
com.apama.database.StopAllQueries - 
com.apama.database.StoreData - 
com.apama.database.StoreEvent - 
Listens:
com.apama.database.CommandAck - 
com.apama.database.CommitAck - 
com.apama.database.DatabaseOperationAck - 
com.apama.database.RollbackAck - 
com.apama.database.StopAllQueriesAck - 
com.apama.database.StoreOperationAck - 
com.apama.database.StoreOperationError - 
com.apama.database.StoreStatementAck - 

Constant summary
 stringNOT_SET := "ADBC_NULL"

Constant for param of open database actions.
 
Action summary
 voidcloseDatabase(action<com.apama.database.Connectionstring> callback)

Closes a connection to the database.
 voidcloseDatabaseFull(boolean force, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstring> callback)

Close a connection to the database. This action allows you to pass in any extra parameters.
 integercommitRequest(action<com.apama.database.Connectionintegerstringstring> callback)

Send a commit request to the database.
 integercommitRequestFull(string token, dictionary<stringstring> extraParams, action<com.apama.database.Connectionintegerstringstring> callback)

Send a commit request to the database. This action allows you to pass in any extra parameters. This will result in anything outstanding being committed to the database.
 voidcreateStoreStatement(string name, string tableName, string statementString, sequence<string> inputTypes, dictionary<integerstring> inputToNameMap, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstringstring> callback)

If your application will use a prepared statement or a stored procedure then you need to first create a store statement on a relational database for the specified table.
 voiddeleteStoreStatement(string statementName, string tableName, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstringstring> callback)

Remove the store statment from the system for this table.
 voidforceCloseDatabase(action<com.apama.database.Connectionstring> callback)

Closes a connection to the database, even if there are any Queries or commands still in progress.
 stringgetDatabaseURL()

Returns the URL of the open database.
 integergetDbId()

Returns the Id of the open database.
 stringgetServiceId()

Returns the service Id of the open database.
 voidinitPreSpawnContext(context preSpawnContext)

Set context that is current prior to spawning.
 voidonConcludeRecovery()

OnConcludeRecovery is called after the recovery process has been completed, including all non persistent monitors having being re-loaded.
 voidopenDatabase(string serviceId, string databaseURL, string user, string password, string autoCommit, action<com.apama.database.Connectionstring> callback)

Opens the connection to a database.
 voidopenDatabaseFull(string serviceId, string databaseURL, string user, string password, string autoCommit, boolean readOnly, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstring> callback)

Open a connection to a database. This action allows you to pass in any extra parameters.
 voidopenDatabaseShared(string serviceId, string databaseURL, string user, string password, string autoCommit, boolean readOnly, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstring> callback)

Open a shared connection to a database.
 voidreopenWithACK(action<com.apama.database.Connectionstring> callback)

Reopen the connection to a database.
 voidreset()

Reset the state of the connection.
 integerrollbackRequest(action<com.apama.database.Connectionintegerstringstring> callback)

Rollback uncommitted changes to database.
 integerrollbackRequestFull(string token, dictionary<stringstring> extraParams, action<com.apama.database.Connectionintegerstringstring> callback)

Rollback uncommitted changes to database. This action allows you to pass in any extra parameters.
 voidrunCommand(string commandString, string token, action<com.apama.database.Connectionstringstring> callback)

Run the supplied command against the database.
 voidrunCommandFull(string commandString, string token, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstringstring> callback)

Run the supplied command against the database. This action allows you to pass in any extra parameters.
 voidsetStoreErrorCallback(action<com.apama.database.Connectionintegerintegerstring> callback)

To specify an action to be used when an error is reported.
 voidstopAllQueries(action<com.apama.database.Connectionstring> callback)

Stop all queries that are currently running.
 voidstopAllQueriesFull(dictionary<stringstring> extraParams, action<com.apama.database.Connectionstring> callback)

Stop all Queries that are currently running. This action allows you to pass in any extra parameters.
 integerstoreData(string tableName, string statementName, dictionary<stringstring> fields, dictionary<stringstring> extraParams)

Store the data contained in the fields dictionary without an acknowledgement.
 voidstoreDataWithAck(string tableName, string statementName, dictionary<stringstring> fields, string token, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstringstring> callback)

Store the data contained in the fields dictionary with an acknowledgement.
 integerstoreDataWithAckId(string tableName, string statementName, dictionary<stringstring> fields, string token, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstringstring> callback)

Store the data contained in the fields dictionary with an acknowledgement.
 integerstoreEvent(float timestamp, string eventString, string tableName, string statementName, string timeColumn, dictionary<stringstring> extraParams)

Store the event contained in the event Data without an acknowledgement.
 voidstoreEventWithAck(float timestamp, string eventString, string tableName, string statementName, string timeColumn, string token, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstringstring> callback)

Store the event contained in the event Data with an acknowledgement.
 
Constant detail

NOT_SET

string NOT_SET := "ADBC_NULL"
Constant for param of open database actions.

This is used when you wish to leave username/password parameters empty, for example when passing this information via the url.
Action detail

closeDatabase

void closeDatabase(action<com.apama.database.Connectionstring> callback)
Closes a connection to the database.
Parameters:
callback - User defined action called when the current action completes.

See closeDatabaseFull


closeDatabaseFull

void closeDatabaseFull(boolean force, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstring> callback)
Close a connection to the database. This action allows you to pass in any extra parameters.

If shared connections are used then the database will only be closed if it is the last connection to that database.
Parameters:
force - If true will stop any running queries and commands.
extraParams - This is currently a container to allow additional information in the future.
callback - User defined action called when the current action completes.
Routes:
com.apama.database.CloseDatabase - 
Listens:
com.apama.database.DatabaseOperationAck - 

commitRequest

integer commitRequest(action<com.apama.database.Connectionintegerstringstring> callback)
Send a commit request to the database.
Parameters:
callback - User defined action called when the current action completes.

returns the messageId of the commitRequest.

See also commitRequestFull.


commitRequestFull

integer commitRequestFull(string token, dictionary<stringstring> extraParams, action<com.apama.database.Connectionintegerstringstring> callback)
Send a commit request to the database. This action allows you to pass in any extra parameters. This will result in anything outstanding being committed to the database.
Parameters:
token - A user-defined string to be passed in that will be returned in the callback action.
extraParams - This is currently a container to allow additional information in the future.
callback - User defined action called when the current action completes.

returns the messageId of the commitRequest.

Routes:
com.apama.database.CommitRequest - 
Listens:
com.apama.database.CommitAck - 

createStoreStatement

void createStoreStatement(string name, string tableName, string statementString, sequence<string> inputTypes, dictionary<integerstring> inputToNameMap, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstringstring> callback)
If your application will use a prepared statement or a stored procedure then you need to first create a store statement on a relational database for the specified table.

This can then be reused, based on the statement name returned in the storeStatementAck. You must list the correct values for the inputTypes in relation to the inputToNameMap.
Parameters:
name - The name of the storeStatement.
tableName
statementString - The statement to be created.
inputTypes - The input types for the statement.
inputToNameMap - The mapping between an identifier and the field names.
extraParams - This is currently a container to allow additional information in the future.
callback - User defined action called when the current action completes.
Routes:
com.apama.database.CreateStoreStatement - 
Listens:
com.apama.database.StoreStatementAck - 

deleteStoreStatement

void deleteStoreStatement(string statementName, string tableName, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstringstring> callback)
Remove the store statment from the system for this table.
Parameters:
statementName
tableName
extraParams - This is currently a container to allow additional information in the future.
callback - User defined action called when the current action completes.
Routes:
com.apama.database.DeleteStoreStatement - 
Listens:
com.apama.database.StoreStatementAck - 

forceCloseDatabase

void forceCloseDatabase(action<com.apama.database.Connectionstring> callback)
Closes a connection to the database, even if there are any Queries or commands still in progress.
Parameters:
callback - User defined action called when the current action completes.

See closeDatabaseFull


getDatabaseURL

string getDatabaseURL()
Returns the URL of the open database.

getDbId

integer getDbId()
Returns the Id of the open database.

getServiceId

string getServiceId()
Returns the service Id of the open database.

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.

onConcludeRecovery

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

openDatabase

void openDatabase(string serviceId, string databaseURL, string user, string password, string autoCommit, action<com.apama.database.Connectionstring> callback)
Opens the connection to a database.
Parameters:
serviceId - The serviceId the database is on.
databaseURL - The location of the database.
user - The user Id for the database (if required). If you wish to set the username on the URL, you must set this parameter to the special value of Connection.NOT_SET
password - The password to the database (if required). If you wish to set the username on the URL, you must set this parameter to the special value of Connection.NOT_SET
autoCommit - Auto-commit mode.
 Requires (case insensitive values): default - Use setting from config file.
false - Disable auto-commit.
x.x - Value (seconds) for ADBC adapter timed auto-commit.
true - Enable data source specific auto-commit.
callback - User defined action called when the current action completes.

See OpenDatabaseFull.


openDatabaseFull

void openDatabaseFull(string serviceId, string databaseURL, string user, string password, string autoCommit, boolean readOnly, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstring> callback)
Open a connection to a database. This action allows you to pass in any extra parameters.
Parameters:
serviceId - The serviceId the database is on.
databaseURL - The location of the database.
user - The user Id for the database (if required). If you wish to set the username on the URL, you must set this parameter to the special value of Connection.NOT_SET
password - The password to the database (if required). If you wish to set the password on the URL, you must set this parameter to the special value of Connection.NOT_SET
autoCommit - Auto-commit mode: (case insensitive values).
 default - Use setting from config file.
false - Disable auto-commit.
x.x - Value (seconds) for ADBC adapter timed auto-commit.
true - Enable data source specific auto-commit.
readOnly - Specifies if the connection should be read-only.
extraParams - Any additional settings.
callback - User defined action called when the current action completes.
Routes:
com.apama.database.OpenDatabase - 
Listens:
com.apama.database.DatabaseOperationAck - 

openDatabaseShared

void openDatabaseShared(string serviceId, string databaseURL, string user, string password, string autoCommit, boolean readOnly, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstring> callback)
Open a shared connection to a database.

If a connection is already open then this will reuse that, if one is not already open then it will open one.
Parameters:
serviceId - The serviceId the database is on.
databaseURL - The location of the database.
user - The user Id for the database (if required). If you wish to set the username on the URL, you must set this parameter to the special value of Connection.NOT_SET
password - The password to the database (if required). If you wish to set the username on the URL, you must set this parameter to the special value of Connection.NOT_SET
autoCommit - Auto-commit mode: (case insensitive values).
 default - Use setting from config file.
false - Disable auto-commit.
x.x - Value (seconds) for ADBC adapter timed auto-commit.
true - Enable data source specific auto-commit.
readOnly - Specifies if the connection should be read-only.
extraParams - Any additional settings.
callback - User defined action called when the current action completes.

reopenWithACK

void reopenWithACK(action<com.apama.database.Connectionstring> callback)
Reopen the connection to a database.

This method should be used when reusing a connection, for example to reconnect after the IAF adapter goes down.

The callback method will be called on completion and will be able to determine if it was successful or if there were any errors.
Parameters:
callback - User defined action called when the current action completes.

reset

void reset()
Reset the state of the connection.

Reset including all listeners and allow another connection to be opened.

rollbackRequest

integer rollbackRequest(action<com.apama.database.Connectionintegerstringstring> callback)
Rollback uncommitted changes to database.
Parameters:
callback - User defined action called when the current action completes.

returns the messageId of the rollbackRequest.

See also rollbackRequestFull


rollbackRequestFull

integer rollbackRequestFull(string token, dictionary<stringstring> extraParams, action<com.apama.database.Connectionintegerstringstring> callback)
Rollback uncommitted changes to database. This action allows you to pass in any extra parameters.
Parameters:
token - A user-defined string to be passed in that will be returned in the callback action.
extraParams - This is currently a container to allow additional information in the future.
callback - User defined action called when the current action completes.

returns the messageId of the rollbackRequest.

Routes:
com.apama.database.RollbackRequest - 
Listens:
com.apama.database.RollbackAck - 

runCommand

void runCommand(string commandString, string token, action<com.apama.database.Connectionstringstring> callback)
Run the supplied command against the database.
Parameters:
commandString - The SQL command to execute.
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.

See also runCommandFull.


runCommandFull

void runCommandFull(string commandString, string token, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstringstring> callback)
Run the supplied command against the database. This action allows you to pass in any extra parameters.
Parameters:
commandString - The SQL command to execute.
token - A user-defined string to be passed in that will be returned in the callback action.
extraParams - Currently a container to allow additional information in the future.
callback - User defined action called when the current action completes.
Routes:
com.apama.database.Command - 
Listens:
com.apama.database.CommandAck - 

setStoreErrorCallback

void setStoreErrorCallback(action<com.apama.database.Connectionintegerintegerstring> callback)
To specify an action to be used when an error is reported.
Parameters:
callback - User defined action called when the current action completes.
Listens:
com.apama.database.StoreOperationError - 

stopAllQueries

void stopAllQueries(action<com.apama.database.Connectionstring> callback)
Stop all queries that are currently running.
Parameters:
callback - User defined action called when the current action completes.

See also stopAllQueriesFull.


stopAllQueriesFull

void stopAllQueriesFull(dictionary<stringstring> extraParams, action<com.apama.database.Connectionstring> callback)
Stop all Queries that are currently running. This action allows you to pass in any extra parameters.
Parameters:
extraParams - This is currently a container to allow additional information in the future.
callback - User defined action called when the current action completes.
Routes:
com.apama.database.StopAllQueries - 
Listens:
com.apama.database.StopAllQueriesAck - 

storeData

integer storeData(string tableName, string statementName, dictionary<stringstring> fields, dictionary<stringstring> extraParams)
Store the data contained in the fields dictionary without an acknowledgement.

The acknowledge field is set to false indicating a StoreOperationAck should not be sent
Parameters:
tableName - The table to store the data in.
statementName - A storeStatement that was previously created that references a prepared statement or stored procedure.
fields - The column values to be stored.
extraParams - Any additional settings.

returns the messageId of the storeData event.

Routes:
com.apama.database.StoreData - 

storeDataWithAck

void storeDataWithAck(string tableName, string statementName, dictionary<stringstring> fields, string token, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstringstring> callback)
Store the data contained in the fields dictionary with an acknowledgement.

The acknowledge field is set to true indicating a StoreOperationAck should be sent, therefore any errors will be returned in the errorMessage.
Parameters:
tableName - The table to store the data in.
statementName - A storeStatement that was previously created that references a prepared statement or stored procedure.
fields - The column values to be stored.
token - A user-defined string to be passed in that will be returned in the callback action.
extraParams - Any additional settings.
callback - User defined action called when the current action completes.
Routes:
com.apama.database.StoreData - 
Listens:
com.apama.database.StoreOperationAck - 

storeDataWithAckId

integer storeDataWithAckId(string tableName, string statementName, dictionary<stringstring> fields, string token, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstringstring> callback)
Store the data contained in the fields dictionary with an acknowledgement.

The acknowledge field is set to true indicating a StoreOperationAck should be sent, therefore any errors will be returned in the errorMessage. This action also returns the messageId of the StoreData event.
Parameters:
tableName - The table to store the data in.
statementName - A storeStatement that was previously created that references a prepared statement or stored procedure.
fields - The column values to be stored.
token - A user-defined string to be passed in that will be returned in the callback action.
extraParams - Any additional settings.
callback - User defined action called when the current action completes.

returns the messageId of the storeData event.

Routes:
com.apama.database.StoreData - 
Listens:
com.apama.database.StoreOperationAck - 

storeEvent

integer storeEvent(float timestamp, string eventString, string tableName, string statementName, string timeColumn, dictionary<stringstring> extraParams)
Store the event contained in the event Data without an acknowledgement.

The acknowledge field is set to false indicating a StoreOperationAck should not be sent.
Parameters:
timestamp - The timestamp of the event.
eventString - The event to store.
tableName - The table to store the event in.
statementName - A storeStatement that was previously created that references a prepared statement or stored procedure.
timeColumn - The column in the database where you want the event timestamp to be stored.
extraParams - Any additional settings.

returns the messageId of the store event.

Routes:
com.apama.database.StoreEvent - 

storeEventWithAck

void storeEventWithAck(float timestamp, string eventString, string tableName, string statementName, string timeColumn, string token, dictionary<stringstring> extraParams, action<com.apama.database.Connectionstringstring> callback)
Store the event contained in the event Data with an acknowledgement.

The acknowledge field is set to true indicating a StoreOperationAck should be sent, therefore any errors will be returned in the errorMessage.
Parameters:
timestamp - The timestamp of the event.
eventString - The event to store.
tableName - The table to store the event in.
statementName - A storeStatement that was previously created that references a prepared statement or stored procedure.
timeColumn - The column in the database where you want the event timestamp to be stored.
token
extraParams - Any additional settings.
callback - User defined action called when the current action completes.
Routes:
com.apama.database.StoreEvent - 
Listens:
com.apama.database.StoreOperationAck -