System Management of Stored Procedures/Functions
RaimaDB is designed to be platform independent so that a single database format can be used from any type of RaimaDB client platform. So, a database controlled by an RaimaDB TFS1 running on a 64 bit Linux system can be directly read by a 32 bit Windows client, an iOS client, a VxWorks client, and so on. The compiled form of an RaimaDB SQL stored procedure/function, however, is platform dependent. So there needs to be a way in which changes to stored procedures can be migrated to each client platform. This section explains how this is done.
When a CREATE PROCEDURE/FUNCTION is successfully executed, the compiled form of the routine is stored on the client computer in the application's current directory in a file named as follows:
The {32|64} indicates whether the application was built for a 32 or 64 bit system (e.g., both are supported on Windows).
In addition, a copy of the stored routine’s definition is stored in a text file named proc_name.psm in the docroot directory on the TFS for the database associated with the stored procedure or function. The creation timestamp for this file is stored in the .ssp file on the client computer.
In order to change a stored procedure, it must be dropped and re-created which will store a new proc_name.psm file on the TFS. When a stored procedure or function is first called on the client, the .psm's file timestamp read from the .ssp file is compared with that of the current .psm file on the TFS. If the TFS does not have a .psm file then the stored procedure has been dropped and SQL will indicate that through a returned error code. If the timestamp value is different, then the .psm file is read and automatically compiled on the client, replacing the .ssp file and the new procedure is then called.