#1 2017-07-22 08:07:16

jienyuan
Member
Registered: 2017-07-22
Posts: 5

Service Record type Dynamic Array result for Delphi 7 has limitation?

I tried Record type Dynamic Array service result in Delphi 7.
However, the result lost information after 50th item in Delphi 7 but seems correct in Berlin.
Is it a limitation in mORMot 1.18 & Delphi 7 ?

The code is:

Type
   TCodeValue=packed record
       Code: string;
       Value: string;
   end;

  TCodeValueArray = array of TCodeValue;

  IServiceClient = Interface(IInvokable)
  ['{E1779C4E-C7E3-4F83-BF94-91E907774384}']
    function getLis: TCodeValueArray ;
  end;

 
  TServiceClient = class(TInjectableObjectRest,IServiceClient)
  public
    function getList: TCodeValueArray ;
  end;

 
function TServiceClient.getList: TCodeValueArray;
var
  x: integer;
begin
  SetLength(result,100);
  for x:=Low(result) to high(result)  do begin
    result[x].Code:=Format('User%0:.3d',[x]);
    result[x].Value:=Format('Name%0:.3d',[x]);
  end;
end;


test:
var
   d: TCodeValueArray;
   x: integer;
begin
   d:=c.getList;
   for x:=Low(d) to High(d) do
     writeln(d[x].code+'|'+d[x].value);
end; 
 
I only got this in Delphi 7.

  User000|Name000 (first)
  .
  .
  User049|Name049
  |
  |
  .
  .
  | (100th)

Offline

#2 2017-07-22 08:50:15

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

Re: Service Record type Dynamic Array result for Delphi 7 has limitation?

This is a known limitation of Delphi 7, already documented and explained.
Please search the forum and the documentation before posting here.
See https://synopse.info/forum/viewtopic.php?id=4037

Offline

#3 2017-07-22 14:27:15

jienyuan
Member
Registered: 2017-07-22
Posts: 5

Re: Service Record type Dynamic Array result for Delphi 7 has limitation?

Hi AB,

  Thanks for the reply.

I do read the thread and topic in the document.

But it noticed

If your application is developped on any older revision (e.g. Delphi 7, Delphi 2007 or Delphi 2009), you won't be able to automatically serialize records as plain JSON objects directly.

You have several paths available:

By default, the record will be serialized as binary, and encoded as Base64 text

So, I was wondering might Delphi 7 record will be serialized as binary, and encoded as Base64 text then pass to client.

Now, I see it.

Thanks again.

Offline

#4 2017-07-22 15:57:27

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

Re: Service Record type Dynamic Array result for Delphi 7 has limitation?

As documented, if you define the record as text, you will have serialization as json objects.

Offline

Board footer

Powered by FluxBB