This topic describes working with stored programs are stored procedures and functions, triggers and events in dbForge Fusion for MySQL.
Event is a task that runs according to schedule. An event’s action statement may include most SQL statements permitted within stored routines. Fusion for MySQL supports events on MySQL servers starting from MySQL 5.1.11. Fusion for MySQL allows you to create, modify, and drop events.
Save the document. If there are any errors in the SQL syntax, you will be notified about it.
-or-
Edit event by selecting Edit Event on the Database Explorer node shortcut menu. Note that event can not be saved if the start day of the event already passed. Set it to a correct value (current or future time) to save the event.
Drop event by selecting Delete on the Database Explorer node shortcut menu.
Stored procedure (function) is a set of statements that resides on server side and can be executed. Using Fusion for MySQL, you can create, edit, execute and delete stored procedures.
A new document appears with template in the Text view. Fill it with statements or switch to the Design view to edit procedure properties. Save the document to finish procedure creation.
To edit a stored procedure:
Right-click a procedure and select Open on the shortcut menu.
double-click a procedure.
You can switch to the Design view to edit some properties of the procedure.
Right-click a stored procedure in Database Explorer and select Execute.
The stored procedure editor opens if it was not opened before. If the procedure accepts parameters, you will see the Parameters dialog box where you can assign initial values for procedure arguments. Once the stored procedure is executed, you will see a corresponding record in the Output window. The data returned by the stored procedure will appear in Data view of the stored procedure editor.
Click the Stop Execution button on the toolbar.
Right-click a stored procedure in Database Explorer, and select Delete.
Note
You can treat stored functions exactly the same way as stored procedures.
Trigger is a routine executed under certain conditions.
Using Fusion for MySQL, you can create, edit and delete triggers.
Note
Fusion for MySQL supports triggers only with MySQL server 5.0.13 and higher.
The Trigger Editor has two tabs: Main and Event. In the Main tab, you can choose trigger type and fill its body, as well as switch the trigger on or off. In the Event tab you can set up event that should execute the trigger.
Select Delete on the trigger shortcut menu.