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:


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;
   if FSumCommand = nil then
     FSumCommand := FDBXConnection.CreateCommand;
     FSumCommand.CommandType := TDBXCommandTypes.DSServerMethod;
     FSumCommand.Text := 'TMyClass.Sum';
   Result := FSumCommand.Parameters[2].Value.GetDouble;

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:


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.


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