The following shows the SQL syntax of registering a trigger.

CREATE TRIGGER <TRIGGER-NAME&gt;
(BEFORE | AFTER) INSERT ON <FULL-PATH&gt; AS <CLASSNAME&gt; WITH (   
<KEY-1&gt;=<VALUE-1&gt;,    <KEY-2&gt;=<VALUE-2&gt;,    ... )TRIGGER-NAME is a 
globally unique ID of the trigger, which is case sensitive. At present, the 
trigger can listen to all data insertion operations on the time series. The 
hook can be called BEFORE or AFTER the data is inserted. FULL-PATH can be a 
time-series (measurement) path such as root.sg1.d1.s1, a device path such as 
root.sg1.d1, a storage group path such as root.sg1, or even a non-measurement 
path with business semantic such as root.sg1.x. CLASSNAME is the full class 
name of the trigger. Note 
CLASSNAME, KEY and VALUE in the attributes need to be quoted in single or 
double quotes.

Only one trigger can be registered per full-path.

When multiple prefix paths of a path are registered with triggers, for example, 
trigger trigger-sg1d1s1 is registed on root.sg1.d1, trigger trigger-sg1d1 is 
registed on root.sg1.d1, and trigger trigger-sg1 is registed on root.sg1. When 
inserting data to root.sg1.d1.s1, triggers will be triggered in the following 
order: trigger-sg1d1s1 -&gt; trigger-sg1d1 -&gt; trigger-sg1.

Best,
------------------------------------
gongning

Reply via email to