Page 1 of 1

How to know about new records with CashedUpdates?

Posted: Fri 19 Jun 2009 12:01
by jürgen
Hello,

from TMSQuery.UpdatePendings i can get the information, that the RecordSet has been changed. Is there a similar function that informs me that they are new records inserted in the Query?

I don't want to check the UpdateStatus (=usInserted) of each record or set the UpdateRecordTypes to usInserted because the query is part of a Master-Detail-Subdetail relationship.

I'm looking for the UpdateStatus of the whole RecordSet and not of each record.

Posted: Fri 19 Jun 2009 12:55
by Dimon
SDAC has no property to check that new records were inserted in the Query. In order to solve this problem you can use thge UpdateStatus method.

Posted: Fri 19 Jun 2009 14:49
by Ludek
or following could help, I think:

dataset.UpdateRecordTypes := [rtInserted];

Posted: Sat 20 Jun 2009 01:07
by jürgen
Thank you for your suggestions.

I want to avoid both, because it's nasty work setting Bookmarks, DisableControls, clearing MasterSource and looping through the records and then setting all back.

I did it with a new function checking the Cache now:

function TMemData.GetInsertedPending: boolean;
var
CacheItem: TCacheItem;
begin
Result := False;
CacheItem := Cache;
while (CacheItem nil) and not Result do begin
Result := CacheItem.Item.Status = isAppended;
CacheItem := CacheItem.Next;
end;
end;

and additional GetDeletedPending.

Hope that will not result in other conflicts.

Posted: Mon 22 Jun 2009 07:26
by Dimon
It is good to see that this problem has been solved.