Icon Calling Server-Side Procedures

DBISAM allows a database server to be customized via server-side procedures. Remote sessions may then call these server-side procedures in order to isolate batch processes and other types of processing on the database server. This helps reduce network traffic and allow for all-or-nothing processes that will complete regardless of whether the client workstation loses its connection to the database server or goes down unexpectedly. To see how to define the actual server-side procedure on the server, please see the Customizing the Engine topic.

Calling the Procedure
To successfully call a server-side procedure you must be logged into the database server as a user that has been granted rights to execute the server-side procedure that you wish to call. Please see the Server Administration topic for more information.

Before calling the server-side procedure, you must populate the TDBISAMSession RemoteParams property as needed for any parameters to the procedure using the TDBISAMParams CreateParam method, call the TDBISAMSession CallRemoteProcedure method with the proper procedure name (case-insensitive), and then examine any needed return parameters using the RemoteParams property or the TDBISAMSession RemoteParamByName method. The following example shows how you would call a server-side procedure named "Test_Procedure" that accepts an integer and a string:

   with MyRemoteSession do
         { Now call the procedure }
         if RemoteParams.ParamByName('Result').AsBoolean then
            ShowMessage('The record was added successfully')
            ShowMessage('The record was not added successfully');
         ShowMessage('There was an error calling the '+
                     'server-side procedure');

Handling Exceptions in Procedures
If a server-side procedure raises any type of exception at all, the database server will send the exception back to the remote session and raise it in the context of the CallRemoteProcedure method call. Defining a try..except block (Delphi) or a try..catch block (C++) is the best way to handle these exceptions since you can then respond to them accordingly based upon the server-side procedure that you are calling.