mORMot and Open Source friends
Diff
Not logged in

Differences From Artifact [943b4fe02c4ff5cd]:

To Artifact [76b0351e0617c3b5]:


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  SysUtils;

type
  // you'll have warning about abstract classes, because TSQLRestServer doesn't
  // implement any database engine, but it doesn't matter here
  TServiceServer = class(TSQLRestServer)
  published
    function Sum(aRecord: TSQLRecord; aParameters: PUTF8Char;
      const aSentData: RawUTF8; var aResp, aHead: RawUTF8): Integer;
  end;


{ TServiceServer }

function TServiceServer.Sum(aRecord: TSQLRecord; aParameters: PUTF8Char;
  const aSentData: RawUTF8; var aResp, aHead: RawUTF8): Integer;
var a,b: Extended;
begin
  if not UrlDecodeNeedParameters(aParameters,'A,B') then begin
    result := 404; // invalid Request
    exit;
  end;
  while aParameters<>nil do begin







|
|





|
|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  SysUtils;

type
  // you'll have warning about abstract classes, because TSQLRestServer doesn't
  // implement any database engine, but it doesn't matter here
  TServiceServer = class(TSQLRestServer)
  published
    function Sum(aSession: Cardinal; aRecord: TSQLRecord; aParameters: PUTF8Char;
      const aSentData: RawUTF8; out aResp, aHead: RawUTF8): Integer;
  end;


{ TServiceServer }

function TServiceServer.Sum(aSession: Cardinal; aRecord: TSQLRecord;
  aParameters: PUTF8Char; const aSentData: RawUTF8; out aResp, aHead: RawUTF8): Integer;
var a,b: Extended;
begin
  if not UrlDecodeNeedParameters(aParameters,'A,B') then begin
    result := 404; // invalid Request
    exit;
  end;
  while aParameters<>nil do begin