Differences From Artifact [943b4fe02c4ff5cd]:
- File
SQLite3/Samples/06 - Remote JSON REST Service/Project06Server.dpr
- 2010-07-18 16:53:27 - part of checkin [960d3bb493] on branch trunk - added sample "06 - Remote JSON REST Service" (user: ab
To Artifact [76b0351e0617c3b5]:
- File
SQLite3/Samples/06 - Remote JSON REST Service/Project06Server.dpr
-
2011-11-24 15:36:14
- part of checkin
[e04dbb13d0]
on branch trunk
-
- the TSQLRestServerCallBack method prototype has been modified to supply an addition aSession: cardinal parameter: this is a CODE BREAK change and you shall refresh ALL your server-side code to match the new signature
- new TSQLRestServer.SessionGetUser method to be used e.g. by any TSQLRestServerCallBack method implementation to retrieve the connected user
- fix issue about abusive session timeout: TSQLRestServer.SessionGet is now renamed SessionAccess and refreshes the session access timestamp each time a session is retrieved
-
2011-11-24 15:36:14
- part of checkin
[e04dbb13d0]
on branch trunk
-
8 SysUtils; 8 SysUtils;
9 9
10 type 10 type
11 // you'll have warning about abstract classes, because TSQLRestServer doesn't 11 // you'll have warning about abstract classes, because TSQLRestServer doesn't
12 // implement any database engine, but it doesn't matter here 12 // implement any database engine, but it doesn't matter here
13 TServiceServer = class(TSQLRestServer) 13 TServiceServer = class(TSQLRestServer)
14 published 14 published
15 function Sum(aRecord: TSQLRecord; aParameters: PUTF8Char; | 15 function Sum(aSession: Cardinal; aRecord: TSQLRecord; aParameters: PUTF8Char
16 const aSentData: RawUTF8; var aResp, aHead: RawUTF8): Integer; | 16 const aSentData: RawUTF8; out aResp, aHead: RawUTF8): Integer;
17 end; 17 end;
18 18
19 19
20 { TServiceServer } 20 { TServiceServer }
21 21
22 function TServiceServer.Sum(aRecord: TSQLRecord; aParameters: PUTF8Char; | 22 function TServiceServer.Sum(aSession: Cardinal; aRecord: TSQLRecord;
23 const aSentData: RawUTF8; var aResp, aHead: RawUTF8): Integer; | 23 aParameters: PUTF8Char; const aSentData: RawUTF8; out aResp, aHead: RawUTF8):
24 var a,b: Extended; 24 var a,b: Extended;
25 begin 25 begin
26 if not UrlDecodeNeedParameters(aParameters,'A,B') then begin 26 if not UrlDecodeNeedParameters(aParameters,'A,B') then begin
27 result := 404; // invalid Request 27 result := 404; // invalid Request
28 exit; 28 exit;
29 end; 29 end;
30 while aParameters<>nil do begin 30 while aParameters<>nil do begin