EasyManua.ls Logo

Sybase Adaptive Server Anywhere - Page 454

Sybase Adaptive Server Anywhere
1182 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
CREATE EVENT statement
436
Event handlers execute on a separate connection, with the permissions of the
event owner. To execute with permissions other than DBA, you can call a
procedure from within the event handler: the procedure executes with the
permissions of its owner. The separate connection does not count towards the
ten-connection limit of the personal database server.
Automatic commit.
The actions of an event handler are committed if no error is detected during
execution, and rolled back if errors are detected.
"BEGIN statement" on page 404
"ALTER EVENT statement" on page 387
"COMMENT statement" on page 418
"DROP statement" on page 505
"TRIGGER EVENT statement" on page 630
Events can be used in two main ways:
Scheduling actions The database server carries out a set of actions on
a schedule of times. You could use this capability to schedule backups,
validity checks, queries to fill up reporting tables, and so on.
Event handling actions The database server carries out a set of
actions when a predefined event occurs. The events that can be handled
include disk space restrictions (when a disk fills beyond a specified
percentage), when the server is idle, and so on.
An event definition includes two distinct pieces. The trigger condition can
be an occurrence, such as a disk filling up beyond a defined threshold. A
schedule is a set of times, each of which acts as a trigger condition. When a
trigger condition is satisfied, the event handler executes. The event handler
includes one or more actions specified inside a compound statement
(BEGIN… END).
If no trigger condition or schedule specification is supplied, only an explicit
TRIGGER EVENT statement can trigger the event. During development,
you may wish to develop and test event handlers using TRIGGER EVENT,
and add the schedule or WHERE clause once testing is complete.
Event errors are logged to the database server console.
When event handlers are triggered, the server makes context information,
such as the connection ID that caused the event to be triggered, available to
the event handler using the
event_parameter
function.
CREATE EVENT clause The event name is an identifier. An event has a
creator, which is the user creating the event, and the event handler executes
with the permissions of that creator. This is the same as stored procedure
execution. You cannot create events owned by other users.
Side effects
See also
Description
Parameters

Table of Contents

Related product manuals