Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2006-04

Bug 5049: Record insert at eof in TSQLQuery

9 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin Schreiber

More exact formulation:

TSQLQuery.Last;
TSQLQuery.Insert;
TSQLQuery.Post;

The new record is not the last record.
It is at the same position as if

TSQLQuery.Last;
TSQLQuery.Prior;
TSQLQuery.Insert;
TSQLQuery.Post;

Martin

Reply by email

Martin Schreiber
to Michael Van Canneyt
Michael Van Canneyt wrote 11 lines
On Tue, 25 Apr 2006, Martin Schreiber wrote: > More exact formulation: > > TSQLQuery.Last; > TSQLQuery.Insert; > TSQLQuery.Post; > > The new record is not the last record. That is correct. It should be the last-but-one.

It seems there are other effects with the new TBufDataset which deceived me. I will do more tests.

Martin

Reply by email

Joost van der Sluis
to Martin Schreiber
Martin Schreiber wrote 14 lines
On Tuesday 25 April 2006 17.20, Michael Van Canneyt wrote: > On Tue, 25 Apr 2006, Martin Schreiber wrote: > > More exact formulation: > > > > TSQLQuery.Last; > > TSQLQuery.Insert; > > TSQLQuery.Post; > > > > The new record is not the last record. > > That is correct. It should be the last-but-one. > It seems there are other effects with the new TBufDataset which deceived me. I will do more tests.

Keep me informed.
Ik you find something that doesn't sound logical to you, just say so.

Joost.

Reply by email

Martin Schreiber
to Joost van der Sluis
Joost van der Sluis wrote
Keep me informed. Ik you find something that doesn't sound logical to you, just say so.

One problem is in internalfirst.

Old:
procedure TBufDataset.InternalFirst;
begin
  FBCurrentRecord := -1;
  FIsEOF := false;
end;
New:
procedure TBufDataset.InternalFirst;
begin
  FCurrentRecBuf := FFirstRecBuf;
end;

-> TBufDataset returns recorddata of recno 1+ instead of recno 0+ by call of GetNextRecords in TDataset.First.

Martin

Reply by email

Martin Schreiber
to Joost van der Sluis: Keep me informed. Ik you find something that doesn't sound logical to you, just say so.…
Joost van der Sluis wrote
Keep me informed. Ik you find something that doesn't sound logical to you, just say so.

dataset.inc:

Procedure TDataset.DoInsertAppend(DoAppend : Boolean);
  procedure DoInsert;
[...]
  if FActiveRecord < FRecordCount-1 then <<<<<< !!!!!!
    begin
    TempBuf := FBuffers[FBuffercount];
    move(FBuffers[FActiveRecord],FBuffers[FActiveRecord+1],
(Fbuffercount-FActiveRecord)*sizeof(FBuffers[0]));
    FBuffers[FActiveRecord]:=TempBuf;
    end
  else if FRecordcount=FBuffercount then
    shiftbuffersbackward              <<<<<<<<<<<<<<<<<<
  else begin
    if FRecordCount>0 then
    inc(FActiveRecord);
  end;

Inserted records are displayed *after* the current record if the current record is at end of buffer!

Martin

Reply by email

Joost van der Sluis
to Martin Schreiber: One problem is in internalfirst. Old: procedure TBufDataset.InternalFirst; begin…
Martin Schreiber wrote 22 lines
On Wednesday 26 April 2006 00.43, Joost van der Sluis wrote: > > Keep me informed. > Ik you find something that doesn't sound logical to you, just say so. > One problem is in internalfirst. Old: procedure TBufDataset.InternalFirst; begin FBCurrentRecord := -1; FIsEOF := false; end; New: procedure TBufDataset.InternalFirst; begin FCurrentRecBuf := FFirstRecBuf; end; -> TBufDataset returns recorddata of recno 1+ instead of recno 0+ by call of GetNextRecords in TDataset.First.

fixed in revision 3364

Reply by email

Joost van der Sluis
to Martin Schreiber: dataset.inc: Procedure TDataset.DoInsertAppend(DoAppend : Boolean); procedure DoInsert;…
Martin Schreiber wrote 25 lines
On Wednesday 26 April 2006 00.43, Joost van der Sluis wrote: > Keep me informed. > Ik you find something that doesn't sound logical to you, just say so. dataset.inc: Procedure TDataset.DoInsertAppend(DoAppend : Boolean); procedure DoInsert; [...] if FActiveRecord < FRecordCount-1 then <<<<<< !!!!!! begin TempBuf := FBuffers[FBuffercount]; move(FBuffers[FActiveRecord],FBuffers[FActiveRecord+1], (Fbuffercount-FActiveRecord)*sizeof(FBuffers[0])); FBuffers[FActiveRecord]:=TempBuf; end else if FRecordcount=FBuffercount then shiftbuffersbackward <<<<<<<<<<<<<<<<<< else begin if FRecordCount>0 then inc(FActiveRecord); end; Inserted records are displayed *after* the current record if the current record is at end of buffer!

I think i've fixed this in revision 3381. But this influences all TDataset descendents. Can you have a look at it?

Joost.

Reply by email

Martin Schreiber
to Joost van der Sluis
Joost van der Sluis wrote 6 lines
> Inserted records are displayed *after* the current record if the current > record is at end of buffer! I think i've fixed this in revision 3381. But this influences all TDataset descendents. Can you have a look at it?

It seems OK for me. Thanks!
Could you please change the wrong values of bug 5048 to category FCL and Version 2.0.3?

Martin

Reply by email