deleteDataViewItems
Syntax
deleteDataViewItems(engine, keys)
Details
Deletes the data with the specified keys from a data view engine. If the key column specified in keys does not exist, an error will be raised during deletion.
The deleteDataViewItems functions can be called within a CEP engine
context or outside of it.
-
Within a CEP engine: The system will first attempt to locate a data view engine handle with specified engine within the current CEP engine context. If a matching engine is found, the corresponding delete operation will be performed. If no such engine, the system will then search for a data view engine with the same handle outside of the CEP engine context.
-
Outside a CEP engine: The system will search for and perform corresponding operation on a data view engine handle with specified engine only from the context outside of any CEP engine.
Parameters
engine is the handle of a data view engine.
keys is a scalar, vector, or tuple, indicating the key(s) to be removed. If the key is composite, a tuple should be provided, where each element represents a column that forms the key, and the order must be consistent with the order specified in keyedColumns in the engine.
Returns
None.
Examples
class Monitor1:CEPMonitor{
def addNewData(order)
def deleteData(s)
def Monitor1(){
}
def onload(){
addEventListener(addNewData,"Orders",,"all")
addEventListener(deleteData,"Drop",,"all")
try{
share(streamTable(1:0,`eventTime`sym`val0`val1`val2,[TIMESTAMP,SYMBOL,INT,FLOAT,DOUBLE]),'test_DV')
createDataViewEngine("test_DV",objByName('test_DV'),`sym,`eventTime,false)
}catch(ex){}
}
def unload(){
undef(`test_DV,SHARED)
}
def addNewData(order){
getDataViewEngine('test_DV').append!(table([order.eventTime] as eventTime,[order.sym] as sym,[order.val1] as v1,[order.val2] as v2,[00i] as v3,[00i] as v4,[00i] as v5))
}
def deleteData(s){
deleteDataViewItems('test_DV',s.sym)
}
}
class Orders{
eventTime :: TIMESTAMP
sym :: STRING
val0 :: INT
val1 :: FLOAT
val2 :: DOUBLE
def Orders(s,v0,v1,v2){
sym = s
val0 = v0
val1 = v1
val2 = v2
eventTime = now()
}
}
class Drop{
sym :: STRING
eventTime :: TIMESTAMP
def Drop(s){
sym = s
eventTime = now()
}
}
dummy = table(array(TIMESTAMP, 0) as eventTime, array(STRING, 0) as eventType, array(BLOB, 0) as blobs)
try{dropStreamEngine("test_CEP")}catch(ex){}
engine=createCEPEngine("test_CEP",<Monitor1()>,dummy,[Orders,Drop],,'eventTime',,,"sym")
share streamTable(array(TIMESTAMP, 0) as eventTime, array(STRING, 0) as eventType, array(BLOB, 0) as blobs) as input
try{dropStreamEngine(`serInput)}catch(ex){}
serializer = streamEventSerializer(name=`serInput, eventSchema=Orders, outputTable=input, eventTimeField = "eventTime")
subscribeTable(,`input, `subopt1, 0,getStreamEngine('test_CEP'),true)
appendEvent(`serInput,Orders(`a1,1,1.0,2.0))
Related functions: createCEPEngine, createDataViewEngine, dropDataViewEngine, getDataViewEngine
