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

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
leodinei
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 10.11.2006, 11:12

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

Post 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.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
leodinei
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 10.11.2006, 11:12

Post 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
Post Reply