SpeedMode

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Properties >

SpeedMode

Declaration

property SpeedMode: WordBool;

See Also

XBase and Delphi C++ Builder Behaviour

Description

TApolloTable can actually operate in two modes: TDataSet mode and SpeedMode

Set to True to speed up calls to the Skip, Replace, Go, GoTop, GoBottom, Append, AppendBlank, and others. This speed increase is achieved by NOT issuing an automatic internal Resync (same as a TDataSet.Refresh) after each call. This allows the developer to issue multiple sequential calls to Skip, Replace, and so on, and then, at the end of the entire process, set SpeedMode to False to force a Refresh of the data controls.

 

Setting SpeedMode to False (default setting) makes Apollo behave like a true TDataSet descendent and will automatically issue a refresh data buffers and will update all data-aware controls.

image\tip.gif Setting SpeedMode to True will cuase data-aware controls to not be updated with underlying data until SpeedMode is set to False.

Working with Speedmode

It is important to unerstand that TDataSet bookmarks will not be synchronized with the internal (Apollo) record pointer, using FieldByName( … ).As* to retrieve a field value may not be accurate. Instead, use TApolloTable. Get* methods (GetString, GetLogical, GetInteger, GetBinary, GetBlob, etc).

When SpeedMode is False, all of the Get* methods are basically mapped to a FieldByName(???).As* call, to insure correct field data is returned based on the current dataset bookmark.

image\tip.gif This SpeedMode property can be checked at run-time to verify if you are using TApolloTable in SpeedMode or not.

With the Apollo VCL 5.12 or later, when SpeedMode is True, calls to Next, Prior, MoveBy, First, and Last will work. Prior versions only supported calls to (Skip, GoTop, and GoBottom) under SpeedMope. Additionaly, calls to Append and AppendBlank are mapped directly to the Apollo sx_Append and sx_AppendBlank methods. These calls, however, do not set TApolloTable.State in dsInsert mode.

When SpeedMode is False, calls to to Append and AppendBlank behave like Insert and TApolloTable.State does get set to dsInsert.

Delphi Example

// Replace all CUST_NO field with sequential value

with ApTbl do

begin

 SpeedMode := True;

 GoTop; // Instead of First

 iCount := 0; 

 while not ApolloEof do // Instead of Eof

 begin 

         Inc( iCount ); 

         Replace( 'CUST_NO', R_INTEGER, @iCount ); // Instead of FieldByName

         Skip( 1 ); // Or Next

 end; 

 Commit; // Instead of Post

 SpeedMode := False; // Refresh controls

end;

C++Builder Example

// skip from top to bottom of the file as fast as possible

ApTbl->SpeedMode = TRUE;

ApTbl->GoTop();// Instead of First()

iCount = 0;

while (!ApTbl->ApolloEof) // Instead of Eof

{

 iCount++; 

 Replace( "CUST_NO", R_INTEGER, @iCount ); // Instead of FieldByName

 ApTbl->Skip( 1 ); // Instead of Next

}

ApTbl->Commit();// Instead of Post

ApTbl->SpeedMode = FALSE; // Refresh controls