#1 2013-05-18 11:25:16

DigDiver
Member
Registered: 2013-04-29
Posts: 137

Request feature: add OnUpdateBlobEvent

The OnUpdateEvent at the server side will trigger after Client.Update(U);

It would be nice to add OnUpdateBlobEvent to the TSQLRestServer implementation that would be triggered after UpdateBlobFields

Client Side:

var
  U: TSQLAuthUser;
 FData : TSQLRawBlob;
begin
  U.LogonName := 'blabla';
 FData  := 'Some data';
  ....
  Client.Update(U);
  Client.UpdateBlob(TSQLAuthUser, FID, 'Data', FData);
end;

Server Side:

...
WPlaceServer.OnUpdateEvent   := UpdateWP;
...

function TEMServer.UpdateWP(Sender: TSQLRestServer; Event: TSQLEvent;  aTable: TSQLRecordClass; aID: integer): boolean;
begin
 if (Event = seUpdate) and (aTable = TSQLAuthUser) then
  begin
   U := TSQLAuthUser.CreateAndFillPrepare(sender, 'ID=?', [aID]);
   try
    U.FillOne;
    sender.RetrieveBlob(TSQLAuthUser, U.ID, 'Data', FUserData);
    U.Data := FUserData; // -----------------------------------------------------  at this point FUserData - contains old value
    g := TSQLAuthGroup.CreateAndFillPrepare(sender, 'ID=?', [U.GroupRights.ID]);
    try
     g.FillOne;
     UpdateUser(U, G);
    finally
     g.Free;
    end;
   finally
    u.Free;
   end;
end;

Offline

#2 2013-05-21 05:57:51

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Request feature: add OnUpdateBlobEvent

Feel free to create a feature request at http://synopse.info/fossil/reportlist (after anonymous login).

Please put a link to this forum thread, for reference and discussion.

Thanks.

Offline

Board footer

Powered by FluxBB