What is TDataSet?

From InterBase
Jump to: navigation, search

Go Up to Understanding Datasets


TDataSet is the ancestor for all the dataset objects that you use in your applications. It defines a set of data fields, properties, events, and methods that are shared by all dataset objects. TDataSet is a virtualized dataset, meaning that many of its properties and methods are virtual or abstract. A virtual method is a function or procedure declaration where the implementation of that method can be (and usually is) overridden in descendant objects. An abstract method is a function or procedure declaration without an actual implementation. The declaration is a prototype that describes the method (and its parameters and return type, if any) that must be implemented in all descendant dataset objects, but that might be implemented differently by each of them.

Because TDataSet contains abstract methods, you cannot use it directly in an application without generating a runtime error. Instead, you either create instances of TDataSet’s descendants, such as TIBCustomDataSet, TIBDataSet, TIBTable, TIBQuery, TIBStoredProc, and TClientDataSet, and use them in your application, or you derive your own dataset object from TDataSet or its descendants and write implementations for all its abstract methods.

Nevertheless, TDataSet defines much that is common to all dataset objects. For example, TDataSet defines the basic structure of all datasets: an array of TField components that correspond to actual columns in one or more database tables, lookup fields provided by your application, or calculated fields provided by your application. For more information about TField components, see “Working with field components” in the Delphi Developer’s Guide.

The following topics are discussed in this chapter: