Subject TIBO* "Refresh" after InternalDataset buffer syncronization ?
Author Enrico Raviglione
I have used DML Caching with TIBO* how Jason have made in "Survey
Application" with some little adjustment.

For try my solution i have 2 TIBOTable and 2 TIB_QUERY into the same
application:
1) I have set all the DML announces and receives properties for TIB_QUERYs
2) I have set all the DML announces and receives properties on the
InternalDataset for TIBOTables

The "Announce" action seem to work fine for TIB_QUERY and also for TIBOTable
/ TIBOQuery.

The "Receive" action work fine for TIB_QUERY but don't work on
TIBOTable/TIBOQuery, then i have set the event
InternalDataset->OnDMLCacheReceivedItem to a function like this (code
(C++Builder 5) copied from IBA_BDataset.IMP module
TIB_BDataset.DefaultDMLCacheReceivedItem):

void __fastcall TForm1::MyTableDMLCacheReceivedItem(TIB_Dataset *ADataset,
const TIB_DMLCacheItem *ADMLCacheItem)
{
TIB_BDataset * IDataset = dynamic_cast<TIB_BDataset*>(ADataset);

if ( IDataset )
{
int ii;
String tmpStr;

tmpStr = "";
for (ii = 0; ii <= IDataset->KeyFields->ColumnCount - 1; ii++ )
{
if ( ii > 0 )
tmpStr = tmpStr + ";";

tmpStr = tmpStr + IDataset->KeyFields->Columns[ii]->FieldName;
}

if ( AnsiCompareText(ADMLCacheItem->KeyFieldNames, tmpStr) == 0 )
{
MyTable->Refresh();

/*******************
Commented out - this don't work for TIBOTable / TIBOQuery!!

IDataset->KeyFields->Values[ ADMLCacheItem->KeyFieldNames ] =
ADMLCacheItem->KeyFieldValues;

switch ( ADMLCacheItem->DMLCacheItemType )
{
case ditEdit:
IDataset->InvalidateBookmark( IDataset->KeyFields->RowData );
break;

case ditDelete:
IDataset->DeleteBufferBookmark( IDataset->KeyFields->RowData
);
break;

case ditInsert:
IDataset->InsertBufferBookmark( IDataset->KeyFields->RowData
);
break;
}
*************/
}
}
}

This solution it's seem to work fine if TIBOTable/TIBOQuery who receive the
notification are in dsBrowse State, there are some problem if State are
dsInsert or dsEdit (the Refresh() cause TIBOTable/TIBOQuery to cancel() the
work in progress).

Now i have a solution:
if ( MyTable->State == dsBrowse )
MyTable->Refresh();
else
FlagDoRefreshAfterPostCancel = true;

and make Refresh() in AfterPost or AfterCancel event.

But i have some other alternatives ?

Can i use these code:

switch ( ADMLCacheItem->DMLCacheItemType )
{
case ditEdit:
IDataset->InvalidateBookmark( IDataset->KeyFields->RowData );
break;

case ditDelete:
IDataset->DeleteBufferBookmark( IDataset->KeyFields->RowData
);
break;

case ditInsert:
IDataset->InsertBufferBookmark( IDataset->KeyFields->RowData
);
break;
}

and then call some method for align TDataset to the new buffer ?


Thank's in advance,
Enrico Raviglione.