XBase and Delphi C++ Builder TDataSet Behavior

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Installing and Using Apollo VCL >

XBase and Delphi C++ Builder TDataSet Behavior

Apollo is designed for dual-mode operation, where in one mode Apollo works as a true TDataSet descendent that fully respects TDataSet defined behavior. In addition, Apollo supports an "xBase" mode, which is fully compliant with xBase syntax and behaviour. These two modes or styles of programming - xBase and TDataSet - are not fully compatible. The behavior differs particularly in various ways, namely how EOF (end-of-file) is set, how records are appended, and the fact that xBase does not update Data Aware controls.

image\tip.gif The result of mixing the two modes is a hybrid that works haphazardly. We strongly recommend that users not mix the two styles of programming.

TApolloTable.SpeedMode

SpeedMode is the property that toggles Apollo between xBase and TDataSet mode. The property is called SpeedMode because running in xBase mode, Apollo calls the Apollo API directly without regard for updating the TDataSet buffering system, which in turn updates data aware controls. Speedmode is not to be confused with DisableControls and EnableControls, since those properties still require that the buffering be updated.

 

SpeedMode = False

(default)

Fully TDataSet compatible.

Data Aware controls behave as expected

VCL TDataSet buffering system fully updated.

SpeedMode = True

xBase-style syntax.

Data Aware controls are not updated

Disconnects from TDataSet buffering system

 

Borland's TDBGrid was not designed on the basis of xBase behaviour. TDBGrid works well with TDataSet and methods such as First, Last and Next. And Apollo fully supports this mode of development.

When Apollo operates in xBase mode, either by calling the API directy or by setting Speedmode to True, it follows the rules of xBase in all operations. For instance in xBase, you must skip past the last record before EOF is raised. Delphi TDataSet treats as being set when you are at the last record.

From the Delphi help

Test Eof (end-of-file) to determine if the cursor is positioned at the last record in a dataset. If Eof is True, the cursor is unequivocally on the last row in the dataset. Eof is True when an application:

Opens an empty dataset.

Calls a dataset’s Last method. // Not true for xBase (i.e. Speedmode = True)

Call a dataset’s Next method, and the method fails (because the cursor is already on the last row in the dataset).

Calls SetRange on an empty range or dataset.

In a nutshell, if you are using the VCL then you should stick to TDataSet/TApolloTable.

See Also

Using SpeedMode