[MDEV-5532] User defined events Created: 2014-01-16 Updated: 2016-02-18 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor |
| Reporter: | Jan Lindström (Inactive) | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | gsoc14, gsoc16 | ||
| Description |
|
User defined events are supported on several other databases in different form and semantics, few examples
Events are used to signal an named event in the database. Applications can use named events instead of polling, which uses more resources. Event is created with
The name can be any user-specified alphanumeric string. The parameter list specifies parameter names and parameter types. The parameter types are normal SQL types. Events are dropped with
Events are sent and received inside stored procedures. Special stored procedure statements are used to send and receive events. The event is sent with the stored procedure statement
Event parameters must be local variables, constant values, or parameters in the stored procedure from which the event is sent. All clients that are waiting for the posted event will receive the event. Each connection has its own event queue. The events to be collected in the event queue are specified with the stored procedure statement:
Events are removed from the event queue with the stored procedure statement:
Note that you do not need to register for every event before waiting for it. When you wait on an event, you will be registered implicitly for that event if you did not already explicitly register for it. Thus you only need to explicitly register events if you want them to start being queued now but you don't want to start WAITing for them until later. To make a procedure wait for an event to happen, the WAIT EVENT construct is used in a stored procedure:
Each connection has its own event queue. To specify the events to be collected in the event queue, use the command REGISTER EVENT event_name. Events are removed from the event queue by the command UNREGISTER EVENT event_name.
|