Chapter 15 DBMS-Specific Features


Events

Events allow you to automate and schedule actions. PowerDesigner models events as extended objects with a stereotype of <<Event>>.

Creating an event

You can create an event in any of the following ways:

Event properties

You can modify an object's properties from its property sheet. To open an event property sheet, double-click its diagram symbol or its Browser entry in the Event Objects folder.

The following extended attributes are available on the Sybase tab:

Name Scripting Name Description
Event is scheduled ScheduledEvent Specifies that the server carries out a set of actions according to a schedule of times.

If selected, this option disables the "Event is triggered" option.
Schedule definition SchedulesText Enter the schedule of event trigger times here. Click the New button to launch a dedicated editor window.
Event is triggered TypedEvent Specifies that the server carries out a set of actions when a predefined type of system event occurs.

This option is the default and, if selected, disables the "Event is scheduled" option.
Event type EventType The event-type is one of the listed set of system-defined event types. The event types are case insensitive. To specify the conditions under which this event-type triggers the event, use the WHERE clause.
Trigger condition TriggerCondition The trigger condition determines the condition under which an event is fired. For example, to take an action when the disk containing the transaction log becomes more than 80% full, use the following triggering condition:

WHERE event_condition( 'LogDiskSpacePercentFree' ) < 20

The argument to the event_condition function must be valid for the event type.

You can use multiple AND conditions to make up the WHERE clause, but you cannot use OR conditions or other conditions.
Handler Handler Each event has one handler.

The actions of an event handler are committed if no error is detected during execution, and rolled back if errors are detected.
Enable at (databases) Enable By default, event handlers are enabled. When DISABLE is specified, the event handler does not execute even when the scheduled time or triggering condition occurs. A TRIGGER EVENT statement does not cause a disabled event handler to be executed.

If you want to execute events at remote or consolidated databases in a SQL Remote setup, you can use this clause to restrict the databases at which the event is handled. By default, all databases execute the event.

 


Copyright (C) 2006. Sybase Inc. All rights reserved.