FD REST MSSQL update not posting


FD REST MSSQL update not posting 

I built a test app using “Using a REST DataSnap Server with an Application and FireDAC” found on http://docwiki.embarcadero.com/RADStudio/XE7 as a starting point. The sample uses InterBase and everything worked as expected. I then added a FD connection to a MSSQL server and a couple of FDQuerys and created the respective GET’s and ApplyUpdate functions and procedures. The GET’s work and my controls are properly populated however when I execute the Applyupdate code the MSSQL GetDeltas and ApplyChanges seem to function the same as the respective InterBase ones do [producing no errors] BUT the updates are NOT applied. I’ve run the debugger on the server and the client but am unable to locate the flaw. The server is a desktop app so I added a grid to see if there was something I could discover. I found out that I had to set the FDQuery CheckReadOnly to false to get my updates to apply. I thought that would do the trick but not so. I’d love to understand how to inspect the payload in the TFDJSONDeltas [see image] at the client or the server. I can see the name of my key field [ccustno] but I do not understand the rest of the information in the watch tree. Perhaps the problem is a configuration issue in the FDConnection or the FDQuery component or a FD bug.

PS when debugging how can I stop the debugger from stepping through all the Delphi units. I just want to debug my code.

------------------ CLIENT ---------------
procedure TfrmRGBTest.btnApplyCustomerChangesClick(Sender: TObject);
var
  LDeltaList: TFDJSONDeltas;
---------------------------
  function GetDeltas: TFDJSONDeltas;
  begin
    if FDMemTableAMCustomer.State in dsEditModes then
    begin
      FDMemTableAMCustomer.Post;
    end;
    Result := TFDJSONDeltas.Create;
    TFDJSONDeltasWriter.ListAdd(Result, scustno, FDMemTableAMCustomer);
  end;
-----------------------------
begin
  LDeltaList := GetDeltas;
  try
    ClientModule2.ServerMethods1Client.ApplyChangesAMCustomer(LDeltaList);
  except
    on E: TDSRestProtocolException do
      HandleRestException(ClientModule2.DSRestConnection1, 'Apply Updates error', E)
    else
      raise;
  end;
end;
---------------------------
procedure TfrmRGBTest.ListViewAMCustomersChange(Sender: TObject);
var
  ccustno: string;
begin
  ccustno := ListViewAMCustomers.Selected.Detail;
  GetAMCustomer(ccustno);
end;
---------------------------
procedure TfrmRGBTest.GetAMCustomer(const ACUSTNO: string);
var
  LDataSetList: TFDJSONDataSets;
begin
  try
    LDataSetList := ClientModule2.ServerMethods1Client.GetAMCustomer(ACUSTNO);     //
    UpdateAMCustomer(LDataSetList);
  except
    on E: TDSRestProtocolException do
      HandleRestException(ClientModule2.DSRestConnection1, 'Get customer error', E)
    else
      raise;
  end;
end;
---------------- SERVER ---------------
function TServerMethods1.GetAMCustomer(const CUSTNO: string): TFDJSONDataSets;
begin
  FDQueryAMCustomer.Active := False;
  FDQueryAMCustomer.Params[0].Value := CUSTNO;  
  Result := TFDJSONDataSets.Create;
  TFDJSONDataSetsWriter.ListAdd(Result, cCustno, FDQueryAMCustomer);
end;
---------------------------
procedure TServerMethods1.ApplyChangesAMCustomer(const ADeltaList: TFDJSONDeltas);
var
  LApply: IFDJSONDeltasApplyUpdates;
begin
  LApply := TFDJSONDeltasApplyUpdates.Create(ADeltaList);
  LApply.ApplyUpdates(cCustno, FDQueryAMCustomer.Command);
  if LApply.Errors.Count > 0 then
    raise Exception.Create(LApply.Errors.Strings.Text);
end;
---------------------------
  object FDConnectionAM: TFDConnection
    ConnectionName = 'TEST'
    Connected = True
    LoginPrompt = False
    Left = 56
    Top = 184
  end
---------------------------
  object FDQueryAMCustomer: TFDQuery
    Connection = FDConnectionAM
    UpdateOptions.AssignedValues = [uvEDelete, uvEInsert, uvCountUpdatedRecords, uvCheckRequired, uvCheckReadOnly, uvCheckUpdatable]
    UpdateOptions.CheckReadOnly = False
    UpdateOptions.CheckUpdatable = False
    UpdateOptions.KeyFields = 'ccustno'
    SQL.Strings = (
      'select * from arcust where ccustno = :CCUSTNO')
    Left = 400
    Top = 264
    ParamData = <
      item
        Name = 'CCUSTNO'
        DataType = ftString
        ParamType = ptInput
        Size = 10
        Value = '1234'
      end>
  end
---------------------------

Comments