Subject | [IBO] TIBO* "CacheDML - Refresh" after InternalDataset buffer syn cronization |
---|---|
Author | Enrico Raviglione |
Post date | 2002-02-23T08:48:04Z |
Hi Jason,
i use DML Caching with TIBO* how you have made in "Survey Application" with
some little adjustment in my derived TIBOTable/Query.
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 )
{
if ( MyTable->State == dsBrowse )
MyTable->Refresh();
else
FFlagDoRefreshInAfterPostCancelEvent = true;
/*******************
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.
When TIBOTable/TIBOQuery who receive the notification are in dsBrowse State
it make the Refresh() immediately, when the State are dsInsert or dsEdit the
Refresh() are stored into the flag and serviced in the OnAfterPost or
OnAfterCancel events.
For better performance and don't make a Refresh() for every changed record,
i have try to use this code but it seem don't work fine:
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;
}
the InternalDataset don't align the buffer of the TDataset then i see some
wrong record, there are some method for do this?
Thank's in advance,
Enrico Raviglione.
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
i use DML Caching with TIBO* how you have made in "Survey Application" with
some little adjustment in my derived TIBOTable/Query.
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 )
{
if ( MyTable->State == dsBrowse )
MyTable->Refresh();
else
FFlagDoRefreshInAfterPostCancelEvent = true;
/*******************
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.
When TIBOTable/TIBOQuery who receive the notification are in dsBrowse State
it make the Refresh() immediately, when the State are dsInsert or dsEdit the
Refresh() are stored into the flag and serviced in the OnAfterPost or
OnAfterCancel events.
For better performance and don't make a Refresh() for every changed record,
i have try to use this code but it seem don't work fine:
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;
}
the InternalDataset don't align the buffer of the TDataset then i see some
wrong record, there are some method for do this?
Thank's in advance,
Enrico Raviglione.
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/