In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
AndoridSQLite database development how to add triggers, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
Add triggers for AndoridSQLite database development
A TRIGGER is an action triggered by an event. These events include INSERT, DELETE, UPDATE, and UPDATE OF. When the database system executes these events, it is activated and triggered to perform the corresponding action. Let's add triggers for the database. The steps are as follows:
(1) Open the database, click the gear button in the lower left corner, select the Create Trigger option, and pop up the Trigger Creator dialog box, as shown in figure 1.23.
Figure 1.23 Trigger Creator dialog box
(2) enter the name of the trigger, such as ScoreTrigger, in the Trigger name: text box. Select the trigger time in the WHEN list box. There are three times, Before, After, and Instead Of. After is selected here. Select the event that triggers the trigger in the Database event list box. There are four kinds of events, INSERT, DELETE, UPDATE, and UPDATE OF. INSERT is selected here. The Table list box sets the table to which triggers are added, such as the Students table. Then write the trigger action in the text field that contains the prompt write your tigger action here, with the following code:
FOR EACH ROWWHEN (Sales) > = 1BEGINupdate Students set Score = Sales * .15
The effect in the add trigger dialog box is shown in figure 1.24.
Figure 1.24 Trigger Creator dialog box
(3) after clicking the Save button, exit the add trigger dialog box. At this point, a trigger named ScoreTrigger is added to the specified database, as shown in figure 1.25.
Figure 1.25 ScoreTrigger trigger
Note: the ScoreTrigger trigger added here will trigger when the data is inserted.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.