Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: DataSnap. Passing Variant parameters into TDBXCommand


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Feb 29, 2016 12:22 AM Last Post By: Alf Christopher... Threads: [ Previous | Next ]
Dimas Dimas

Posts: 1
Registered: 3/23/16
DataSnap. Passing Variant parameters into TDBXCommand  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 23, 2016 2:32 AM
First of all, excuse me for my bad english :)

I'm trying to develop a simple app based on examples:
http://docwiki.embarcadero.com/RADStudio/XE3/en/Creating_the_Server_Side_with_DataSnap_Server_(InterBase_Tutorial)
http://docwiki.embarcadero.com/RADStudio/XE3/en/Creating_a_Rich-Client_Interface_(InterBase_Tutorial)

I'm trying to implement a generic procedure to call DB stored procedures. The parameters in this procedure will be passed as a Variant array

So question is:
How to pass Variant parameter to the procedure of the DataSnap server module?

Here so, for example, it is impossible, because TObject it not Variant. Something like "SetVariant" i didn't find:


function TdmServerModuleClient.callStoredProcedure(aSPName: String;
  aParamNames, aParamValues: Variant): Integer;
begin
  if FcallStoredProcedureCommand = nil then
  begin
    FcallStoredProcedureCommand := FDBXConnection.CreateCommand;
    FcallStoredProcedureCommand.CommandType := TDBXCommandTypes.DSServerMethod;
    FcallStoredProcedureCommand.Text := 'TdmServerModule.callStoredProcedure';
    FcallStoredProcedureCommand.Prepare;
  end;
  FcallStoredProcedureCommand.Parameters[0].Value.SetString(aSPName);
  FcallStoredProcedureCommand.Parameters[1].Value.SetObjectValue(aParamValues)
  FcallStoredProcedureCommand.Parameters[2].Value.SetObjectValue(aParamValues);
  FcallStoredProcedureCommand.ExecuteUpdate;
  Result := FcallStoredProcedureCommand.Parameters[1].Value.GetInt32;
end;


Edited by: Dimas Dimas on Feb 23, 2016 2:39 AM
Alf Christopher...

Posts: 25
Registered: 10/10/98
Re: DataSnap. Passing Variant parameters into TDBXCommand  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 29, 2016 12:22 AM   in response to: Dimas Dimas in response to: Dimas Dimas
Is this code generated by the tSQLconnection object from the code in the datasnap server?

Or is it something you generated?

Some places you need to typecast the parameters to something the database server understands, like integer, varchar2 or string and alike.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02