#1 2021-04-19 13:19:55

EvaF
Member
Registered: 2014-07-19
Posts: 40

SynDB + FetchAllToJSON

Hello,
I don't know if my proposal  doesn't go beyond the logic of the FetchAllToJSON function, but I would welcome  if FetchAllToJSON function returns eally all records ( not only the rest of records from the CurrentRow position)
f.e.
instead of

  function TSQLDBStatement.FetchAllToJSON(JSON: TStream; Expanded: boolean): PtrInt;
  ...
  while Step do begin
      ColumnsToJSON(W);
      W.Add(',');
      inc(result);
    end;
   ...

to use:

  function TSQLDBStatement.FetchAllToJSON(JSON: TStream; Expanded: boolean): PtrInt;
  var lFirst : boolean;
  ...
    lFirst := true;
    while Step(lFirst) do begin
      lFirst := false;
      ColumnsToJSON(W);
      W.Add(',');
      inc(result);
    end;
    ...

Offline

#2 2021-04-19 14:55:57

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

Re: SynDB + FetchAllToJSON

Some database provider don't allow to rewind the cursor... this is why I am afraid it may break some expectations.

Offline

#3 2021-04-19 15:46:40

EvaF
Member
Registered: 2014-07-19
Posts: 40

Re: SynDB + FetchAllToJSON

ok, thx for explanatation

Offline

#4 2021-04-19 16:08:20

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: SynDB + FetchAllToJSON

More over, even for databases what can rewind, unidirectional cursors performance is much better

Offline

Board footer

Powered by FluxBB