Page 1 of 1

[BUG] 6.6.4 +CachedUpdates + Filter Empty + Change in Filter

Posted: 27.05.2009, 20:11
by leodinei
I found a problem in ZAbstractRODataset.pas.
If I have in a TZQuery:

Code: Select all

 CachedUpdates = true
 Filter = ""
If a delete a record and change filter from empty to something then all changes are lost.
The problem is here:

Code: Select all

if Active then
    {InternalSort;}
    {bangfauzan modification}
     if (FSortedFields = '') then
        Self.InternalRefresh
     else
        InternalSort;
    {end of bangfauzan modification}
end;
if FSortedFields is empty then is called InternalRefresh and all changes(insert, delete, etc) are lost.
I don't know if InternalRefresh is suposed to keep the changes or if FSortedFields is suposed to be get a value before this point to avoid this problem.
So if someone can help with a patch would be nice.
This is the full procedure on ZAbstractRODataset.pas.

Code: Select all

procedure TZAbstractRODataset.SetSortedFields({const} Value: string); {bangfauzan modification}
begin
  Value:=Trim(Value); {bangfauzan addition}
  if (FSortedFields <> Value) or (FIndexFieldNames <> Value)then {bangfauzan modification}
  begin
    FIndexFieldNames:=Value;
    FSortType := GetSortType; {bangfauzan addition}
    {removing ASC or DESC behind space}
    if (FSortType <> stIgnored) then begin {pawelsel modification}
       Value:=StringReplace(Value,' Desc','',[rfReplaceAll,rfIgnoreCase]);
       Value:=StringReplace(Value,' Asc','',[rfReplaceAll,rfIgnoreCase]);
    end;
    FSortedFields := Value;
    if Active then
      {InternalSort;}
      {bangfauzan modification}
       if (FSortedFields = '') then
          Self.InternalRefresh
       else
          InternalSort;
      {end of bangfauzan modification}
  end;
end;
Thank you in advance.

Posted: 03.06.2009, 21:27
by mdaems
Hi,

Seems like the problem is introduced with SVN revision 103

Actually, I wonder why something should happen when Sortedfields is emptied. Resorting seems odd to me. Does removing the Self.Internalrefresh call solve your problem?

Mark

Posted: 03.06.2009, 21:31
by leodinei
mdaems wrote:Hi,

Seems like the problem is introduced with SVN revision 103

Actually, I wonder why something should happen when Sortedfields is emptied. Resorting seems odd to me. Does removing the Self.Internalrefresh call solve your problem?

Mark
Yes. The problem was gone.
But I don't know the zeos internals to be sure if this will not rise another problem is another place.
So far I didnt got any problems.
thx