DataExplorer support for DataSnap

From RAD Studio
Jump to: navigation, search

Go Up to Developing DataSnap Applications


DataExplorer support for DataSnap is introduced to help observing stored procedures and functions, views and tables of a running DataSnap Server Application.

Usage and Exemplification

To use DataExplorer with DataSnap, first you need to have a DataSnap Server Application running on the local machine. Once this server application is up and running, go to the DataExplorer tab in the main Delphi interface. The results should look like in the following image:

DSDataExplorer1.png


In the DataExplorer window, under the DATASNAP section, we notice that we can visualize one of the following categories: Tables, Views, Procedures, Functions, Synonyms. For the purpose of this example, we are interested in DataSnap stored procedures. So clicking the Procedures item shows a tree containing all stored procedures contained in the DataSnap Server Application. Let's suppose that we inspect a Server Application containing a stored procedure called TMyClass.Sum, which is defined as follows:

 function TMyClassClient.Sum(A: Double; B: Double): Double;
 begin
   if FSumCommand = nil then
   begin
     FSumCommand := FDBXConnection.CreateCommand;
     FSumCommand.CommandType := TDBXCommandTypes.DSServerMethod;
     FSumCommand.Text := 'TMyClass.Sum';
     FSumCommand.Prepare;
   end;
   FSumCommand.Parameters[0].Value.SetDouble(A);
   FSumCommand.Parameters[1].Value.SetDouble(B);
   FSumCommand.ExecuteUpdate;
   Result := FSumCommand.Parameters[2].Value.GetDouble;
 end;

As we can observe from the declaration of TMyClassClient.Sum, the method accepts two Double values and returns their sum. The following image illustrates the list of stored procedures for a server application that contains the method described above:

DSDataExplorer2.png


You can observe that clicking any of the stored procedures expands the item and shows the method's input and output parameters subitems, in this case A, B, and ReturnValue. However, by double-clicking the name of a stored procedure, a parameters window pops up where we can observe the specific stored procedure's parameters.

DSDataExplorer3.png


In this window you can inspect the stored procedure's parameters along with their types, directions, sizes, values, and other specific information. Note that you can easily modify each parameter's properties by first selecting the parameter's name and then operating the changes in the right side (properties) of the window.

See Also