ZAbstractDataset InternalPost problem with IndexFieldNames

In this forum all bug reports concerning the 6.x branch will be gahtered. You have the possibility to track the bug fix process.

Moderators: EgonHugeist, mdaems

Post Reply
cacofony
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 06.12.2006, 15:24
Location: Perth - Western Australia
Contact:

ZAbstractDataset InternalPost problem with IndexFieldNames

Post by cacofony »

Hi,

Since this is my first post, thanks to all the developers who work hard on Zeos-Lib!

I have a problem when I POST changes to a MySQL table in ZQuery that is sorting records via IndexFieldName, the record just posted will no longer be the active record it jumps to another record.

Now this problem only occours if the data is in a DBGrid (tried different types JvUltimGrid), if I have not grid and just use a Navigation bar, it does not appear to jump records (I did not test this too much as it was not going to be a solution)

I have found that by uncommenting the code below, from InternalPost in ZAbstractDataset.pas POSTing data works as it should but I cannot tell what adverse effects this may have by being removed.

BUG-FIX: bangfauzan addition}
if (SortedFields<>'') then begin
FreeFieldBuffers;
{SetState(dsBrowse);
Resync([]);
BM:=Bookmark;
DisableControls;
InternalSort;
BookMark:=BM;
EnableControls;}
end;
{end of bangfauzan addition}

Regards

Tristan
You do not have the required permissions to view the files attached to this post.
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 Cacofony,

Are you using the original 6.6.0-beta release or using SVN (Trunk or Testing) version? There havebeen some changes to the Bangfauzan patch that will be in next release, so this problem may be solved (or not at all :) )

Mark
cacofony
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 06.12.2006, 15:24
Location: Perth - Western Australia
Contact:

Post by cacofony »

That could well be it, I thought I had latest, but now I see I don't I am using

ZEOSLIB - 20061011 Testing branch(rev 113)

I will try, thanks for that.
cacofony
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 06.12.2006, 15:24
Location: Perth - Western Australia
Contact:

Post by cacofony »

I have updated to ZEOSLIB_TRUNK_REV187 and have looked at the code in TESTING and I still have the same issue.

Tristan
danielmadeira
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 26.02.2015, 02:26

Re: ZAbstractDataset InternalPost problem with IndexFieldNames

Post by danielmadeira »

Hi,

Someone have seen this problem? I have the same issue using Zeos lib 6.6.6 (stable).

You can used this example:

I have a dataset with 23 rows, with IndexFieldNames "nivel" and "seq" (nivel;seq).

11 of this rows have different nivel and seq.

Always I start an "while" in this dataset with edition, the post and next bring the pointer to the next "nivel and seq". So the "while" only execute 11 times.

The example is:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var
  x : Integer;
  iFor : Integer;
  function numero(dataset : Tdataset) : integer;
  var
    i : integer;
  begin
    i := 0;
    dataset.first;
    while not dataset.eof do
    begin
      dataset.edit;
      dataset.fieldbyname('id_produto').asINteger := 0;
      dataset.post;
      inc(i);
      dataset.next;
      sleep(500);
    end;
    result := i;
  end;
begin
  zquery1.open;
  zquery1.indexfieldnames := 'nivel;seq';
  showmessage('recordcount = '+inttostr(zquery1.recordcount)+#13+'while = '+inttostr(numero(zquery1)));
end;
My ZQuery is connected in a DBGrid component.

Thanks for the help!

Daniel Madeira
Post Reply