Editor's Note: This subsection has been added both for the benefitof those models that distinguish events from operations, requests, or messages,and to provide a place to describe how other models handle "events".
In SQL, a trigger is a named database construct that is implicitlyactivated whenever a triggering event occurs. When a trigger is activated,the specified action is executed if the specified condition is satisfied.An example is:
CREATE TRIGGER update_balance BEFORE INSERT ON account_history /* event */ REFERENCING NEW AS ta FOR EACH ROW WHEN (ta.TA_type = 'W") /* condition */ UPDATE accounts /* action */ SET balance = balance - ta.amount WHERE account_# = ta.account_#;
Triggers can be used for a number of purposes, such as validating inputdata, reading from other tables for cross-referencing purposes, or supportingalerts (e.g., through electronic mail messages). Triggering events includeinsertion, deletion, and update of tables and columns. A condition canbe any SQL condition (including those that involve complex queries), andan action can be any SQL statement (including compound statements, andthose that invoke SQL routines). The trigger can also specify whether thetrigger should be activated BEFORE the triggering SQL operation is performed,or AFTER. The condition and action can refer to both old and new valuesof rows affected by the SQL statement. The trigger condition and actioncan be executed FOR EACH ROW affected by the triggering statement, or onlyonce for the whole triggering statement (FOR EACH STATEMENT).
No specific mechanisms for handling events are built into the Smalltalklanguage, but "event handling" logic is commonly implementedin Smalltalk applications through its normal messaging techniques.
OLE Component Object Model
OLE handles event notifications through an object called an advisesink--that is, an object that absorbs notifications from a source.The advise sink not only handles notifications for data changes, but italso is generally used to detect changes in another compound document object,such as when it is saved, closed, or renamed. Specifically, an object thatis interested in being notified about changes to a specific data objectimplements an object with an IAdviseSink interface, and passes apointer to this interface to the data object using the DAdvise functionof the IDataObject interface (see entry under 9.2 attributes).Whenever its data changes, the data object calls the OnDataChangefunction in the IAdviseSink interface it has been passed. (The IAdviseSinkinterface also contains other notification functions, such as OnRename,OnSave, etc.)
Analysis and Design Methods
SA: "An event is the abstractionof an incident or signal in the real world that tells us that somethingis moving to a new state. in abstracting an event, four aspects of theevent are specified: meaning, destination [class], label, [and] event data."Event data includes "identifier data [which] specifies the instance...that is going to receive the event."
RA: "An individual stimulus fromone object [instance] to another is an event." "An event is aone way transmission of information from one object to another. ... Anobject sending an event to another object may expect a reply, but the replyis a separate event under the control of the second object, which may ormay not choose to send it."
JA: The event when an object communicateswith another object. See the discussion of 'stimulus' elsewhere.
WD: Not used
MD: [find again the discussion of events.]
EA: "An event is any change withina system. Examples include the creation or deletion of an object, a changein a relationship set, a change of state for an object, starting or stoppingan activity, and the reception of a command or message."
FA: "An event is an instantaneousand atomic unit of communication between the system and its environment.An input event is sent by an agent to the system; an output event is sentby the system to an agent. The communication is asynchronous, as the senderdoes not wait for the event to be received. The sender may supply datavalues and objects with an event. When a system receives an event it cancause a change of state and the output of events. The effect of an eventis determined by the values that are supplied with it and the state ofthe system when it is received."
OA: "An event is a noteworthy changein state."
BD: "An event is some occurrencethat may cause the state of a system to change." " An event maybe a symbolic name (or a named object), a class, or the name of some operation.... We may take the strategy that all events are just symbolic names andthat each class with interesting event-ordered behavior provides an operationthat can consume such names and carry out the appropriate action. ... Formore generality, we may treat events as objects, and so define a hierarchyof event classes that provide our abstraction of specific events. ... Lastly,we might define an event simply as an operation ... This approach is similarto that of treating events as symbolic names, except that we no longerrequire an explicit event-dispatching operation."
HA: The term is not used. "Messagesare the triggers for activating services"
NA: Used only for occurrences externalto the system. "System event[:] Something to which a system will respondwith a certain behavior."
features matrixintro page