Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Sharing record buffers
Tue, May 9 2006 10:35 AMPermanent Link

"Jose Eduardo Helminsky"
I have been playing with a small trouble with an example routine like below:

Q: TDBISamQuery
T: TDBISamTable
T.TableName := 'mytable';

Q.RequestLive := True;
Q.Sql.Text := 'select * from mytable where cond=1';
Q.Open;
while not Q.Eof do begin
   if T.FindKey([Q.FieldByName('Key').AsInteger]) then begin
       T.Edit;
       T.FieldByName('Cond').AsInteger := 0;       <--------- Here I am
violating the where clause
       T.Post;
   end;
   Q.Next;    <----- ***
end;
Q.Close;

*** Because RequestLive = True the current record pointer is invalid but I
think before jump to the next record DBISAM move to a valid record pointer.

The real problem here is not how to update the table (I can use update
instead of) but just to understant the exact way DBISAM handle this
situation.

The final question: DBISAM works like explained above or not ?

Eduardo

Tue, May 9 2006 4:26 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Eduardo,

<< *** Because RequestLive = True the current record pointer is invalid but
I think before jump to the next record DBISAM move to a valid record
pointer. >>

Correct.

<< The real problem here is not how to update the table (I can use update
instead of) but just to understant the exact way DBISAM handle this
situation. >>

It depends upon the order of the result set.  It will re-adjust based upon
the order, which will be the primary index order if you didn't specify an
ORDER BY clause.  IOW, it will jump to the next highest record based upon
the primary index, so just skip the Next call when you actually update a
record so that it falls out of the WHERE clause.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image