#1 2022-04-17 22:26:51

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 184

Getting error accessing interfece from android using sicPerThread

The following implementation was created for accessing an interface in Mormot2 and it works without a problem from Windows using SynCrossPlatformREST from mormot1 using Delphi 11.1

function TwbService.mydbver(const dbver: Integer): utf8string;
var res: TVariantDynArray;
begin fClient.CallRemoteService(self,'mydbversionis',1,[dbver],res);
Result:=res[0]; end;

for a service defined as the following:

constructor TwbService.Create(aClient: TSQLRestClientURI);
begin 
fServiceName:='wService'; 
fServiceURI:='wService';
fInstanceImplementation:=sicPerThread; 
inherited Create(aClient); 
end;

When compiled for Android I am getting the following error:

Overflow while converting variant of type (int64) into type (integer)

the problem seems to happen in line 2918 from SynCrossPlatformREST and commenting this line problem does not exist

  outID := doc.Value['id']; 

Am I missing something?

Offline

#2 2022-04-18 07:26:58

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 13,182
Website

Re: Getting error accessing interfece from android using sicPerThread

Isn't it a Delphi compiler problem?
doc.Value['id'] returns a variant - it could be converted into integer or Int64 at compilation time.

I don't have Delphi 11.1 so I can't comment. Perhaps some other users could.

Offline

#3 2022-04-18 08:33:52

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 184

Re: Getting error accessing interfece from android using sicPerThread

I think the problem is that in

function CallGetResult(const aCall: TSQLRestURIParams; var outID: integer): variant;

outid is integer and the number it is returning is int64 causing overflow

{
    "result": [
        "{\"var1\":\"\",\"var2\":\"\"}"
    ],
    "id": 140173798573824
}

Is the id above a 32bit integer?

Last edited by dcoun (2022-04-18 19:01:41)

Offline

#4 2022-04-18 20:41:54

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 13,182
Website

Re: Getting error accessing interfece from android using sicPerThread

You are right: the 64-bit values were not properly supported.

Please try with https://synopse.info/fossil/info/704c88beae

Offline

#5 2022-04-18 20:43:36

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 184

Re: Getting error accessing interfece from android using sicPerThread

Thanks a lot @ab

Offline

Board footer

Powered by FluxBB