#1 2026-01-08 15:37:05

justin19770424
Member
From: shanghai, china
Registered: 2026-01-08
Posts: 2

Is there a size limit when passing parameters during interface func.

This is modified from the sample.

api.interfaces.pas
------------------------------------
TProcessingResult = packed record
  ServerSyncTime: TDateTime;
  Msg: RawUtf8 ;
  ResultStatus:RawUtf8;
  ServerSyncVersion:RawUtf8;
  FailedTableNames: TArray<string>;
end;
TSyncDataItem = packed record
  ID: TID;
  TriggerType:RawUtf8;
  TableName: RawUtf8;
  OperType: Integer;
  SyncVersion: RawUtf8;
  SyncTime: TDateTime;
  DeleteFlag: Boolean;
  FieldValues: TJSONObject;
end;
PSyncDataItem=^TSyncDataItem;
TSyncDataItems = array of TSyncDataItem;

ILongWorkService = interface (IInvokable)
['{09FDFCEF-86E5-4077-80D8-661801A9224A}']
function SyncData (const items:TSyncDataItems): TProcessingResult; // 简化参数名称,避免冲突
end;
....
initialization
  Rtti.RegisterFromText(TypeInfo(TProcessingResult),
        'ServerSyncTime:TDateTime Msg:RawUtf8 ResultStatus:RawUtf8 ServerSyncVersion:RawUtf8 FailedTableNames: TArray<string>');
  Rtti.RegisterFromText(TypeInfo(TSyncDataItem),
        'id:TID TriggerType:RawUtf8 TableName:RawUtf8 OperType:Integer SyncVersion:RawUtf8 ' +
        'SyncTime:TDateTime DeleteFlag:Boolean FieldValues:TJSONObject');
   Rtti.RegisterType(TypeInfo(TSyncDataItems));
   TInterfaceFactory.RegisterInterfaces( [TypeInfo(ILongWorkCallback) , TypeInfo(ILongWorkService)] ) ;

Server Side:
---------------------------
function SyncData(const items:TSyncDataItems): TProcessingResult;
begin
    result:=ExecuteDataOperation(items);
end;

Client Side:
----------------------------
for J := 0 to 2 do
begin
   SetLength(Test, Length(Test) + 1);
   Test[High(Test)] := SyncDataItems[J];
end;
SyncResponse :=FClient.Service.SyncData(Test) ;

An error occurs when the client invokes the method: it works fine when the Test array has 2 elements, but throws an error when it has 3 elements. I don’t know the reason—could it be that there is a limit on parameter passing?  and this error occurs before the parameters are transmitted to the server program

Offline

#2 2026-01-08 16:37:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,380
Website

Re: Is there a size limit when passing parameters during interface func.

There is no such limitation.
See the regression tests.

Which error do you have?

As stated by the forum rules, a minimum reproducible example in a gist is better to understand what is occurring.
Such limited code in the thread is almost pointless.

Offline

#3 2026-01-09 03:35:35

justin19770424
Member
From: shanghai, china
Registered: 2026-01-08
Posts: 2

Re: Is there a size limit when passing parameters during interface func.

ok, thanks.
i've found the issue, there is no limitaion.

Offline

Board footer

Powered by FluxBB