Stored procedures are procedures written in WLanguage that run directly on the database server. These procedures let you optimize process speed. Since all the database accesses are performed from the server itself, no information has to travel on the network.
Stored procedures are especially well suited for processes that do not require user input, such as statistic processing for instance.
Creating stored procedures
To create a stored procedure, simply right-click inside the analysis treeview and choose the "New set of procedures" option.
To create a new procedure in this collection, simply right click and choose "New procedure".
The stored procedures are written in WLanguage, in the WinDev code editor.
Note:
• If queries are used in stored procedures, they need to be added to the analysis as "Stored queries".
• The contexts (global variables, HyperFileSQL context) are not shared between the application and the stored procedures. A stored procedure has no information about the project and vice versa.
Deploying stored procedures
To put stored procedures on the server, you can:
• run the automatic modification. Indeed, the automatic modification does NOT only update files. It also updates integrity constraints, procedures and stored queries.
• only update the stored procedures. To do so, simply click inside the analysis treeview and choose "Update stored elements".
Note:
To call a stored procedure from a project, simply use the HExecuteProcedure function with the following parameters:
• the name of the connection to the server that must run the procedure,
• the name of the procedure to run,
• the parameters to pass to the stored procedures.