Apama 10.15.0 | Connecting Apama Applications to External Components | Standard IAF Plug-ins | The Database Connector IAF Adapter (ADBC) | The ADBC Event application programming interface | Creating and deleting store events
 
Creating and deleting store events
If your application will use a prepared statement or a stored procedure in a store action (such as storeData or storeEvent) you need to first create a storeStatement with createStoreStatement action.
The createStoreStatement is defined as:
action createStoreStatement(
string name,
string tableName,
string statementString,
sequence<string> inputTypes,
dictionary<integer,string> inputToNameMap,
dictionary<string,string> extraParams,
action<Connection,string,string> callback)
The arguments for this action are:
*name - The name of the storeStatement instance that will be used in a store action. The name must be unique. Specifying a value for name is optional and if omitted, one will be created in the form Statement_1.
*tableName - The name of the database table where the data will be written when the store action that uses the storeStatment is called.
*statementString - The SQL string that will be used as a template when the store action that uses the storeStatement is called. You can use question mark characters to indicate replaceable parameters in the statement. For example, "insert into myTable(?,?,?) values(?,?,?)".
If you want to use a stored procedure, in the statementString enclose the name of the database's stored procedure in curly brace characters ({ }) and use question mark characters (?) to indicate replaceable parameters. For example, "{call myStoredProcedure(?,?,?)}". Stored procedures used in this way can only take input parameters. The stored procedure must exist in the database.
*inputTypes - Specifies the types that will be used as replaceable parameters in the statementString.
*inputToNameMap - Specifies what data item should be used for each input parameter of the store statement. If storing data it would be the name from the dictionary of data to be stored. If storing events it would be the event field name. When you specify the dictionary, the integer is the position and the string is the data name. For example, you might specify the inputToNameMap parameter as follows:
inputToNameMap :=
{1:"timefield",2:"strfield",3:"intfield",4:"floatfield",5:"boolfield"};
*extraParams - Not required
*callback - The action's callback handler. The definition of the callback action should take the error message as the first string parameter followed by the storeStatement name.
The deleteStoreStatement is defined as:
action deleteStoreStatement(
string statementName,
string tableName,
dictionary<string,string> extraParams,
action<Connection,string,string> callback)