#1 2017-08-29 09:31:38

turrican
Member
From: Barcelona
Registered: 2015-06-05
Posts: 94
Website

[FEATURE] AddOrUpdate on SynCrossPlatformREST Implementation

Hi,

Would be nice and very useful to have this method on cross.

function TSQLRest.AddOrUpdate(Value: TSQLRecord; ForceID: boolean): TID;
begin
  if (self=nil) or (Value=nil) then begin
    result := 0;
    exit;
  end;
  if ForceID or (Value.fID=0) then begin
    result := Add(Value,true,ForceID);
    if (result<>0) or (Value.fID=0) then
      exit;
  end;
  if Update(Value) then
    result := Value.fID else
    result := 0;
end;

I think the code will work as is.

Offline

#2 2017-08-29 09:47:58

turrican
Member
From: Barcelona
Registered: 2015-06-05
Posts: 94
Website

Re: [FEATURE] AddOrUpdate on SynCrossPlatformREST Implementation

I will test it and make a pull request to your GIT repo.

Offline

Board footer

Powered by FluxBB