Database access layer The db unit provides the basis for all database access mechanisms. It introduces abstract classes, on which all database access mechanisms are based: representing a set of records from a database, which represents the contents of a field in a record, which acts as an event distributor on behalf of a dataset and which can be used to parametrize queries. The databases connections themselves are abstracted in the class. Maximum data buffers count for dataset Maximum size of string fields Array of characters mapping a boolean to Y/N SQL statement delimiter token characters Large (64-bit) integer Pointer to Large (64-bit) integer Type to access string field content buffers as an array of characters Current state of the dataset

TDataSetState describes the current state of the dataset. During it's lifetime, the dataset's state is described by these enumerated values.

Some state are not used in the default TDataset implementation, and are only used by certain descendents.

The dataset is not active. No data is available. The dataset is active, and the cursor can be used to navigate the data. The dataset is in editing mode: the current record can be modified. The dataset is in insert mode: the current record is a new record which can be edited. The dataset is calculating the primary key. The dataset is calculating it's calculated fields. The dataset is filtering records. The dataset is showing the new values of a record. The dataset is showing the old values of a record. The dataset is showing the current values of a record. The dataset is open, but no events are transferred to datasources. The dataset is calculating it's internally calculated fields. The dataset is currently opening, but is not yet completely open. Various events that are sent to datasources TDataEvent describes the various events that can be sent to instances connected to a instance. A field value changed The current record changed The dataset property changed The dataset scrolled to another record The layout properties of one of the fields changed The record is being updated The dataset state is updated The browse mode is being checked Unused Event sent when the list of fields of a dataset changes Event sent whenever a control connected to a field should be focused Unused Unused Unused Unused Record update status TUpdateStatus determines the current state of the record buffer, if updates have not yet been applied to the database. Record is unmodified Record exists in the database but is locally modified Record does not yet exist in the database, but is locally inserted Record exists in the database, but is locally deleted. Set of update states TUpdateStatusSet is a set of values. Update mode TUpdateMode determines how the WHERE clause of update queries for SQL databases should be constructed. Use all old field values Use only old field values of modified fields Only use key fields in the where clause. Resolver response code TResolverResponse is used to indicate what should happen to a pending change that could not be resolved. It is used in callbacks. Skip the current update, leave it in the change log Abor the whole update process Merge the update with existing changes on the server Replace the update with new values applied by the event handler Ignore the error and remove update from change log What to odo with fields when applying updates TProviderFlag describes how the field should be used when applying updates from a dataset to the database. Each field of a has one or more of these flags. Changes to the field should be propagated to the database. Field should be used in the WHERE clause of an update statement in case of upWhereChanged. Field is a key field and used in the WHERE clause of an update statement Set of flags TProviderFlags is used for the property to describe the role of the field when applying updates to a database. Collection of TFieldDef instances. TFieldDefs is used by each TDataset instance to keep a description of the data that it manages; for each field in a record that makes up the underlying data, the TFieldDefs instance keeps an instance of TFieldDef that describes the field's contents. For any internally calculated fields of the dataset, a TFieldDef instance is kept as well. This collection is filled by descendent classes of TDataset as soon as the dataset is opened; it is cleared when the dataset closes. After the collection was populated, the dataset creates TField instances based on all the definitions in the collections. If persistent fields were used, the contents of the fielddefs collection is compared to the field components that are present in the dataset. If the collection contains more field definitions than Field components, these extra fields will not be available in the dataset. Provide access to the contents of a single field in a record

TField is an abstract class that defines access methods for a field in a record, controlled by a instance. It provides methods and properties to access the contents of the field in the current record. Reading one of the AsXXX properties of TField will access the field contents and return the contents as the desired type. Writing one of the AsXXX properties will write a value to the buffer represented by the TField instance.

TField is an abstract class, meaning that it should never be created directly. TDataset instances always create one of the descendent classes of TField, depending on the type of the underlying data.

Collection of instances TFields mimics a TCollection class for the Fields property of instance. Since is a descendent of TComponent, it cannot be an item of a collection, and must be managed by another class. Base class for records-based data-access

TDataset is the main class of the db unit. This abstract class provides all basic funtionality to access data stored in tabular format: The data consists of records, and the data in each record is organised in several fields.

TDataset has a buffer to cache a few records in memory, this buffer is used by TDatasource to create the ability to use data-aware components.

TDataset is an abstract class, which provides the basic functionality to access, navigate through the data and - in case read-write access is available, edit existing or add new records.

TDataset is an abstract class: it does not have the knowledge to store or load the records from whatever medium the records are stored on. Descendants add the functionality to load and save the data. Therefor TDataset is never used directly, one always instantiates a descendent class.

Initially, no data is available: the dataset is inactive. The Open method must be used to fetch data into memory. After this command, the data is available in memory for browsing or editing purposes: The dataset is active (indicated by the property). Likewise, the Close method can be used to remove the data from memory. Any changes not yet saved to the underlying medium will be lost.

Data is expected to be in tabular format, where each row represents a record. The dataset has an idea of a cursor: this is the current position of the data cursor in the set of rows. Only the data of the current record is available for display or editing purposes. Through the Next, Prev, First and Last methods, it is possible to navigate through the records. The EOF property will be True if the last row has been reached. Likewise, the BOF property will return True if the first record in the dataset has been rechaed when navigating backwards. If both proprties are empty, then there is no data available. For dataset descendents that support counting the number of records, the RecordCount will be zero.

The Append and Insert methods can be used to insert new records to the set of records. The statement is used to delete the current record, and the Edit command must be used to set the dataset in editing mode: the contents of the current record can then be changed. Any changes made to the current record (be it a new or existing record) must be saved by the Post method, or can be undone using the Cancel method.

The data in the various fields properties is available through the Fields array property, giving indexed access to all the fields in a record. The contents of a field is always readable. If the dataset is in one of the editing modes, then the fields can also be written to.

Base class for connecting a FreePascal application to an external Database engine

TDatabase is a component whose purpose is to provide a connection to an external database engine, not to provide the database itself. This class provides generic methods for attachment to databases and querying their contents; the details of the actual connection are handled by database-specific components (such as SQLDb for SQL-based databases, or DBA for DBASE/FoxPro style databases).

Like , TDatabase is an abstract class. It provides methods to keep track of datasets connected to the database, and to close these datasets when the connection to the database is closed. To this end, it introduces a Connected boolean property, which indicates whether a connection to the database is established or not. The actual logic to establish a connection to a database must be implemented by descendent classes.

Component representing the link between a local (GUI) component and a dataset TDatasource is a mediating component: it handles communication between any DB-Aware component (often edit controls on a form) and a instance. Any database aware component should never communicate with a dataset directly. Instead, it should communicate with a instance. The TDataset instance will communicate with the TDatasource instance, which will notify every component attached to it. Vice versa, any component that wishes to make changes to the dataset, will notify the TDatasource instance, which will then (if needed) notify the TDataset instance. The datasource can be disabled, in which case all communication between the dataset and the DB-AWare components is suspended until the datasource is again enabled. Represents the link between a detail data source and a master datasource. TDetailDataLink handles the communication between a detail dataset and the master datasource in a master-detail relationship between datasets. It should never be used in an application, and should only be used by component writers that wish to provide master-detail functionality for TDataset descendents. Encapsulate a transaction TDBTransaction encapsulates a SQL transaction. It is an abstract class, and should be used by component creators that wish to encapsulate transactions in a class. The TDBTransaction class offers functionality to refer to a instance, and to keep track of TDataset instances which are connected to the transaction. Base class for all database-related errors EDatabaseError is the base class from which database-related exception classes should derive. It is raised by the call. Error raised when updating data during a post operation. EupdateError is an exception used by the TProvider database support. It should never be raised directly. Create a new EUpdateError instance Create instantiates a new EUpdateError object and populates the various properties with the NativeError, Context, ErrCode and PrevError parameters. The E parameter is the actual exception that occurred while the update operation was attempted. The exception object E will be freed if the EUpdateError instance is freed. Native error description. Context in which error occurred, if applicable Numerical error code, if applicable Previous error number Actual exception object. Free the EupdateError instance Destroy frees the original exception object (if there was one) and then calls the inherited destructor. If the original exception object was already freed, an error will occur. Context in which exception occurred. A description of the context in which the original exception was raised. Numerical error code. ErrorCode is a numerical error code, provided by the native data access layer, to describe the error. It may or not be filled. Original exception object, if available. OriginalException is the original exception object as raised by the database access layer. It may or may not be available. Previous error number PreviousError is used to order the errors which occurred during an update operation. Field data type description TFieldType indicates the type of a underlying data, in the DataType property. Unknown data type String data value (ansistring) Small integer value(1 byte, signed) Regular integer value (4 bytes, signed) Word-sized value(2 bytes, unsigned) Boolean value Floating point value (double) Currency value (4 decimal points) Binary Coded Decimal value (DECIMAL and NUMERIC SQL types) Date value Time value Date/Time (timestamp) value Array of bytes value, fixed size (unytped) Array of bytes value, variable size (untyped) Auto-increment integer value (4 bytes) Binary data value (no type, no size) Binary text data (no size) Graphical data value (no size) Formatted memo ata value (no size) Paradox OLE field data (no size) Paradox OLE field data Binary typed data (no size) Cursor data value (no size) Fixed character array (string) Widestring (2 bytes per character) Large integer value (8-byte) ADT value Array data Reference data Dataset data (blob) Oracle BLOB data Oracle CLOB data Variant data value interface data value Dispatch data value GUID data value Timestamp data value Formatted BCD (Binary Coded Decimal) value. Fixed wide character date (2 bytes per character) Widestring memo data Array type with TFieldType as index type. TFieldMap is no longer used. Alias for TDateTime type TDateTimeAlias is no longer used. Pointer to TDateTimeRec record Date/Time record TDateTimeRec was used by older implementations to store date/time values. Newer implementations use the TDateTime. This type should no longer be used. Date value Time value Date/time value Field attributes TFieldAttribute is used to denote some attributes of a field in a database. It is used in the Attributes property of . Field is a hidden column (used to construct a unique key) Field is read-only Field is required Field is a link field for other datasets Field has no original name Fixed length field Set of TFieldAttribute values. TFieldAttributes is used in the property to denote additional attributes of the underlying field. Named collection item NamedItem is a TCollectionItem descendent which introduces a Name property. It automatically returns the value of the Name property as the value of the DisplayName property. DisplayName Name Display name DisplayName is declared in TCollectionItem, and is made public in TNamedItem. The value equals the value of the Name property. Name Name of the item Name is the name of the item in the collection. This property is also used as the vaulue for the DisplayName property. If the TNamedItem item is owned by a collection, then the name must be unique, i.e. each Name value may appear only once in the collection. DisplayName Definition collection TDefCollection is a parent class for the and collections: It holds a set of named definitions on behalf of a component. To this end, it introduces a dataset property, and a mechanism to notify the dataset of any updates in the collection. It is supposed to hold items of class , so the method can find items by named. Instantiate a new TDefCollection instance. Create saves the ADataset and AOwner components in local variables for later reference, and then calls the inherited Create with AClass as a parameter. AClass should at least be of type TNamedItem. ADataset is the dataset on whose behalf the collection is managed. AOwner is the owner of the collection, normally this is the form or datamodule on which the dataset is dropped. Dataset to manage definitions for Owner of the items in the collection. Item class for Add call. Find an item by name Find searches for an item in the collection with name AName and returns the item if it is found. If no item with the requested name is found, Nil is returned. The search is performed case-insensitive. If no item with matching name is found, Nil is returned. Item matching AName Name to search for in collection. Return a list of all names in the collection GetItemNames fills List with the names of all items in the collection. It clears the list first. If List is not a valid TStrings instance, an exception will occur. List to fill with the names of the items in the collection. Find location of item by name IndexOf searches in the collection for an item whose Name property matches AName and returns the index of the item if it finds one. If no item is found, -1 is returned. The search is performed case-insensitive. Index of the found item, or -1 if none was found. Name to look for. (case insensitive) Dataset this collection manages definitions for. Dataset is the dataset this collection manages definitions for. It must be supplied when the collection is created and cannot cgange during the lifetime of the collection. Has one of the items been changed Changed indicates whether the collection has changed: an item was added or removed, or one of the properties of the items was changed. Class to describe one field in a record in a dataset TFieldDef is used to describe the fields that are present in the data underlying the dataset. For each field in the underlying field, an TFieldDef instance is created when the dataset is opened. This class offers almost no methods, it is mainly a storage class, to store all relevant properties of fields in a record (name, data type, size, required or not, etc.) Constructor for TFieldDef.

Create is the constructor for the TFieldDef class.

If a simple call is used, with a single argument ACollection, the inherited Create is called and the Field number is set to the incremented current index.

If the more complicated call is used, with multiple arguments, then after the inherited Create call, the Name, datatype, size, precision, FieldNo and the Required property are all set according to the passsed arguments.

If a duplicate name is passed, then an exception will occur. Name datatype size precision FieldNo Required
TFieldDefs instance to which to append the definition, or Nil Owner of the fielddef. Name of the field Data type of the field Storage size for the field contents, or zero for fixed-size fields Is the fields required or not Number of the field Free the TFieldDef instance Destroy destroys the TFieldDef instance. It simply calls the inherited destructor. Assign the contents of one TFieldDef instance to another. Assign assigns all published properties of APersistent to the current instance, if APersistent is an instance of class TFieldDef. If APersistent is not of class , then an exception will be raised. TFieldDef instance to copy data from. Create TField instance based on definitions in current TFieldDef instance.

CreateField determines, based on the DataType what descendent it should create, and then returns a newly created instance of this class. It sets the appropriate defaults for the Size, FieldName, FieldNo, Precision, ReadOnly and Required properties of the newly created instance. It should nver be necessary to use this call in an end-user program, only TDataset descendent classes should use this call.

The newly created field is owned by the component instance passed in the AOwner parameter.

The array is used to determine which TField Descendent class should be used when creating the TField instance, but descendents of TDataset may override the values in that array.

Instance of TField corresponding to the field definition Owner for the new TField instance. TField class used for this fielddef FieldClass is the class of the TField instance that is created by the CreateField class. The return value is retrieved from the TDataset instance the TFieldDef instance is associated with. If there is no TDataset instance available, the return value is Nil CreateField Field number FieldNo is the number of the field in the data structure where the dataset contents comes from, for instance in a DBase file. If the underlying data layer does not support the concept of field number, a sequential number is assigned. Is this a definition of an internally calculated field ? Internalcalc is True if the fielddef instance represents an internally calculated field: for internally calculated fields, storage must be rovided by the underlying data mechanism. Is the field required ? Required is set to True if the field requires a value when posting data to the dataset. If no value was entered, the dataset will raise an excepion when the record is posted. The Required property is usually initialized based on the definition of the field in the underlying database. For SQL-based databases, a field declared as NOT NULL will result in a Required property of True. Additional attributes of the field. Attributes contain additional attributes of the field. It shares the faRequired attribute with the Required property. Data type for the field DataType contains the data type of the field's contents. Based on this property, the FieldClass property determines what kind of field class mustbe used to represent this field. Precision used in BCD (Binary Coded Decimal) fields Precision is the number of digits used in a BCD (Binary Coded Decimal) field. It is not the number of digits after the decimal separator, but the total number of digits. Size of the buffer needed to store the data of the field Size indicates the size of the buffer needed to hold data for the field. For types with a fixed size (such as integer, word or data/time) the size can be zero: the buffer mechaism reserves automatically enough heap memory. For types which can have various sizes (blobs, string types), the Size property tells the buffer mechanism how many bytes are needed to hold the data for the field. For BCD fields, the size property indicates the number of decimals after the decimal separator. Create a new instance of TFieldDefs Create is used to create a new instance of TFieldDefs. The ADataset argument contains the dataset instance for which the collection contains the field definitions. Dataset for which to maintain field definitions. Add a new field definition to the collection. Add adds a new item to the collection and fills in the Name, DataType, Size and Required properties of the newly added item with the provided parameters. If an item with name AName already exists in the collection, then an exception will be raised. Value for the Name property of the new item. Value for the DataType property of the new item. Value for the Size property of the new item. Value for the Required property of the new item. Add new TFieldDef AddFieldDef creates a new TFieldDef item and returns the instance. Newly created TFieldDef instance. Copy all items from one dataset to another Assign simply calls inherited Assign with the FieldDefs argument. FieldDefs to copy items from Find item by name Find simply calls the inherited to find an item with name AName and typecasts the result to TFieldDef. TFieldDef instance with name AName or Nil Name to search for Force update of definitions Update notifies the dataset that the field definitions are updated, if it was not yet notified. Create a unique field name starting from a base name MakeNameUnique uses AName to construct a name of a field that is not yet in the collection. If AName is not yet in the collection, then AName is returned. if a field definition with field name equal to AName already exists, then a new name is constructed by appending a sequence number to AName till the resulting name does not appear in the list of field definitions. Unique name, based on AName Start of fieldname. Should field instances be created for hidden fields HiddenFields determines whether a field is created for fielddefs that have the faHiddenCol attribute set. If set to False (the default) then no TField instances will be created for hidden fields. If it is set to True, then a TField instance will be created for hidden fields. Indexed access to the fielddef instances Items provides zero-based indexed access to all TFieldDef instances in the collection. The index must vary between 0 and Count-1, or an exception will be raised. Zero-based Index of field definition Kind of field TFieldKind indicates the type of a TField instance. Besides TField instances that represent fields present in the underlying data records, there can also be calculated or lookup fields. To distinguish between these kind of fields, TFieldKind is introduced. Field represents actual data in the underlying data structure. The field is calculated on the fly. The field is a lookup field. Field is calculated but stored in an underlying buffer. Set of TFieldKind values TFieldKinds is a set of values. It is used internally by the classes of the DB unit. Noification handler prototype TFieldNotifyEvent is a prototype for the event handlers in the class. It's Sender parameter is the field instance that triggered the event. Field that triggered the event. Event handler to get field content TFieldGetTextEvent is the prototype for the event handler. It should be used when the text of a field requires special formatting. The event handler should return the contents of the field in formatted form in the AText parameter. The DisplayText is True if the text is used for displaying purposes or is False if it will be used for editing purposes. Field instance whose text should be returned. The result of the event handler should be returned in this parameter. Is the result used for display purposes ? Event handler to get field content TFieldSetTextEvent is the prototype for an event handler used to set the contents of a field based on a user-edited text. It should be used when the text of a field is entered with special formatting. The event handler should set the contents of the field based on the formatted text in the AText parameter. Field which invoked the event handler User-supplied value for the field's contents Pointer to a TField instance Set of valid characters for the field contents TFieldChars is a type used in the property. It's a simple set of characters. Pointer to TLookupListRec record Record to store lookup results TLookupListRec is used by lookup fields to store lookup results, if the results should be cached. Its two fields keep the key value and associated lookup value. Key value Lookup value associated to Key. Class to manage lookup list values TLookupList is a list object used for storing values of lookup operations by lookup fields. There should be no need to create an instance of TLookupList manually, the TField instance will create an instance of TlookupList on demand. Create a new instance of TLookupList. Create sets up the necessary structures to manage a list of lookup values for a lookup field. Free a TLookupList instance from memory Destroy frees all resources (mostly memory) allocated by the lookup list, and calls then the inherited destructor. Add a key, value pair to the list Add will add the value AValue to the list and associate it with key AKey. The same key cannot be added twice. Lookup key Lookup value Remove all key, value pairs from the list Clear removes all keys and associated values from the list. Find the first key that matches a value FirstKeyByValue does a reverse lookup: it returns the first key value in the list that matches the AValue value. If none is found, Null is returned. This mechanism is quite slow, as a linear search is performed. If no key is found, Null is returned. First key that has AValue associated with it. Value to match key with. Look up value based on a key ValueOfKey does a value lookup based on a key: it returns the value in the list that matches the AKey key. If none is found, Null is returned. This mechanism is quite slow, as a linear search is performed. Resulting value or Null Key to find associated value for. Convert values to stringlist ValuesToStrings converts the list of values to a stringlist, so they can be used e.g. in a drop-down list. Stringlist to put values in. Create a new TField instance Create creates a new TField instance and sets up initial values for the fields. TField is a component, and AOwner will be used as the owner of the TField instance. This usually will be the form or datamodule on which the dataset was placed. There should normally be no need for a programmer to create a Tfield instance manually. The method will create the necessary TField instances, if none had been creaed in the designer. Owner of the field. Destroy the TField instance Destroy cleans up any structures set up by the field instance, and then calls the inherited destructor. There should be no need to call this method under normal circumstances: the dataset instance will free any TField instances it has created when the dataset was opened. Copy properties from one TField instance to another Assign is overridden by TField to copy the field value (not the field properties) from Source if it exists. If Source is Nil then the value of the field is cleared. If Source is not a TField instance, then an exception will be raised. Source field to copy value from. Assign value of a variant record to the field.

AssignValue assigns the value of a "array of const" record AValue (of type TVarRec) to the field's value. If the record contains a TPersistent instance, it will be used as argument for the Assign to the field.

The dataset must be in edit mode to execute this method.

If the AValue contains an unsupported value (such as a non-nil pointer) then an exception will be raised. If the dataset is not in one of the edit modes, then executing this method will raise an exception.
Value to assign to the field Clear the field contents.

Clear clears the contents of the field. After calling this method the value of the field is Null and IsNull returns True.

The dataset must be in edit mode to execute this method.

If the dataset is not in one of the edit modes, then executing this method will raise an exception.
Set focus to the first control connected to this field. FocusControl will set focus to the first control that is connected to this field. If the control cannot receive focus, then this method will raise an exception. Get the data from this field GetData is used internally by TField to fetch the value of the data of this field into the data buffer pointed to by Buffer. If it returns False if the field has no value (i.e. is Null). If the NativeFormat parameter is true, then date/time formats should use the TDateTime format. It should not be necessary to use this method, instead use the various 'AsXXX' methods to access the data. No validity checks are performed on Buffer: it should point to a valid memory area, and should be large enough to contain the value of the field. Failure to provide a buffer that matches these criteria will result in an exception. True if data is available. Buffer to store field contents in. Return date/time values in native (TDateTime) format. Is the field a BLOB field (untyped data of indeterminate size). IsBlob returns True if the field is one of the blob field types. The TField implementation returns false. Only one of the blob-type field classes override this function and let it return True. None. True if the field is a BLOB field, False otherwise. Check whether a character is valid input for the field

IsValidChar checks whether InputChar is a valid characters for the current field. It does this by checking whether InputChar is in the set of characters sepcified by the property. The ValidChars property will be initialized to a correct set of characters by descendent classes. For instance, a numerical field will only accept numerical characters and the sign and decimal separator characters.

Descendent classes can override this method to provide custom checks. The ValidChars property can be set to restrict the list of valid characters to a subset of what would normally be available.

True if InputChar is in the set ValidChars. Character to check Refresh the lookup list RefreshLookupList fills the lookup list for a lookup fields with all key, value pairs found in the lookup dataset. It will open the lookup dataset if needed. The lookup list is only used if the property is set to True. If the values of the various lookup properties is not correct or the lookup dataset cannot be opened, then an exception will be raised. LookupDataset LookupKeyFields LookupResultField Save the field data

SetData saves the value of the field data in Buffer to the dataset internal buffer. The Buffer pointer should point to a memory buffer containing the data for the field in the correct format. If the NativeFormat parameter is true, then date/time formats should use the TDateTime format.

There should normally not be any need to call SetData directly: it is called by the various setter methods of the AsXXX properties of TField.

No validity checks are performed on Buffer: it should point to a valid memory area, and should be large enough to contain the value of the field. Failure to provide a buffer that matches these criteria will result in an exception.
Buffer to copy field value from Is the provided data in native format Set the field data type SetFieldType does nothing, but it can be overridden by descendent classes to provide special handling when the field type is set. DataType for the field Validate the data buffer Validate is called by SetData prior to writing the data from Buffer to the dataset buffer. It will call the event handler, if one is set, to allow the application programmer to program additional checks. Buffer with the data to be validated Access the field's contents as a BCD (Binary coded Decimal) AsBCD can be used to read or write the contents of the field as a BCD value (Binary Coded Decimal). If the native type of the field is not BCD, then an attempt will be made to convert the field value from the native format to a BCD value when reading the field's content. Likewise, when writing the property, the value will be converted to the native type of the field (if the value allows it). Therefor, when reading or writing a field value for a field whose native data type is not a BCD value, an exception may be raised. Access the field's contents as a Boolean value. AsBoolean can be used to read or write the contents of the field as a boolean value. If the native type of the field is not Boolean, then an attempt will be made to convert the field value from the native format to a boolean value when reading the field's content. Likewise, when writing the property, the value will be converted to the native type of the field (if the value allows it). Therefor, when reading or writing a field value for a field whose native data type is not a Boolean value (for instance a string value), an exception may be raised. Access the field's contents as a Currency value. AsBoolean can be used to read or write the contents of the field as a currency value. If the native type of the field is not Boolean, then an attempt will be made to convert the field value from the native format to a currency value when reading the field's content. Likewise, when writing the property, the value will be converted to the native type of the field (if the value allows it). Therefor, when reading or writing a field value for a field whose native data type is not a currency-compatible value (dates or string values), an exception may be raised. Access the field's contents as a TDateTime value. AsDateTime can be used to read or write the contents of the field as a TDateTime value (for both date and time values). If the native type of the field is not a date or time value, then an attempt will be made to convert the field value from the native format to a TDateTime value when reading the field's content. Likewise, when writing the property, the value will be converted to the native type of the field (if the value allows it). Therefor, when reading or writing a field value for a field whose native data type is not a TDateTime-compatible value (dates or string values), an exception may be raised. Access the field's contents as a floating-point (Double) value. AsFloat can be used to read or write the contents of the field as a floating-point value (of type double, i.e. with double precision). If the native type of the field is not a floating-point value, then an attempt will be made to convert the field value from the native format to a floating-point value when reading the field's content. Likewise, when writing the property, the value will be converted to the native type of the field (if the value allows it). Therefor, when reading or writing a field value for a field whose native data type is not a floating-point-compatible value (string values for instance), an exception may be raised. Access the field's contents as a 32-bit signed integer (longint) value.

AsLongint can be used to read or write the contents of the field as a 32-bit signed integer value (of type longint). If the native type of the field is not a longint value, then an attempt will be made to convert the field value from the native format to a longint value when reading the field's content. Likewise, when writing the property, the value will be converted to the native type of the field (if the value allows it). Therefor, when reading or writing a field value for a field whose native data type is not a 32-bit signed integer-compatible value (string values for instance), an exception may be raised.

This is an alias for the .

Access the field's contents as a 64-bit signed integer (longint) value. AsLargeInt can be used to read or write the contents of the field as a 64-bit signed integer value (of type Int64). If the native type of the field is not an Int64 value, then an attempt will be made to convert the field value from the native format to an Int64 value when reading the field's content. Likewise, when writing the property, the value will be converted to the native type of the field (if the value allows it). Therefor, when reading or writing a field value for a field whose native data type is not a 64-bit signed integer-compatible value (string values for instance), an exception may be raised. Access the field's contents as a 32-bit signed integer (longint) value. AsInteger can be used to read or write the contents of the field as a 32-bit signed integer value (of type Integer). If the native type of the field is not an integer value, then an attempt will be made to convert the field value from the native format to a integer value when reading the field's content. Likewise, when writing the property, the value will be converted to the native type of the field (if the value allows it). Therefor, when reading or writing a field value for a field whose native data type is not a 32-bit signed integer-compatible value (string values for instance), an exception may be raised. Access the field's contents as an AnsiString value. AsString can be used to read or write the contents of the field as an AnsiString value. If the native type of the field is not an ansistring value, then an attempt will be made to convert the field value from the native format to a ansistring value when reading the field's content. Likewise, when writing the property, the value will be converted to the native type of the field (if the value allows it). Therefor, when reading or writing a field value for a field whose native data type is not an ansistring-compatible value, an exception may be raised. Access the field's contents as a WideString value. AsWideString can be used to read or write the contents of the field as a WideString value. If the native type of the field is not a widestring value, then an attempt will be made to convert the field value from the native format to a widestring value when reading the field's content. Likewise, when writing the property, the value will be converted to the native type of the field (if the value allows it). Therefor, when reading or writing a field value for a field whose native data type is not a widestring-compatible value, an exception may be raised. Access the field's contents as a Variant value. AsVariant can be used to read or write the contents of the field as a Variant value. If the native type of the field is not a Variant value, then an attempt will be made to convert the field value from the native format to a variant value when reading the field's content. Likewise, when writing the property, the value will be converted to the native type of the field (if the value allows it). Therefor, when reading or writing a field value for a field whose native data type is not a variant-compatible value, an exception may be raised. Not used: dictionary information AttributeSet was used in older Delphi versions to store data dictionary information for use in data-aware controls at design time. Not used in FreePascal (or newer Delphi versions); kept for Delphi compatibility. Is the field a calculated field ? Calculated is True if the FieldKind is fkCalculated. Setting the property wil result in FieldKind being set to fkCalculated (for a value of True) or fkData. This property should be considered read-only. Can the field's contents be modified. CanModify is True if the field is not read-only and the dataset allows modification. Current value of the field CurValue returns the current value of the field as a variant. Dataset this field belongs to Dataset contains the dataset this field belongs to. Writing this property will add the field to the list of fields of a dataset, after removing if from the list of fields of the dataset the field was previously assigned to. It should under normal circumstnces never be necessary to set this property, the TDataset code will take care of this. Size of the field's data DataSize is the memory size needed to store the field's contents. This is different from the Size property which declares a logical size for datatypes that have a variable size (such as string fields). For BLOB fields, use the property to get the size of the field's contents for the current record.. The data type of the field. Datatype indicates the type of data the field has. This property is initialized when the dataset is opened or when persistent fields are created for the dataset. Instead of checking the class type of the field, it is better to check the Datatype, since the actual class of the TField instance may differ depending on the dataset. User-readable fieldname

DisplayName is the name of the field as it will be displayed to the user e.g. in grid column headers. By default it equals the FieldName property, unless assigned another value.

The use of this property is deprecated. Use DisplayLabel instead.

Formatted field value DisplayText returns the field's value as it should be displayed to the user, with all necessary formatting applied. Controls that should display the value of the field should use DisplayText instead of the property, which does not take into account any formatting. Number of the field in the record FieldNo is the position of the field in the record. It is a 1-based index and is initialized when the dataset is opened or when persistent fields are created for the dataset. Is the field an indexed field ? IsIndexField is true if the field is an indexed field. By default this property is False, descendents of can change this to True. Is the field empty IsNull is True if the field does not have a value. If the underlying data contained a value, or a value is written to it, IsNull will return False. After is called or Clear is called then IsNull will return True. Is the field a lookup field Lookup is True if the FieldKind equals fkLookup, False otherwise. Setting the Lookup property will switch the FieldKind between the fkLookup and fkData. The new value of the field NewValue returns the new value of the field. The FPC implementation of does not yet support this. Offset of the field's value in the dataset buffer Offset is the location of the field's contents in the dataset memory buffer. It is read-only and initialized by the dataset when it is opened. Logical size of the field Size is the declared size of the field for datatypes that can have variable size, such as string types, BCD types or array types. To get the size of the storage needed to store the field's content, the DataSize should be used. For blob fields, the current size of the data is not guaranteed to be present. DataSize Text representation of the field Text can be used to retrieve or set the value of the value as a string value for editing purposes. It will trigger the event handler if a handler was specified. For display purposes, the property should be used. Controls that should display the value in a textual format should use text whenever they must display the text for editing purposes. Inversely, when a control should save the value entered by the user, it should write the contents to the Text property, not the AsString property, this will invoke the event handler, if one is set. Characters that are valid input for the field's content ValidChars is a property that is initialized by descendent classes to contain the set of characters that can be entered in an edit control which is used to edit the field. Numerical fields will set this to a set of numerical characters, string fields will set this to all possible characters. It is possible to restrict the possible input by setting this property to a subset of all possible characters (for example, set it to all uppercase letters to allow the user to enter only uppercase characters. TField itself does not enforce the validity of the data when the content of the field is set, an edit control should check the validity of the user input by means of the IsValidChar function. Value of the field as a variant value

Value can be used to read or write the value of the field as a Variant value. When setting the value, the value will be converted to the actual type of the field as defined in the underlying data. Likewise, when reading the value property, the actual field value will be converted to a variant value. If the field does not contain a value (when IsNull returns True), then Value will contain Null.

It is not recommended to use the Value property: it should only be used when the type of the field is unknown. If the type of the field is known, it is better to use one of the AsXXX properties, which will not only result in faster code, but will also avoid strange type conversions.

Old value of the field OldValue returns the value of the field prior to an edit operation. This feature is currently not supported in FPC. List of lookup values LookupList contains the list of key, value pairs used when caching the possible lookup values for a lookup field. The list is only valid when the LookupCache property is set to True. It can be refreshed using the RefreshLookupList method. Alignment for this field Alignment contains the alignment that UI controls should observe when displaying the contents of the field. Setting the property at the field level will make sure that all DB-Aware controls will display the contents of the field with the same alignment. Custom constraint for the field's value

CustomConstraint may contain a constraint that will be enforced when the dataset posts it's data. It should be a SQL-like expression that results in a True or False value. Examples of valid constraints are:

Salary < 10000
YearsEducation < Age

If the constraint is not satisfied when the record is posted, then an exception will be raised with the value of ConstraintErrorMessage as a message.

This feature is not yet implemented in FPC.

Message to display if the CustomConstraint constraint is violated.

ConstraintErrorMessage is the message that should be displayed when the dataset checks the constraints and the constraint in is violated.

This feature is not yet implemented in FPC.

Default value for the field

DefaultValue can be set to a value that should be entered in the field whenever the or methods are executed. It should contain a valid SQL expression that results in the correct type for the field.

This feature is not yet implemented in FPC.

Name of the field for display purposes

DisplayLabel is the name of the field as it will be displayed to the user e.g. in grid column headers. By default it equals the FieldName property, unless assigned another value.

Width of the field in characters DisplayWidth is the width (in characters) that should be used by controls that display the contents of the field (such as in grids or lookup lists). It is initialized to a default value for most fields (e.g. it equals Size for string fields) but can be modified to obtain a more appropriate value for the field's expected content. The kind of field. FieldKind indicates the type of the TField instance. Besides TField instances that represent fields present in the underlying data records, there can also be calculated or lookup fields. This property determines what kind of field the TField instance is. Name of the field FieldName is the name of the field as it is defined in the underlying data structures (for instance the name of the field in a SQL table, DBAse file, or the alias of the field if it was aliased in a SQL SELECT statement. It does not always equal the Name property, which is the name of the TField component instance. The Name property will generally equal the name of the dataset appended with the value of the FieldName property. Does the field have any constraints defined HasConstraints will contain True if one of the CustomConstraint or ImportedConstraint properties is set to a non-empty value. CustomConstraint ImportedConstraint Index of the field in the list of fields Index is the name of the field in the list of fields of a dataset. It is, in general, the (0-based) position of the field in the underlying datas structures, but this need not always be so. The property should be used for that. Constraint for the field value on the level of the underlying database ImportedConstraint contains any constraints that the underlying data engine imposes on the values of a field (usually in an SQL CONSTRAINT) clause. Whether this field is filled with appropriate data depends on the implementation of the descendent. Key fields to use when looking up a field value. KeyFields should contain a semi-colon separated list of field names from the lookupfield's dataset which will be matched to the fields enumerated in LookupKeyFields in the dataset pointed to by the LookupDataset property. LookupKeyFields LookupDataset Should lookup values be cached LookupCache is by default False. If it is set to True then a list of key, value pairs will be created from the LookupKeyFields in the dataset pointed to by the LookupDataset property. The list of key, value pairs is available through the property. LookupKeyFields LookupDataset Dataset with lookup values LookupDataset is used by lookup fields to fetch the field's value. The LookupKeyFields property is used as a list of fields to locate a record in this dataset, and the value of the LookupResultField field is then used as the value of the lookup field. KeyFields LookupKeyFields LookupResultField LookupCache Names of fields on which to perform a locate LookupKeyFields should contain a semi-colon separated list of field names from the dataset pointed to by the LookupDataset property. These fields will be used when locating a record corresponding to the values in the property. KeyFields LookupDataset LookupResultField LookupCache Name of field to use as lookup value LookupResultField contains the field name from a field in the dataset pointed to by the LookupDataset property. The value of this field will be used as the lookup's field value when a record is found in the lookup dataset as result for the lookup field value. KeyFields LookupDataset LookupKeyFields LookupCache Original fieldname of the field. Origin contains the origin of the field in the form TableName.fieldName. This property is filled only if the descendent or the database engine support retrieval of this property. It can be used to autmatically create update statements, together with the property. Flags for provider or update support

ProviderFlags contains a set of flags that can be used by engines that automatically generate update SQL statements or update data packets. The various items in the set tell the engine whether the key is a key field, should be used in the where clause of an update statement or whether - in fact - it should be updated at all.

These properties should be set by the programmer so engines such as SQLDB can create correct update SQL statements whenever they need to post changes to the database. Note that to be able to set these properties in a designer, persistent fields must be created.

Is the field read-only ReadOnly can be set to True to prevent controls of writing data to the field, effectively making it a read-only field. Setting this property to True does not prevent the field from getting a value through code: it is just an indication for GUI controls that the field's value is considered read-only. Does the field require a value Required determines whether the field needs a value when posting the data: when a dataset posts the changed made to a record (new or existing), it will check whether all fields with the Required property have a value assigned to them. If not, an exception will be raised. Descendents of will set the property to True when opening the dataset, depending on whether the field is required in the underlying data engine. For fields that are not required by the database engine, the programmer can still set the property to True if the business logic requires a field. ReadOnly Visible Should the field be shown in grids Visible can be used to hide fields from a grid when displaying data to the user. Invisible fields will by default not be shown in the grid. Event triggerd when the field's value has changed OnChange is triggered whenever the field's value has been changed. It is triggered only after the new contents have been written to the dataset buffer, so it can be used to react to changes in the field's content. To prevent the writing of changes to the buffer, use the event. It is not allowed to change the state of the dataset or the contents of the field during the execution of this event handler: doing so may lead to infinite loops and other unexpected results. Event to format the field's content OnGetText is triggered whenever the or properties are read. It can be used to return a custom formatted string in the AText parameter which will then typically be used by a control to display the field's contents to the user. It is not allowed to change the state of the dataset or the contents of the field during the execution of this event handler. Event to set the field's content based on a user-formatted string OnSetText is called whenever the property is written. It can be used to set the actual value of the field based on the passed AText parameter. Typically, this event handler will perform the inverse operation of the handler, if it exists. Event to validate the value of a field before it is written to the data buffer OnValidate is called prior to writing a new field value to the dataset's data buffer. It can be used to prevent writing the new value to the buffer by raising an exception in the event handler. Note that this event handler is always called, irrespective of the way the value of the field is set. Field class to handle ansistring fields TStringField is the class used whenever a dataset has to handle a string field type (data type ftString). This class overrides some of the standard methods to handle string data, and introduces some properties that are only pertinent for data fields of string type. It should never be necessary to create an instance of TStringField manually, a field of this class will be instantiated automatically for each string field when a dataset is opened. Create a new instance of the TStringField class Create is used to create a new instance of the TStringField class. It initializes some properties after having called the inherited constructor. Owner for the field class instance Is the string declared with a fixed length ? FixedChar is True if the underlying data engine has declared the field with a fixed length, as in a SQL CHAR() declaration: the field's value will then always be padded with as many spaces as needed to obain the declared length of the field. If it is False then the declared length is simply the maximum length for the field, and no padding with spaces is performed. Should the field value be transliterated when reading or writing Transliterate can be set to True if the field's contents should be transliterated prior to copying it from or to the field's buffer. Transliteration is done by a method of TDataset: . Value of the field as a string Value is overridden in TField to return the value of the field as a string. It returns the contents of when read, or sets the AsString property when written to. Maximum size of the string Size is made published by the TStringField class so it can be set in the IDE: it is the declared maximum size of the string (in characters) and is used to calculate the size of the dataset buffer. Field class for widestring data TWideStringField is the string field class instantiated for fields of data type ftWideString. This class overrides some of the standard methods to handle widestring data, and introduces some properties that are only pertinent for data fields of widestring type. It should never be necessary to create an instance of TWideStringField manually, a field of this class will be instantiated automatically for each widestring field when a dataset is opened. Create a new instance of the TWideStringField class. Create is used to create a new instance of the TWideStringField class. It initializes some properties after having called the inherited constructor. Owner of the TWideStringField class instance Value of the field as a widestring Value is overridden by the TWideStringField to return a WideString value. It is the same value as the property. Base class for all numerical data field classe

TNumericField is an abstract class which overrides some of the methods of to handle numerical data. It also introduces or publishes a couple of properties that are only relevant in the case of numerical data, such as and .

Since TNumericField is an abstract class, it must never be instantiated directly. Instead one of the descendent classes should be created.

Create a new instance of TNumericField Create calls the inherited constructor and then initializes the property with Owner of the field component Alignment of the field Alignment is published by TNumericField with taRightJustify as a default value. Format string for display of numerical data DisplayFormat specifies a format string (such as used by the Format and FormatFloat functions) for display purposes: the property will use this property to format the field's value. Which formatting function (and, consequently, which format can be entered) is used depends on the descendent of the TNumericField class. Format FormatFloat Format string for editing of numerical data EditFormat specifies a format string (such as used by the Format and FormatFloat functions) for editing purposes: the property will use this property to format the field's value. Which formatting function (and, consequently, which format can be entered) is used depends on the descendent of the TNumericField class. Format FormatFloat Field class for 32-bit signed integer data

TLongintField is instantiated when a dataset must manage a field with 32-bit signed data: the data type ftInteger. It overrides some methods of to handle integer data, and sets some of the properties to values for integer data. It also introduces some methods and properties specific to integer data such as MinValue and MaxValue.

It should never be necessary to create an instance of TLongintField manually, a field of this class will be instantiated automatically for each integer field when a dataset is opened.

MaxValue MinValue
Create a new instance of TLongintField Create initializes a new instance of TLongintField. After calling the inherited constructor, it initializes the MinValue and MaxValue properties. MaxValue MinValue Owner of the field component. Check whether a valid is in the allowed range of values for the field CheckRange returns True if AValue lies within the range defined by the MinValue and MaxValue properties. If the value lies outside of the allowed range, then False is returned. MaxValue MinValue true if AValue is in the allowed range of values. Value to check Value of the field as longint Value is redefined by TLongintField as a 32-bit signed integer value. It returns the same value as the property. Maximum value for the field MaxValue is the maximum value for the field. When setting the field's value, the value may not be larger than MaxValue. Any attempt to write a larger value as the field's content will result in an exception. By default MaxValue equals MaxInt, i.e. any integer value is allowed. MinValue Minimum value for the field MinValue is the minimum value for the field. When setting the field's value, the value may not be less than MinValue. Any attempt to write a smaller value as the field's content will result in an exception. By default MinValue equals -MaxInt, i.e. any integer value is allowed. MaxValue Alias for TLongintField TIntegerField is an alias for . Field class for 64-bit signed integer data

TLargeIntField is instantiated when a dataset must manage a field with 64-bit signed data: the data type ftLargeInt. It overrides some methods of to handle int64 data, and sets some of the properties to values for int64 data. It also introduces some methods and properties specific to 64-bit integer data such as MinValue and MaxValue.

It should never be necessary to create an instance of TLargeIntField manually, a field of this class will be instantiated automatically for each int64 field when a dataset is opened.

MinValue MaxValue
Create a new instance of the TLargeintField class Create initializes a new instance of the TLargeIntField class: it calls the inherited constructor and then initializes the various properties of and MinValue and MaxValue. MinValue MaxValue Owner of the TLargeIntField component Check whether a values falls within the allowed range CheckRange returns True if AValue lies within the range defined by the MinValue and MaxValue properties. If the value lies outside of the allowed range, then False is returned. MaxValue MinValue true if AValue is in the allowed range of values. Value to check Field contents as a 64-bit integer value Value is redefined by TLargeIntField as a 64-bit integer value. It returns the same value as . Maximum value for the field

MaxValue is the maximum value for the field if set to any value different from zero. When setting the field's value, the value may not be larger than MaxValue. Any attempt to write a larger value as the field's content will result in an exception. By default MaxValue equals 0, i.e. any integer value is allowed.

If MaxValue is set, MinValue should also be set, because it will also be checked.

Minimum value for the field

MinValue is the minimum value for the field. When setting the field's value, the value may not be less than MinValue. Any attempt to write a smaller value as the field's content will result in an exception. By default MinValue equals 0, i.e. any integer value is allowed.

If MinValue is set, MaxValue should also be set, because it will also be checked.

Field class for smallint (16-bit signed integer) data

TSmallIntField is the class created when a dataset must manage 16-bit signed integer data, of datatype ftSmallInt. It exposes no new properties, but simply overrides some methods to manage 16-bit signed integer data.

It should never be necessary to create an instance of TSmallIntField manually, a field of this class will be instantiated automatically for each smallint field when a dataset is opened.

Create a new instance of the TSmallintField class. Create initializes a new instance of the class. It calls the inherited constructor and then simply sets some of the properties to work with 16-bit signed integer data. Owner of the field component. Field class for word (16-bit unsigned integer) data

TWordField is the class created when a dataset must manage 16-bit unsigned integer data, of datatype ftWord. It exposes no new properties, but simply overrides some methods to manage 16-bit unsigned integer data.

It should never be necessary to create an instance of TWordField manually, a field of this class will be instantiated automatically for each word field when a dataset is opened.

Create a new instance of the TWordField class. Create initializes a new instance of the class. It calls the inherited constructor and then simply sets some of the properties to work with 16-bit unsigned integer data. Owner of the field instance. Field for auto-incremental, 32-bit signed integer data

TAutoIncField is the class created when a dataset must manage 32-bit signed integer data, of datatype ftAutoInc: This field gets it's data automatically by the database engine. It exposes no new properties, but simply overrides some methods to manage 32-bit signed integer data.

It should never be necessary to create an instance of TAutoIncField manually, a field of this class will be instantiated automatically for each auto-incremental field when a dataset is opened.

Create a new instance of the TAutoIncField class. Create initializes a new instance of the TAutoIncField class. It simply calls the inherited constructor and then sets up some of the class' fields. Owner of the newly created fields. Class for floating point values

TFloatField is the class created when a dataset must manage floating point values of double precision. It exposes a few new properties such as Currency, MaxValue, MinValue and overrides some methods to work with floating point data.

It should never be necessary to create an instance of TFloatField manually, a field of this class will be instantiated automatically for each floating-point field when a dataset is opened.

Currency MaxValue MinValue
Create a new instance of the TFloatField Create initializes a new instance of TFloatField. It calls the inherited constructor and then initializes some properties. Owner of the field instance Check whether a value is in the allowed range of values for the field CheckRange returns True if AValue lies within the range defined by the MinValue and MaxValue properties. If the value lies outside of the allowed range, then False is returned. MaxValue MinValue true if AValue is in the allowed range of values. Value to check Value of the field as a double type Value is redefined by TFloatField to return a value of type Double. It returns the same value as Is the field a currency field. Currency can be set to True to indicate that the field contains data representing an amount of currency. This affects the way the and properties format the value of the field: if the Currency property is True, then these properties will format the value as a currency value (generally appending the currency sign) and if the Currency property is False, then they will format it as a normal floating-point value. Maximum value for the field

MaxValue can be set to a value different from zero, it is then the maximum value for the field if set to any value different from zero. When setting the field's value, the value may not be larger than MaxValue. Any attempt to write a larger value as the field's content will result in an exception. By default MaxValue equals 0, i.e. any floating-point value is allowed.

If MaxValue is set, MinValue should also be set, because it will also be checked.

Minimum value for the field

MinValue can be set to a value different from zero, then it is the minimum value for the field. When setting the field's value, the value may not be less than MinValue. Any attempt to write a smaller value as the field's content will result in an exception. By default MinValue equals 0, i.e. any floating-point value is allowed.

If MinValue is set, MaxValue should also be set, because it will also be checked.

Precision (number of digits) of the field in text representations Precision is the maximum number of digits that should be used when the field is converted to a textual representation in or , it is used in the arguments to FormatFloat. FormatFloat Class for currency fields

TCurrencyField is the field class used by when it needs to manage currency-valued data.( equals ftCurrency). It simply sets some properties to be able to work with currency data.

It should never be necessary to create an instance of TCurrencyField manually, a field of this class will be instantiated automatically for each currency field when a dataset is opened.

Create a new instance of a TCurrencyField. Create initializes a new instance of TCurrencyField. It calls the inherited constructor and then sets some properties () to be able to work with currency data. Owner of the new field instance Is the field a currency field Currency is inherited from but is initialized to True by the TCurrencyField constructor. It can be set to False if the contents of the field is of type currency, but does not represent an amount of currency. Boolean field class type

TBooleanField is the field class used by whenever it needs to manage boolean data ( equals ftBoolean). It overrides some properties and methods of to be able to work with boolean data.

It should never be necessary to create an instance of TBooleanField manually, a field of this class will be instantiated automatically for each boolean field when a dataset is opened.

Create a new instance of the TBooleanField class. Create initializes a new instance of the TBooleanField class. It calls the inherited constructor and then sets some properties to configure it for working with boolean values. Owner of the field instance Value of the field as a boolean value Value is redefined from by TBooleanField as a boolean value. It returns the same value as the property. Textual representation of the true and false values

DisplayValues contains 2 strings, separated by a semicolon (;) which are used to display the True and False values of the fields. The first string is used for True values, the second value is used for False values. If only one value is given, it will serve as the representation of the True value, the False value will be represented as an empty string.

A value of Yes;No will result in True values being displayed as 'Yes', and False values as 'No'. When writing the value of the field as a string, the string will be compared (case insensitively) with the value for True, and if it matches, the field's value will be set to True. After this it will be compared to the value for False, and if it matches, the field's value will be set to False. If the text matches neither of the two values, an exception will be raised.

Field class for date/time/Datetime values

TDateTimeField is the class used when a dataset must manage data of type datetime. ( equals ftDateTime). It also serves as base class for the or classes. It overrides some of the properties and methods of the class to be able to work with date/time fields.

It should never be necessary to create an instance of TDateTimeField manually, a field of this class will be instantiated automatically for each datetime field when a dataset is opened.

Create a new instance of a TDateTimeField class. Create initializes a new instance of the TDateTimeField class. It calls the inherited destructor, and then sets some properties to configure the instance for working with date/time values. Owner of the field instance Contents of the field as a TDateTime value Value is redefined from by TDateTimeField as a TDateTime value. It returns the same value as the property. Formatting string for textual representation of the field DisplayFormat can be set to a formatting string that will then be used by the property to format the value with the DateTimeToStringfunction. DateTimeToString FormatDateTime Field class for date values

TDateField is the class used when a dataset must manage data of type date. ( equals ftDate). It initializes some of the properties of the class to be able to work with date fields.

It should never be necessary to create an instance of TDateField manually, a field of this class will be instantiated automatically for each date field when a dataset is opened.

Create a new instance of a TDateField class. Create initializes a new instance of the TDateField class. It calls the inherited destructor, and then sets some properties to configure the instance for working with date values. Owner for the new field instance Field class for time values

TimeField is the class used when a dataset must manage data of type time. ( equals ftTime). It initializes some of the properties of the class to be able to work with time fields.

It should never be necessary to create an instance of TTimeField manually, a field of this class will be instantiated automatically for each time field when a dataset is opened.

Create a new instance of a TTimeField class. Create initializes a new instance of the TTimeField class. It calls the inherited destructor, and then sets some properties to configure the instance for working with time values. Owner for the new field instance Field class for working with binary field data

TBinaryField is an abstract class, designed to handle binary data of variable size. It overrides some of the properties and methods of the class to be able to work with binary field data, such as retrieving the contents as a string or as a variant.

One must never create an instance of TBinaryField manually, it is an abstract class. Instead, a descendent class such as or should be created.

Create a new instance of a TBinaryField class. Create initializes a new instance of the TBinaryField class. It simply calls the inherited destructor. Owner for the new field instance. Size of the binary data Size is simply redeclared published with a default value of 16. Field class for fixed size byte array values

TBytesField is the class used when a dataset must manage data of fixed-size binary type. ( equals ftBytes). It initializes some of the properties of the class to be able to work with fixed-size byte fields.

It should never be necessary to create an instance of TBytesField manually, a field of this class will be instantiated automatically for each binary data field when a dataset is opened.

Create a new instance of a TBytesField class. Create initializes a new instance of the TBytesField class. It calls the inherited destructor, and then sets some properties to configure the instance for working with binary data values. Owner of the niew field instance Field class for variable size byte array values

TVarBytesField is the class used when a dataset must manage data of variable-size binary type. ( equals ftVarBytes). It initializes some of the properties of the class to be able to work with variable-size byte fields.

It should never be necessary to create an instance of TVarBytesField manually, a field of this class will be instantiated automatically for each variable-sized binary data field when a dataset is opened.

Create a new instance of a TVarBytesField class. Create initializes a new instance of the TVarBytesField class. It calls the inherited destructor, and then sets some properties to configure the instance for working with variable-size binary data values. Owner of the new field instance Field class for Binary Coded Decimal (BCD) values

TBCDField is the class used when a dataset must manage data of Binary Coded Decimal type. ( equals ftBCD). It initializes some of the properties of the class, and overrides some of its methods to be able to work with BCD fields.

TBCDField assumes that the field's contents can be stored in a currency type, i.e. the maximum number of decimals after the decimal separator that can be stored in a TBCDField is 4. Fields that need to store a larger amount of decimals should be represented by a instance.

It should never be necessary to create an instance of TBCDField manually, a field of this class will be instantiated automatically for each BCD field when a dataset is opened.

Create a new instance of a TBCDField class. Create initializes a new instance of the TBCDField class. It calls the inherited destructor, and then sets some properties to configure the instance for working with BCD data values. Owner of the new field instance Check whether a values falls within the allowed range CheckRange returns True if AValue lies within the range defined by the MinValue and MaxValue properties. If the value lies outside of the allowed range, then False is returned. MaxValue MinValue True if AValue falls in the allowed range of values Value to check Value of the field contents as a Currency type Value is overridden from the property to a currency type field. It returns the same value as the field. Precision of the BCD field Precision is the total number of decimals in the BCD value. It is not the same as , which is the number of decimals after the decimal point. The Precision property should be set by the descendent classes when they initialize the field, and should be considered read-only. Changing the value will influence the values returned by the various AsXXX properties. Does the field represent a currency amount Currency can be set to True to indicate that the field contains data representing an amount of currency. This affects the way the and properties format the value of the field: if the Currency property is True, then these properties will format the value as a currency value (generally appending the currency sign) and if the Currency property is False, then they will format it as a normal floating-point value. Maximum value for the field

MaxValue can be set to a value different from zero, it is then the maximum value for the field if set to any value different from zero. When setting the field's value, the value may not be larger than MaxValue. Any attempt to write a larger value as the field's content will result in an exception. By default MaxValue equals 0, i.e. any floating-point value is allowed.

If MaxValue is set, MinValue should also be set, because it will also be checked.

Minimum value for the field

MinValue can be set to a value different from zero, then it is the minimum value for the field. When setting the field's value, the value may not be less than MinValue. Any attempt to write a smaller value as the field's content will result in an exception. By default MinValue equals 0, i.e. any floating-point value is allowed.

If MinValue is set, should also be set, because it will also be checked.

Number of decimals after the decimal separator Size is the number of decimals after the decimal separator. It is not the total number of decimals, which is stored in the field. Mode used when creating a blob stream TBlobStramMode is used when creating a stream for redaing BLOB data. It indicates what the data will be used for: reading, writing or both. Read blob data Write blob data Read and write blob data Valid BLOB fieldtypes TBlobType is a subrange type, indicating the various datatypes of BLOB fields. Base class for BLOB field data

TBLobField is the class used when a dataset must manage BLOB data. ( equals ftBLOB). It initializes some of the properties of the class, and overrides some of its methods to be able to work with BLOB fields. It also serves as parent class for some specialized blob-like field types such as , or

It should never be necessary to create an instance of TBlobField manually, a field of this class will be instantiated automatically for each BLOB field when a dataset is opened.

Create a new instance of a TBlobField class. Create initializes a new instance of the TBlobField class. It calls the inherited destructor, and then sets some properties to configure the instance for working with BLOB data. Owner of the new field instance Clear the BLOB field's contents Clear overrides the TField implementation of . It creates and immediatly releases an empty blob stream in write mode, effectively clearing the contents of the BLOB field. Is the field a blob field IsBlob is overridden by TBlobField to return True Always True Load the contents of the field frop a file LoadFromFile creates a file stream with FileName as the name of the file to open, en then calls LoadFromStream to read the contents of the blob field from the file. The file is opened in read-only mode. If the file does not exist or is nor available for reading, an exception will be raised. LoadFromStream SaveToFile Name of file to read data from Load the field's contents from stream LoadFromStream can be used to load the contents of the field from a TStream descendent. The entire data of the stream will be copied, and the stream will be positioned on the first byte of data, so it must be seekable. If the stream is not seekable, an exception will be raised. SaveToStream LoadFromFile Stream instance to load data from Save field contents to a file SaveToFile creates a file stream with FileName as the name of the file to open, en then calls SaveToStream to write the contents of the blob field to the file. The file is opened in write mode and is created if it does not yet exist. If the file cannot be created or is not available for writing, an exception will be raised. LoadFromFile SaveToStream Name of file to write data to Save the field's contents to stream SaveToStream can be used to save the contents of the field to a TStream descendent. The entire data of the field will be copied. The stream must of course support writing. If the stream is not writable, an exception will be raised. SaveToFile LoadFromStream Stream to save data to Set field type SetFieldType is overridden by TBlobField to check whether a valid Blob field type is set. If so, it calls the inherited method. Value for the DataType property Size of the current blob BlobSize is the size (in bytes) of the current contents of the field. It will vary as the dataset's current record moves from record to record. Has the field's contents been modified. Modified indicates whether the field's contents have been modified for the current record. Return the field's contents as a string Value is redefined by TBlobField as a string value: getting or setting this value will convert the BLOB data to a string, it will return the same value as the property. Should the contents of the field be transliterated Transliterate indicates whether the contents of the field should be transliterated (i.e. changed from OEM to non OEM codepage and vice versa) when reading or writing the value. The actual transliteration must be done in the method of the dataset to which the field belongs. By default this property is False, but it can be set to True for BLOB data which contains text in another codepage. Type of blob BlobType is an alias for , but with a restricted set of values. Setting BlobType is equivalent to setting the property. Size of the blob field Size is the size of the blob in the internal memory buffer. It defaults to 0, as the BLOB data is not stored in the internal memory buffer. To get the size of the data in the current record, use the BlobSize property instead. BlobSize Base class for MEMO (text BLOB) field data

TMemoField is the class used when a dataset must manage memo (Text BLOB) data. ( equals ftMemo). It initializes some of the properties of the class. All methods to be able to work with memo fields have been implemented in the parent class.

It should never be necessary to create an instance of TMemoField manually, a field of this class will be instantiated automatically for each memo field when a dataset is opened.

Create a new instance of the TMemoField class Create initializes a new instance of the TMemoField class. It calls the inherited destructor, and then sets some properties to configure the instance for working with memo values. Owner of the new field instance/ Should the contents of the field be transliterated Transliterate is redefined from with a default value of true. Field class for wide MEMO (widestring text BLOB) field data

TWideMemoField is the class used when a dataset must manage memo (Text BLOB) data. ( equals ftWideMemo). It initializes some of the properties of the class. All methods to be able to work with widestring memo fields have been implemented in the parent class.

It should never be necessary to create an instance of TWideMemoField manually, a field of this class will be instantiated automatically for each widestring memo field when a dataset is opened.

Create a new instance of the TWideMemoField class Create initializes a new instance of the TWideMemoField class. It calls the inherited destructor, and then sets some properties to configure the instance for working with widestring memo values. Owner for the new field instance Value of the field's contents as a widestring Value is redefined by TWideMemoField as a WideString value. Reading and writing this property is equivalent to reading and writing the property. Field class for graphical BLOB field data

TGraphicField is the class used when a dataset must manage graphical BLOB data. ( equals ftGraphic). It initializes some of the properties of the class. All methods to be able to work with graphical BLOB data have been implemented in the parent class.

It should never be necessary to create an instance of TGraphicsField manually, a field of this class will be instantiated automatically for each graphical BLOB field when a dataset is opened.

Create a new instance of the TGraphicField class Create initializes a new instance of the TGraphicField class. It calls the inherited destructor, and then sets some properties to configure the instance for working with graphical BLOB values. Owner for the new TGraphicField instance Field class for native variant data

TVariantField is the class used when a dataset must manage native variant-typed data. ( equals ftVariant). It initializes some of the properties of the class and overrides some of its methods to be able to work with variant data.

It should never be necessary to create an instance of TVariantField manually, a field of this class will be instantiated automatically for each variant field when a dataset is opened.

Create a new instance of the TVariantField class Create initializes a new instance of the TVariantField class. It calls the inherited destructor, and then sets some properties to configure the instance for working with variant values. Owner for the new TVariantField instance Field class for native variant data

TGUIDField is the class used when a dataset must manage native variant-typed data. ( equals ftGUID). It initializes some of the properties of the class and overrides some of its methods to be able to work with variant data. It also adds a method to retrieve the field value as a native TGUID type.

It should never be necessary to create an instance of TGUIDField manually, a field of this class will be instantiated automatically for each GUID field when a dataset is opened.

Create a new instance of the TGUIDField class Create initializes a new instance of the TGUIDField class. It calls the inherited destructor, and then sets some properties to configure the instance for working with GUID values. Owner for the new TGUIDField instance Field content as a GUID value AsGUID can be used to get or set the field's content as a value of type TGUID. A class to keep a list of index definitions TIndexDefs is used to keep a collection of index (sort order) definitions. It can be used by classes that provide in-memory or on-disk indexes to provide a list of available indexes. Index description flags TIndexOption describes the various properties that an index can have. It is used in the set type to describe all properties of an index definition as in . The index is the primary index for the data The index is a unique index, i.e. each index value can occur only once The values in the index are sorted descending. The values in the index are sorted case-insensitively The values in the index are based on a calculated expression. The index is non-maintained, i.e. changing the data will not update the index. Set of TIndexOption values TIndexOptions contains the set of properties that an index can have. It is used in the property to describe all properties of an index definition as in . Index definition TIndexDef describes one index in a set of indexes of a instance. The collection of indexes is descibed by the class. It just has the necessary properties to describe an index, but does not implement any functionality to maintain an index. Create a new index definition Create initializes a new instance with the AName value as the index name, AField as the fields making up the index, and TheOptions as the options. Owner should be the instance to which the new TIndexDef can be added. If an index with name AName already exists in the collection, an exception will be raised. TIndexDefs Collection to which new instance must be added. Name for the new index. Each name may appear only once in the collection. Fields that make up the index Options for the index Remove the index from memory Destroy calls the inherited destructor, and removes the item from memory. Expression that makes up the index values Expression is an SQL expression based on which the index values are computed. It is only used when ixExpression is in Fields making up the index

Fields is a list of fieldnames, separated by semicolons: the fields that make up the index, in case the index is not based on an expression. The list contains the names of all fields, regardless of whether the sort order for a particular field is ascending or descending. The fields should be in the right order, i.e. the first field is sorted on first, and so on.

The property can be used to determine the fields in the list that have a descending sort order. The property determines which fields are sorted in a case-insensitive manner.

Fields in field list that are ordered case-insensitively CaseInsFields is a list of fieldnames, separated by semicolons. It contains the names of the fields in the Fields property which are ordered in a case-insensitive manner. CaseInsFields may not contain fieldnames that do not appear in Fields. Fields in field list that are ordered descending DescFields is a list of fieldnames, separated by semicolons. It contains the names of the fields in the Fields property which are ordered in a descending manner. DescFields may not contain fieldnames that do not appear in Fields. Index options

Options describes the various properties of the index. This is usually filled by the dataset that provides the index definitions. For datasets that provide In-memory indexes, this should be set prior to creating the index: it cannot be changed once the index is created.

See the description of for more information on the various available options.

Source of the index Source describes where the index comes from. This is a property for the convenience of the various datasets that provide indexes: they can use it to describe the source of the index. Create a new TIndexDefs instance Create initializes a new instance of the TIndexDefs class. It simply calls the inherited destructor with the appropriate item class, . Dataset for which the index definitions are stored Remove the indexdefs from memory. Destroy removes the indexdefs from memory. If the TIndexDefs instance is created by a instance, the dataset instance will also destroy it. Add a new index definition with given name and options Add adds a new instance to the list of indexes. It initializes the index definition properties Name, Fields and Options with the values given in the parameters with the same names. If an index with the same Name already exists in the list of indexes, an exception will be raised. Name for the new index definition Value for the Fields property of the new index definition. Value for the Options property of the new index definition. Add a new, empty, index definition AddIndexDef adds a new instance to the list of indexes, and returns the newly created instance. It does not initialize any of the properties of the new index definition. New TIndexDef instance. Find an index by name Find overloads the method to search and return a instance based on the name. The search is case-insensitive and raises an exception if no matching index definition was found. Note: TIndexDefs.IndexOf can be used instead if an exception is not desired. TIndexDef instance with name IndexName or Nil Index name to search for. Find index definition based on field names FindIndexForFields searches in the list of indexes for an index whose property matches the list of fields in Fields. If it finds an index definition, then it returns the found instance. If no matching definition is found, an exception is raised. This is different from other Find functionality, where Find usually returns Nil if nothing is found. TIndexDef instance with fieldlist matching Fields Fieldlist to look for Get index definition based on field names GetIndexForFields searches in the list of indexes for an index whose property matches the list of fields in Fields. If CaseInsenstitive is True it only searches for case-sensitive indexes. If it finds an index definition, then it returns the found instance. If it does not find a matching definition, Nil is returned. TIndexDef instance with fieldlist matching Fields or Nil Fieldlist to look for Look only for a case-insensitive index Called whenever one of the items changes Update can be called to have the dataset update its index definitions. Indexed access to the index definitions Items is redefined by TIndexDefs using TIndexDef as the type for the elements. It is the default property of the TIndexDefs class. Numerical, zero-based index. Record-level constraint definition TCheckConstraint can be used to store the definition of a record-level constraint. It does not enforce the constraint, it only stores the constraint's definition. The constraint can come from several sources: an imported constraints from the database, usually stored in the property , or a constraint enforced by the user on a particular dataset instance stored in Assign one constraint to another Assign is overridden by TCheckConstraint to copy all published properties if Source is also a TCheckConstraint instance. If Source is not an instance of TCheckConstraint, an exception may be thrown. Instance to copy properties from. User-defined constraint CustomConstraint is an SQL expression with an additional user-defined constraint. The expression should be enforced by a descendent when data is posted to the dataset. If the constraint is violated, then the dataset should raise an exception, with message as specified in Message to display when the constraint is violated ErrorMessage is used as the message when the dataset instance raises an exception if the constraint is violated. True if the constraint is imported from a datadictionary FromDictionary indicates whether a constraint is imported from a data dictionary. This can be set by descendents to indicate the source of the constraint, but is otherwise ignored. Constraint imported from the database engine ImportedConstraint is a constraint imported from the database engine: it will not be enforced locally by the descendent. Set of record-level constraints TCheckConstraints is a TCollection descendent which keeps a collection of items. It overrides the Add method to return a TCheckConstraint instance. Create a new instance of the TCheckConstraints class. Create initializes a new instance of the TCheckConstraints class. The AOwner argument is usually the instance for which the data is managed. It is kept for future reference. After storing the owner, the inherited constructor is called with the class pointer. Owner for the collection Add new TCheckConstraint item to the collection Add is overridden by TCheckConstraint to add a new instance to the collection. it returns the newly added instance. The newly added TCheckConstraint instance Indexed access to the items in the collection Items is overridden by TCheckConstraints to provide type-safe access to the items in the collection. The index is zero-based, so it runs from 0 to Count-1. Zero-based index to the list of items Create a new instance of TFields Create initializes a new instance of TFields. It stores the ADataset parameter, so it can be retrieved at any time in the property, and initializes an internal list object to store te list of fields. Dataset for which fields must be managed. Free the TFields instance Destroy frees the field instances that it manages on behalf of the Dataset. After that it cleans up the internal structures and then calls the inherited destructor. Add a new field to the list Add must be used to add a new instance to the list of fields. After a TField instance is added to the list, the TFields instance will free the field instance if it is cleared. TField instance to add to the list of fields. Check field name for duplicate entries CheckFieldName checks whether a field with name equal to Value (case insensitive) already appears in the list of fields (using ). If it does, then an exception is raised. Field name to check Check a list of field names for duplicate entries CheckFieldNames splits Value in a list of fieldnames, using semicolon as a separator. For each of the fieldnames obtained in this way, it calls CheckFieldName. Spaces are not discarded, so leaving a space after of before a fieldname will not find the fieldname, and will yield a false negative result. List of field names to check Clear the list of fields Clear removes all var instances from the list. All field instances are freed after they have been removed from the list. Find a field based on its name FindField searches the list of fields and returns the field instance whose FieldName property matches Value. The search is performed case-insensitively. If no field instance is found, then Nil is returned. Field instance with FieldName matching Value Fieldname to search for Find a field based on its name Fieldbyname searches the list of fields and returns the field instance whose FieldName property matches Value. The search is performed case-insensitively. If no field instance is found, then an exception is raised. If this behaviour is undesired, use , where Nil is returned if no match is found. Field instance with FieldName matching Value Fieldname to search for Search field based on its fieldnumber FieldByNumber searches for the field whose property matches the FieldNo parameter. If no such field is found, Nil is returned. Field instance with matching FieldNo property. Field number to search for Get the list of fieldnames GetFieldNames fills Values with the fieldnames of all the fields in the list, each item in the list contains 1 fieldname. The list is cleared prior to filling it. List to store fieldnames in Return the index of a field instance IndexOf scans the list of fields and retuns the index of the field instance in the list (it compares actual field instances, not field names). If the field does not appear in the list, -1 is returned. Index of Field in the list Field instance to search for. Remove an instance from the list Remove removes the field Value from the list. It does not free the field after it was removed. If the field is not in the list, then nothing happens. Field to remove from the list. Number of fields in the list Count is the number of fields in the fieldlist. The items in the Fields property are numbered from 0 to Count-1. Dataset the fields belong to Dataset is the dataset instance that owns the fieldlist. It is set when the instance is created. This property is purely for informational purposes. When adding fields to the list, no check is performed whether the field's Dataset property matches this dataset. Indexed access to the fields in the list Fields is the default property of the TFields class. It provides indexed access to the fields in the list: the index runs from 0 to Count-1. Providing an index outside the allowed range will result in an EListError exception. Zero based index in the list. Bookmark type (deprecated) TBookMark is the type used by the method. It is an opaque type, and should not be used any more, it is superseded by the type. Bookmark type TBookmarkStr is the type used by the property. It can be used as a string, but should in fact be considered an opaque type. Pointer to TBookmarkflag type PBookmarkFlag is a convenience type, defined for internal use in or one of it's descendents. Bookmark flags TBookmarkFlag is used internally by and it's descendent types to mark the internal memory buffers. It should not be used in end-user applications. Buffer used for the current record First record in the dataset. Last record in the dataset Buffer used for insert Pointer to TBufferlist type PBufferList is a pointer to a structure of type . It is an internal type, and should not be used in end-user code. Array of PChar records TBufferList is used intenally by the class to manage the memory buffers for the data. It should not be necessary to use this type in end-user applications. Get new buffer mode TGetMode is used internally by when it needs to fetch more data for its buffers (using GetRecord). It tells the descendent dataset what operation must be performed. Retrieve the current record Retrieve the next record. Retrieve the previous record. result of the GetRecord operation. TGetResult is used by descendents of when they have to communicate the result of the GetRecord operation back to the TDataset record. The operation was completed succesfully The beginning of the recordset is reached The end of the recordset is reached. An error occurred Internal flag for resynchronisiation TResyncMode is used internally by various navigation and data manipulation methods such as the method when they need to reset the cursor position in the dataset's buffer. Reposition at exact the same location in the buffer Try to position the cursor in the middle of the buffer Action to take when a data manipulation operation has failed. TDataAction is used by the event handler prototype. The parameter Action of this event handler is of TDataAction type, and should indicate what action must be taken by the dataset. The operation should fail (an exception will be raised) The operation should be aborted (edits are undone, and an EAbort exception is raised) Retry the operation. Action to perform when an update operation fails TUpdateAction indicates what action must be taken in case the applying of updates on the underlying database fails. This type is not used in the class, but is defined on behalf of TDataset descendents that implement caching of updates: It indicates what should be done when the (delayed) applying of the updates fails. This event occurs long after the actual post or delete operation. Update operation should fail The whole update operation should abort The update of the current record should be skipped. (but not discarded) Retry the update operation Consider the update as applied Kind of update operation TUpdateKind indicates what kind of update operation is in progress when applying updates. Modify an existing record in the database. insert a new record in the database. Delete a record in the database. Available options when locating a record in a dataset

TLocateOption is used in the call to enumerate the possible options available when locating a record in the dataset.

For string-type fields, this option indicates that fields starting with the search value are considered a match. For other fields (e.g. integer, date/time), this option is ignored and only equal field values are considered a match.

Perform a case-insensitive search Accept partial key matches for string fields Options to use when locating a record in a dataset TLocateOptions is used in the call: It should contain the actual options to use when locating a record in the dataset. Internal callback type TDataOperation is a prototype handler used internally in TDataset. It can be changed at any time, so it should not be used in end-user code. Event handler prototype for dataset events TDatasetNotifyEVent is used in most of the event handlers. It differs from the more general TNotifyEvent (defined in the Classes unit) in that the Sender parameter of the latter is replaced with the Dataset parameter. This avoids typecasts, the available TDataset methods can be used directly. Dataset which triggered the event Error handling callback TDatasetErrorEvent is used by the , and event handlers to allow the programmer to specfy what should be done if an update operation fails with an exception: The Dataset parameter indicates what dataset triggered the event, the E parameter contains the exception object. The DataAction must be set by the event handler, and based on it's return value, the dataset instance will take appropriate action. The default value is daFail, i.e. the exception will be raised again. For a list of available return values, see . Dataset that triggered the event Exception object that caused the operation to fail. Action to take upon return of the event handler. Available filter options. TFilterOption enumerates the various options available when filtering a dataset. The set is used in the property to indicate which of the options should be used when filtering the data. Filter case insensitively. Do not compare values partially, always compare completely. Set of filter options to use. TFilterOption is the set of filter options to use when filtering a dataset. This set type is used in the property. The available values are described in the type. Record filtering event handler prototype TFilterRecordEvent is the prototype for the event handler. The Dataset parameter indicates which dataset triggered the event, and the Accept parameter must be set to true if the current record should be shown, False should be used when the record should be hidden. Dataset that triggered the event Set to indicate whether the current record should be shown or not. Class type for the TDataset class TDatasetClass is the class type for the class. It is curently unused in the DB unit and is defined for the benefit of other units. Pointer to an array of buffers TBufferArray is an internally used type. It can change in future implementations, and should not be used in application code. Index in the buffers property Create a new TDataset instance Create initializes a new instance. It calls the inherited constructor, and then initializes the internal structures needed to manage the dataset (fielddefs, fieldlist, constraints etc.). Owner of the new dataset instance. Free a TDataset instance Destroy removes a TDataset instance from memory. It closes the dataset if it was open, clears all internal sructures and then calls he inherited destructor. An exception may occur during the close operation, in that case, the dataset will not be removed from memory. Currently active memory buffer ActiveBuffer points to the currently active memory buffer. It should not be used in application code. Pointer to buffer used to display current contents Get the data for a field GetFieldData should copy the data for field Field from the internal dataset memory buffer into the memory pointed to by Buffer. This function is not intended for use by end-user applications, and should be used only in descendent classes, where it can be overridden. The function should return True if data was available and has been copied, or False if no data was available (in which case the field has value Null). The NativeFormat determines whether the data should be in native format (e.g. whether the date/time values should be in TDateTime format). No checks are performed on the validity of the memory buffer True if data was available, false if no data was available. Field for which the data should be fetched Buffer in which the data should be copied Should the data be in native format Store the data for a field SetFieldData should copy the data from field Field, stored in the memory pointed to by Buffer to the dataset memory buffer for the current record. This function is not intended for use by end-user applications, and should be used only in descendent classes, where it can be overridden. The NativeFormat determines whether the data is in native format (e.g. whether the date/time values are in TDateTime format). Field to copy data for Is the data in native format Append a new record to the data Append appends a new record at the end of the dataset. It is functionally equal to the call, but the cursor is positioned at the end of the dataset prior to performing the insert operation. The same events occur as when the Insert call is made. Append a new record to the dataset and fill with data AppendRecord first calls Append to add a new record to the dataset. It then copies the values in Values to the various fields (using ) and attempts to post the record using . If all went well, the result is that the values in Values have been added as a new record to the dataset. Various errors may occur (not supplying a value for all required fields, invalid values) and may cause an exception. This may leave the dataset in editing mode. Values for all fields, in correct order Test whether ABookMark is a valid bookmark. BookmarkValid returns True if ABookMark is a valid bookmark for the dataset. Various operations can render a bookmark invalid: changing the sort order, closing and re-opening the dataset. BookmarkValid always returns False in TDataset. Descendent classes must override this method to do an actual test. If the bookmark is a completely arbitrary pointer, an exception may be raised. True if ABookmark is a valid bookmark. Bookmark pointer to test Cancel the current editing operation

Cancel cancels the current editing operation and sets the dataset again in browse mode. This operation triggers the and events. If the dataset wa sin insert mode, then the and events are triggered after and respectively before the OnBeforeCancel and OnAfterCancel events.

If the dataset was not in one of the editing modes when Cancel is called, then nothing will happen.

Check whether the dataset is in browse mode. CheckBrowseMode checks whether the dataset is in browse mode (State=dsBrowse). If it is not, an exception is raised. Clear the values of all fields ClearFields clears the values of all fields. If the dataset is not in editing mode (State in dsEditmodes), then an exception will be raised. Close the dataset Close closes the dataset if it is open (Active=True). This action triggers the and events. If the dataset is not active, nothing happens. If an exception occurs during the closing of the dataset, the OnAfterClose event will not be triggered. Check whether the controls are disabled ControlsDisabled returns True if the controls are disabled, i.e. no events are propagated to the controls connected to this dataset. The call can be used to disable sending of data events to the controls. The sending can be re-enabled with . This mechanism has a counting mechanism: in order to enable sending of events to the controls, EnableControls must be called as much as DisableControls was called. The ControlsDisabled function will return true as long as the internal counter is not zero. True if no events are sent to the controls Compare two bookmarks CompareBookmarks can be used to compare the relative positions of 2 bookmarks. It returns a negative value if Bookmark1 is located before Bookmark2, zero if they refer to the same record, and a positive value if the second bookmark appears before the first bookmark. This function mustbe overridden by descendent classes of TDataset. The implementation in TDataset always returns zero. No checks are performed on the validity of the bookmarks. result of the compare operation First bookmark Second bookmark. Create blob stream CreateBlobStream is not intended for use by applictaion programmers. It creates a stream object which can be used to read or write data from a blob field. Instead, application programmers should use the and methods when reading and writing data from/to BLOB fields. Which operation must be performed on the stream is indicated in the Mode parameter, and the Field parameter contains the field whose data should be read. The caller is responsible for freeing the stream created by this function. Stream with (for) blob data BLOB Field for which data should be fetched/written Mode: read or write Indicate a change in cursor position CursorPosChanged is not intended for internal use only, and serves to indicate that the current cursor position has changed. (it clears the internal cursor position). Convert data from/to native format

DataConvert converts the data from field AField in buffer ASource to native format and puts the result in ADest. If the aToNative parameter equals False, then the data is converted from native format to non-native format. Currently, only date/time/datetime and BCD fields are converted from/to native data. This means the routine handles conversion between TDateTime (the native format) and TDateTimeRec, and between TBCD and currency (the native format) for BCD fields.

DataConvert is used internally by TDataset and descendent classes. There should be no need to use this routine in application code.

No checking on the validity of the buffer pointers is performed. If an invalid pointer is passed, an exception may be raised.
Field for which data should be converted. Pointer to memory area with source data Pointer to memory area for target data True if the conversion should happen to native format. Delete the current record. Delete will delete the current record. This action will trigger the , , and events. If the dataset was in edit mode, the edits will be canceled before the delete operation starts. If the dataset is empty or read-only, then an exception will be raised. Disable event propagation of controls

DisableControls tells the dataset to stop sending data-related events to the controls. This can be used before starting operations that will cause the current record to change a lot, or before any other lengthy operation that may cause a lot of events to be sent to the controls that show data from the dataset: each event will cause the control to update itself, which is a time-consuming operation that may also cause a lot of flicker on the screen.

The sending of events to the controls can be re-enabled with . Note that for each call to DisableControls, a matching call to EnableControls must be made: an internal count is kept and only when the count reaches zero, the controls are again notified of changes to the dataset. It is therefore essential that the call to EnableControls is put in a Finally block:

MyDataset.DisableControls; Try // Do some intensive stuff Finally MyDataset.EnableControls end;

Failure to call enablecontrols will prevent the controls from receiving updates. The state can be checked with .
Set the dataset in editing mode. Edit will set the dataset in edit mode: the contents of the current record can then be changed. This action will call the and events. If the dataset was already in insert or edit mode, nothing will happen (the events will also not be triggered). If the dataset is empty, this action will execute instead. If the dataset is read-only or not opened, then an exception will be raised. Enable event propagation of controls

EnableControls tells the dataset to resume sending data-related events to the controls. This must be used after a call to to re-enable updating of controls.

Note that for each call to DisableControls, a matching call to EnableControls must be made: an internal count is kept and only when the count reaches zero, the controls are again notified of changes to the dataset. It is therefore essential that the call to EnableControls is put in a Finally block:

MyDataset.DisableControls; Try // Do some intensive stuff Finally MyDataset.EnableControls end;
Failure to call enablecontrols will prevent the controls from receiving updates. The state can be checked with .
Search a field by name FieldByName is a shortcut for Fields.FieldByName: it searches for the field with fieldname equalling FieldName. The case is performed case-insensitive. The matching field instance is returned. If the field is not found, an exception will be raised. Field instance matching FieldName Fieldname to look for. Find a field by name FindField is a shortcut for Fields.FindField: it searches for the field with fieldname equalling FieldName. The case is performed case-insensitive. The matching field instance is returned, and if no match is found, Nil is returned. Field instance matching FieldName Fieldname to look for. Find the first active record (deprecated)

FindFirst positions the cursor on the first record (taking into account filtering), and returns True if the cursor position was changed. This method must be implemented by descendents of TDataset: The implementation in TDataset always returns False, indicating that the position was not changed.

This method is deprecated, use instead.

True if the cursor position was changed. Find the last active record (deprecated)

FindLast positions the cursor on the last record (taking into account filtering), and returns True if the cursor position was changed. This method must be implemented by descendents of TDataset: The implementation in TDataset always returns False, indicating that the position was not changed.

This method is deprecated, use instead.

True if the cursor position was changed. Find the next active record (deprecated)

FindLast positions the cursor on the next record (taking into account filtering), and returns True if the cursor position was changed. This method must be implemented by descendents of TDataset: The implementation in TDataset always returns False, indicating that the position was not changed.

This method is deprecated, use instead.

True if the cursor position was changed. Find the previous active record (deprecated)

FindPrior positions the cursor on the previous record (taking into account filtering), and returns True if the cursor position was changed. This method must be implemented by descendents of TDataset: The implementation in TDataset always returns False, indicating that the position was not changed.

This method is deprecated, use instead.

True if the cursor position was changed. Position the dataset on the first record. First positions the dataset on the first record. This action will trigger the and events. After the action is completed, the property will be True. If the dataset is unidirectional or is closed, an exception will be raised. Free a bookmark obtained with GetBookmark (deprecated) FreeBookmark must be used to free a bookmark obtained by . It should not be used on bookmarks obtained with the property. Both GetBookmark and FreeBookmark are deprecated. Use the Bookmark property instead: it uses a string type, which is automatically disposed of when the string variable goes out of scope. Bookmark to free. Get a bookmark pointer (deprecated)

GetBookmark gets a bookmark pointer to the current cursor location. The call can be used to return to the current record in the dataset. After use, the bookmark must be disposed of with the call. The bookmark will be Nil if the dataset is empty or not active.

This call is deprecated. Use the property instead to get a bookmark.

Bookmark for curren location or Nil Copy the data for the current record in a memory buffer GetCurrentRecord can be overridden by TDataset descendents to copy the data for the current record to Buffer. Buffermust point to a memory area, large enough to contain the data for the record. If the data is copied succesfully to the buffer, the function returns True. The TDataset implementation is empty, and returns False. True if the data for the current record has been copied succesfully. Buffer to which record data must be copied. Return field instances in a list GetfieldList parses FieldNames for names of fields, and returns the field instances that match the names in list. FieldNames must be a list of field names, separated by semicolons. The list is cleared prior to filling with the requested field instances. If FieldNames contains a name of a field that does not exist in the dataset, then an exception will be raised. List in whihc to return field instances Semicolon-separated list of fieldnames Return a list of all available field names GetFieldNames returns in List the names of all available fields, one field per item in the list. The dataset must be open for this function to work correctly. List in which to return field names Jump to bookmark

GotoBookmark positions the dataset to the bookmark position indicated by ABookMark. ABookmark is a bookmark obtained by the function.

This function is deprecated, use the property instead.

if ABookmark does not contain a valid bookmark, then an exception may be raised.
Bookmark to position the dataset on Insert a new record at the current position. Insert will insert a new record at the current position. When this function is called, any pending modifications (when the dataset already is in insert or edit mode) will be posted. After that, the BeforeInsert, BeforeScroll, OnNewRecord, AfterInsert and AfterScroll events are triggered in the order indicated here. The dataset is in the dsInsert state after this method is called, and the contents of the various fields can be set. To write the new record to the underlying database must be called. If the dataset is read-only, calling Insert will result in an . BeforeInsert BeforeScroll OnNewRecord AfterInsert AfterScroll Insert a new record with given values. InsertRecord is not yet implemented in Free Pascal. It does nothing. Values to apply Check if the dataset contains no data IsEmpty returns True if the dataset is empty, i.e. if EOF and are both True, and the dataset is not in insert mode. True if the dataset has no data available. Check whether a datasource is linked to the dataset IsLinkedTo returns True if ADatasource is linked to this dataset, either directly (the ADatasource.Dataset" points to the current dataset instance, or indirectly. True if ADatasource is linked to the dataset. TDatasource instance to check. Is the data sequenced IsSequenced indicates whether it is safe to use the property to navigate in the records of the data. By default, this property is set to True, but TDataset descendents may set this property to False (for instance, unidirectional datasets), in which case RecNo should not be used to navigate through the data. True if RecNo can be used for navigation. Navigate forward to the last record

Last puts the cursor at the last record in the dataset, fetching more records from the underlying database if needed. It is equivalent to moving to the last record and calling . After a call to Last, the property will be True.

Calling this method will trigger the and events.

Locate a record based on some key values

Locate attempts to locate a record in the dataset. There are 2 possible cases when using Locate.

  1. Keyvalues is a single value. In that case, KeyFields is the name of the field whose value must be matched to the value in KeyValues
  2. Keyvalues is a variant array. In that case, KeyFields must contain a list of names of fields (separated by semicolons) whose values must be matched to the values in the KeyValues array

The matching always happens according to the Options parameter. For a description of the possible values, see .

If a record is found that matches the criteria, then the locate operation positions the cursor on this record, and returns True. If no record is found to match the criteria, False is returned, and the position of the cursor is unchanged.

The implementation in TDataset always returns False. It is up to TDataset descendents to implement this method and return an appropriate value.

True if a record matching KeyValues is found. List of fields, separated by semicolons Single value or array of values. Options to take into account when searching for the record. Search for a record and return matching values. Lookup always returns False in TDataset. Descendents of TDataset can override this method to call to locate the record with fields KeyFields matching KeyValues and then to return the values of the fields in ResultFields. If ResultFields contains more than one fieldname (separated by semicolons), then the function returns an array. If there is only 1 fieldname, the value is returned directly. If the dataset is unidirectional, then a exception will be raised. Value(s) of ResultFields. Semicolon-separated list of fieldnames to locate record. Values for keyfields to locate record with. Semicolon-separated list of fieldnames whose values must be returned. Move the cursor position MoveBy moves the current record pointer with Distance positions. Distance may be a positive number, in which case the cursor is moved forward, or a negative number, in which case the cursor is moved backward. The move operation will stop as soon as the beginning or end of the data is reached. The and events are triggered (once) when this method is called. The function returns the distance which was actually moved by the cursor. A negative distance will result in an exception on unidirectional datasets. Number of positions the cursor actually moved Number of positions the cursor should be moved Go to the next record in the dataset. Next positions the cursor on the next record in the dataset. It is equivalent to a MoveBy(1) operation. Calling this method triggers the and events. If the dataset is located on the last known record (EOF is true), then no action is performed, and the events are not triggered. Calling this method on a closed dataset will result in an exception. Activate the dataset: Fetch data into memory.

Open must be used to make the TDataset Active. It does nothing if the dataset is already active. Open initialises the TDataset and brings the dataset in a browsable state:

Effectively the following happens:

  1. The BeforeOpen event is triggered.
  2. The descendents InternalOpen method is called to actually fetch data and initialize fielddefs and field instances.
  3. BOFis set to True
  4. Internal buffers are allocated and filled with data
  5. If the dataset is empty, EOF is set to true
  6. State is set to dsBrowse
  7. The AfterOpen event is triggered
If the descendent class cannot fetch the data, or the data does not match the field definitions present in the dataset, then an exception will be raised.
Post pending edits to the database. Post attempts to save pending edits when the dataset is in one of the edit modes: that is, after a Insert, Append or operation. The changes will be committed to memory - and usually immediatly to the underlying database as well. Prior to saving the data to memory, it will check some constraints: in TDataset, the presence of a value for all required fields is checked. if for a required field no value is present, an exception will be raised. A call to Post results in the triggering of the BeforePost, AfterPost events. After the call to Past, the State of the dataset is again dsBrowse, i.e. the dataset is again in browse mode. Invoking the post method when the dataset is not in one of the editing modes () will result in an exception. If an exception occurs during the save operation, the OnPostError event is triggered to handle the error. Insert Append Edit OnPostError BeforePost AfterPost State Go to the previous record Prior moves the cursor to the previous record. It is equivalent to a MoveBy(-1) operation. Calling this method triggers the and events. If the dataset is located on the first record, (BOF is true) then no action is performed, and the events are not triggered. Calling this method on a closed dataset will result in an exception. Refresh the records in the dataset Refresh posts any pending edits, and refetches the data in the dataset from the underlying database, and attempts to reposition the cursor on the same record as it was. This operation is not supported by all datasets, and should be used with care. The repositioning may not always succeed, in which case the cursor will be positioned on the first record in the dataset. This is in particular true for unidirectional datasets. Calling Refresh results in the triggering of the BeforeRefresh and AfterRefresh events. Refreshing may fail if the underlying dataset descendent does not support it. BeforeRefresh AfterRefresh Resynchronize the data buffer Resync refetches the records around the cursor position. It should not be used by application code, instead should be used. The Resync parameter indicates how the buffers should be refreshed. How to refresh the buffers. Set a number of field values at once SetFields sets the values of the fields with the corresponding values in the array. It starts with the first field in the property, and works it's way down the array. If the dataset is not in edit mode, then an exception will be raised. If there are more values than fields, an EListError exception will be raised. Values to save in fields Transliterate a buffer Translate is called for all string fields for which the property is set to True. The toOEM parameter is set to True if the transliteration must happen from the used codepage to the codepage used for storage, and if it is set to False then the transliteration must happen from the native codepage to the storage codepage. This call must be overridden by descendents of TDataset to provide the necessary transliteration: TDataset just copies the contents of the Src buffer to the Dest buffer. The result must be the number of bytes copied to the destination buffer. No checks are performed on the bufffers. Number of written bytes. Source buffer Destination buffer Should translation happen from native to OEM codepage or vice versa ? Update cursor position UpdateCursorPos should not be used in application code. It is used to ensure that the logical cursor position is the correct (physical) position. Indicate that the record contents have changed UpdateRecord notifies controls that the contents of the current record have changed. It triggers the event. This should never be called by application code, and is intended only for descendents of TDataset. OnUpdateRecord Get the update status for the current record UpdateStatus always returns usUnModified in the TDataset implementation. Descendent classes should override this method to indicate the status for the current record in case they support cached updates: the function should return the status of the current record: has the record been locally inserted, modified or deleted, or none of these. UpdateStatus is not used in TDataset itself, but is provided so applications have a unique API to work with datasets that have support for cached updates. Status of the current record Is the cursor at the beginning of the data (on the first record) BOF returns True if the first record is the first record in the dataset, False otherwise. It will always be True if the dataset is just opened, or after a call to . As soon as is called, BOF will no longer be true. Get or set the current cursor position

Bookmark can be read to obtain a bookmark to the current position in the dataset. The obtained value can be used to return to current position at a later stage. Writing the Bookmark property with a value previously obtained like this, will reposition the dataset on the same position as it was when the property was read.

This is often used when scanning all records, like this:

Var B : TBookmarkStr; begin With MyDataset do begin B:=Bookmark; DisableControls; try First; While Not EOF do begin DoSomething; Next; end; finally EnableControls; Bookmark:=B; end; end;

At the end of this code, the dataset will be positioned on the same record as when the code was started. The and calls prevent the controls from receiving update notifications as the dataset scrolls through the records, tus recuding flicker on the screen.

Note that bookmarks become invalid as soon as the dataset closes. A call to refresh may also destroy the bookmarks.

Can the data in the dataset be modified CanModifiy indicates whether the dataset allows editing. Unidirectional datasets do not allow editing. Descendent datasets can impose additioanl conditions under which the data can not be modified (read-only datasets, for instance). If the CanModify property is False, then the edit, append or insert methods will fail. Datasource this dataset is connected to. Datasource is the datasource this dataset is connected to, and from which it can get values for parameters. In TDataset, the Datasource property is not used, and is always Nil. It is up to descendent classes that actually support a datasource to implement getter and setter routines for the Datasource property. Is the dataset using persisten fields or not.

DefaultFields is True if the fields were generated dynamically when the dataset was opened. If it is False then the field instances are persistent, i;e. they were created at desin time with the fields editor. If DefaultFields is True, then for each item in the property, a field instance is created. These fields instances are freed again when the dataset is closed.

If DefaultFields is False, then there may be less field instances than there are items in the FieldDefs property. This can be the case for instance when opening a DBF file at runtime which has more fields than the file used at design time.

Indicates whether the last record has been reached.

EOF is True if the cursor is on the last record in the dataset, and no more records are available. It is also True for an empty dataset. The EOF property will be set to True in the following cases:

  1. The cursor is on the last record, and the method is called.
  2. The method is called (which is equivalent to moving to the last record and calling ).
  3. The dataset is empty when opened.

In all other cases, EOF is False. Note: when the cursor is on the last-but-one record, and Next is called (moving the cursor to the last record), EOF will not yet be True. Only if both the cursor is on the last record and Next is called, will EOF become True.

This means that the following loop will stop after the last record was visited:

With MyDataset do While not EOF do begin DoSomething; Next; end;
Number of fields FieldCount is the same as Fields.Count, i.e. the number of fields. For a dataset with persistent fields (when DefaultFields is False) then this number will be always the same every time the dataset is opened. For a dataset with dynamically created fields, the number of fields may be different each time the dataset is opened. Definitions of available fields in the underlying database FieldDefs is filled by the TDataset descendent when the dataset is opened. It represents the fields as they are returned by the particular database when the data is initially fetched from the engine. If the dataset uses dynamically created fields (when DefaultFields is True), then for each item in this list, a field i nstance will be created with default properties available in the field definition. If the dataset uses persistent fields, then the fields in the field list will be checked against the items in the FieldDefs property. If no matching item is found for a persistent field, then an exception will be raised. Items that exist in the fielddefs property but for which there is no matching field instance, are ignored. Check success of one of the Find methods Found is True if the last of one of the ,, or operations was succesful. Was the current record modified ? Modified is True if the current record was modified after a call to or . It becomes True if a value was written to one of the fields of the dataset. Is the dataset unidirectional (i.e. forward scrolling only)

IsUniDirectional is True if the dataset is unidirectional. By default it is False, i.e. scrolling backwards is allowed. If the dataset is unidirectional, then any attempt to scroll backwards (using one of or ), random positioning of the cursor, editing or filtering will result in an . Unidirectional datasets are also not suitable for display in a grid, as they have only 1 record in memory at any given time: they are only useful for performing an action on all records:

With MyDataset do While not EOF do begin DoSomething; Next; end;
Number of records in the dataset

RecordCount is the number of records in the dataset. This number is not necessarily equal to the number of records returned by a query. For optimization purposes, a TDataset descendent may choose not to fetch all records from the database when the dataset is opened. If this is the case, then the RecordCount will only reflect the number of records that have actually been fetched at the current time, and therefor the value will change as more records are fetched from the database.

Only when Last has been called (and the dataset has been forced to fetch all records returned by the database), will the value of RecordCount be equal to the number of records returned by the query.

In general, datasets based on in-memory data or flat files, will return the correct number of records in RecordCount.

Current record number

RecNo returns the current position in the dataset. It can be written to set the cursor to the indicated position. This property must be implemented by TDataset descendents, for TDataset the property always returns -1.

This property should not be used if exact positioning is required. it is inherently unreliable.

Size of the record in memory RecordSize is the total size of the memory buffer used for the records. This property returns always 0 in the TDataset implementation. Descendent classes should implement this property. Note that this property does not necessarily reflect the actual data size for the records. that may be more or less, depending on how the TDataset descendent manages it's data. Current operational state of the dataset

State determines the current operational state of the dataset. During it's lifetime, the dataset is in one of many states, depending on which operation is currently in progress:

  • If a dataset is closed, the State is dsInactive.
  • As soon as it is opened, it is in dsBrowse mode, and remains in this state while changing the cursor position.
  • If the Edit or Insert or Append methods is called, the State changes to dsEdit or dsInsert, respectively.
  • As soon as edits have been posted or cancelled, the state is again dsBrowse.
  • Closing the dataset sets the state again to dsInactive.

There are some other states, mainly connected to internal operations, but which can become visible in some of the dataset's events.

Indexed access to the fields of the dataset. Fields provides access to the fields of the dataset. It is of type and therefore gives indexed access to the fields, but also allows other operations such as searching for fields based on their names or getting a list of fieldnames. Acces to field values based on the field names.

FieldValues provides array-like access to the values of the fields, based on the names of the fields. The value is read or written as a variant type. It is equivalent to the following:

FieldByName(FieldName).AsVariant

It can be read as well as written.

Name of the field for which the value must be read or written. Filter to apply to the data in memory.

Filter is not implemented by TDataset. It is up to descendent classes to implement actual filtering: the filtering happens on in-memory data, and is not applied on the database level. (in particular: setting the filter property will in no way influence the WHERE clause of an SQL-based dataset).

In general, the filter property accepts a SQL-like syntax usually encountered in the WHERE clause of an SQL SELECT statement.

The filter is only applied if the Filtered property is set to True. If the Filtered property is False, the Filter property is ignored.

Is the filter active or not. Filtered determines whether the filter condition in is applied or not. The filter is only applied if the Filtered property is set to True. If the Filtered property is False, the Filter property is ignored. Options to apply when filtering FilterOptions determines what options should be taken into account when applying the filter in , such as case-sensitivity or whether to treat an asterisk as a wildcard: By default, an asterisk (*) at the end of a literal string in the filter expression is treated as a wildcard. When FilterOptions does not include foNoPartialCompare, strings that have an asterisk at the end, indicate a partial string match. In that case, the asterisk matches any number of characters. If foNoPartialCompare is included in the options, the asterisk is regarded as a regular character. Is the dataset open or closed. Active is True if the dataset is open, and False if it is closed ( is then dsInactive). Setting the Active property to True is equivalent to calling , setting it to False is equivalent to calling How often should the value of calculated fields be calculated

AutoCalcFields is by default true, meaning that the values of calculated fields will be computed in the following cases:

  • When the dataset is opened
  • When the dataset is put in edit mode
  • When a data field changed

When AutoCalcFields is False, then the calculated fields are called whenever

  • The dataset is opened
  • The dataset is put in edit mode

Both proper calculated fields and lookup fields are computed. Calculated fields are computed through the event.

Event triggered before the dataset is opened. BeforeOpen is triggered before the dataset is opened. No actions have been performed yet when this event is called, and the dataset is still in dsInactive state. It can be used to set parameters and options that influence the opening process. If an exception is raised during the event handler, the dataset remains closed. Event triggered after the dataset is opened. AfterOpen is triggered after the dataset is opened. The dataset has fetched its data and is in dsBrowse state when this event is triggered. If the dataset is not empty, then a event will be triggered immediatly after the AfterOpen event. If an exception is raised during the event handler, the dataset remains open, but the AfterScroll event will not be triggered. Event triggered before the dataset is closed. BeforeClose is triggered before the dataset is closed. No actions have been performed yet when this event is called, and the dataset is still in dsBrowse state or one of the editing states. It can be used to prevent closing of the dataset, for instance if there are pending changes not yet committed to the database. If an exception is raised during the event handler, the dataset remains opened. Event triggered after the dataset is closed AfterOpen is triggered after the dataset is opened. The dataset has discarded its data and has cleaned up it's internal memory structures. It is in dsInactive state when this event is triggered. Event triggered before the dataset is put in insert mode. BeforeInsert is triggered at the start of the or methods. The dataset is still in dsBrowse state when this event is triggered. If an exception is raised in the BeforeInsert event handler, then the dataset will remain in dsBrowse state, and the append or insert operation is cancelled. Event triggered after the dataset is put in insert mode. AfterInsert is triggered after the dataset has finished putting the dataset in dsInsert state and it has initialized the new record buffer. This event can be used e.g. to set initial field values. After the Afterinsert event, the event is still triggered. Raising an exception in the AfterInsert event, will prevent the AfterScroll event from being triggered, but does not undo the insert or append operation. Event triggered before the dataset is put in edit mode. BeforeEdit is the triggered at the start of the method. The dataset is still in dsBrowse state when this event is triggered. If an exception is raised in the BeforeEdit event handler, then the dataset will remain in dsBrowse state, and the edit operation is cancelled. Event triggered after the dataset is put in edit mode. AfterEdit is triggered after the dataset has finished putting the dataset in dsEdit state and it has initialized the edit buffer for the record. Raising an exception in the AfterEdit event does not undo the edit operation. Event called before changes are posted to the underlying database BeforePost is triggered at the start of the method, when the datset is still in one of the edit states (dsEdit,dsInsert). If the dataset was not in an edit state when Post is called, the BeforePost event is not triggered. This event can be used to supply values for required fields that have no value yet (the Post operation performs the check on required fields only after this event), or it can be used to abort the post operation: if an exception is raised during the BeforePost operation, the posting operation is cancelled, and the dataset remains in the editing state it was in before the post operation. Event called after changes have been posted to the underlying database AfterPost is triggered when the operation was succesfully completed, and the dataset is again in dsBrowse state. If an error occured during the post operation, then the AfterPost event is not called, but the event is triggered instead. Event triggered before a Cancel operation. BeforeCancel is triggered at the start of the operation, when the state is still one of the editing states (dsEdit,dsInsert). The event handler can be used to abort the cancel operation: if an exception is raised during the event handler, then the cancel operation stops. If the dataset was not in one of the editing states when the Cancel method was called, then the event is not triggered. Event triggered after a Cancel operation. AfterCancel is triggered when the operation was succesfully completed, and the dataset is again in dsBrowse state. Event triggered before a Delete operation. BeforeDelete is triggered at the start of the operation, when the dataset is still in dsBrowse state. The event handler can be used to abort the delete operation: if an exception is raised during the event handler, then the delete operation stops. The event is followed by a event. If the dataset was in insert mode when the Delete method was called, then the event will not be called, as is called instead. Event triggered after a succesful Delete operation. AfterDelete is triggered after the succesfull completion of the operation, when the dataset is again in dsBrowse state. The event is followed by a event. Event triggered before the cursor changes position. BeforeScroll is triggered before the cursor changes position. This can happen with one of the navigation methods: , , , , but also with two of the editing operations: and . Raising an exception in this event handler aborts the operation in progress. Event triggered after the cursor has changed position. AfterScroll is triggered after the cursor has changed position. This can happen with one of the navigation methods: , , , , but also with two of the editing operations: and and after the dataset was opened. It is suitable for displaying status information or showing a value that needs to be calculated for each record. Event triggered before the data is refreshed. BeforeRefresh is triggered at the start of the method, after the dataset has been put in browse mode. If the dataset cannot be put in browse mode, the BeforeRefresh method wil not be triggered. If an exception is raised during the BeforeRefresh method, then the refresh method is cancelled and the dataset remains in the dsBrowse state. Event triggered after the data has been refreshed. AfterRefresh is triggered at the end of the method, after the dataset has refreshed its data and is again in dsBrowse state. This event can be used to react on changes in data in the current record Event triggered when values for calculated fields must be computed. OnCalcFields is triggered whenever the dataset needs to (re)compute the values of any calculated fields in the dataset. It is called very often, so this event should return as quickly as possible. Only the values of the calculated fields should be set, no methods of the dataset that change the data or cursor position may be called during the execution of this event handler. The frequency with which this event is called can be controlled through the property. Note that the value of lookup fields does not need to be calculated in this event, their value is computed automatically before this event is triggered. Event triggered when a delete operation fails.

OnDeleteError is triggered when the method fails to delete the record in the underlying database. The event handler can be used to indicate what the response to the failed delete should be. To this end, it gets the exception object passed to it (parameter E), and it can examine this object to return an appropriate action in the DataAction parameter. The following responses are supported:

daFail
daAbort
daRetry

For more information, see also the description of the event handler type.

Event triggered when an edit operation fails.

OnEditError is triggered when the method fails to put the dataset in edit mode because the underlying database engine reported an error. The event handler can be used to indicate what the response to the failed edit operation should be. To this end, it gets the exception object passed to it (parameter E), and it can examine this object to return an appropriate action in the DataAction parameter. The following responses are supported:

daFail
daAbort
daRetry

For more information, see also the description of the event handler type.

Event triggered to filter records. OnFilterRecord can be used to provide event-based filtering for datasets that support it. This event is only triggered when the property is set to True. The event handler should set the Accept parameter to True if the current record should be accepted, or to False if it should be rejected. No methods that change the state of the dataset may be used during this event, and calculated fields or lookup field values are not yet available. Event triggered when a new record is created. OnNewRecord is triggered by the or methods when the buffer for the new record's data has been allocated. This event can be used to set default value for some of the fields in the dataset. If an exception is raised during this event handler, the operation is cancelled and the dataset is put again in browse mode ( is again dsBrowse). Event triggered when a post operation fails.

OnPostError is triggered when the method fails to post the changes in the dataset buffer to the underlying database, because the database engine reported an error. The event handler can be used to indicate what the response to the failed post operation should be. To this end, it gets the exception object passed to it (parameter E), and it can examine this object to return an appropriate action in the DataAction parameter. The following responses are supported:

daFail
daAbort
daRetry

For more information, see also the description of the event handler type.

Data event handling agent for controls

TDataLink is used by GUI controls or datasets in a master-detail relationship to handle data events coming from a instance. It is a class that exists for component programmers, application coders should never need to use TDataLink or one of it's descendents.

DB-Aware Component coders must use a TDatalink instance to handle all communication with a instance, rather than communicating directly with the dataset. TDataLink contains methods which are called by the various events triggered by the dataset. Inversely, it has some methods to trigger actions in the dataset.

TDatalink is an abstract class; it is never used directly. Instead, a descendent class is used which overrides the various methods that are called in response to the events triggered by the dataset. Examples are .

Initialize a new instance of TDataLink Create calls the inherited constructor and then initializes some fields. In particular, it sets the buffercount to 1. Remove an instance of TDatalink from memory Destroy cleans up the TDatalink instance (in particular, it removes itself from the datasource it is coupled to), and then calls the inherited destructor. Set the dataset in edit mode, if possible Edit attempts to put the dataset in edit mode. It returns True if this operation succeeded, False if not. To this end, it calls the Edit method of the DataSource to which the datalink instance is coupled. If the property is False then this operation will not succeed, inless the dataset is already in edit mode. GUI controls should always respect the result of this function, and not allow the user to edit data if this function returned false. True if the dataset is ready for editing. Called when the data in the dataset must be updated Updaterecord is called when the dataset expects the GUI controls to post any pending changes to the dataset. This method guards against recursive behaviour: while an UpdateRecord is in progress, the notification (which could result from writing data to the dataset) will be blocked. Execute action ExecuteAction implements action support. It should never be necessary to call ExecuteAction from program code, as it is called automatically whenever a target control needs to handle an action. This method must be overridden in case any additional action must be taken when the action must be executed. The implementation in TDatalink checks if the action handles the datasource, and then calls Action.ExecuteTarget, passing it the datasource. If so, it returns True. Action was executed succesfully Action to execute Update handler for actions UpdateAction implements action update support. It should never be necessary to call UpdateAction from program code, as it is called automatically whenever a target control needs to update an action. This method must be overridden in case any specific action must be taken when the action must be updated. The implementation in TDatalink checks if the action handles the datasource, and then calls Action.UpdateTarget, passing it the datasource. If so, it returns True. True if the action handles the datalink's datasource. Action to check Is the link active Active determines whether the events of the dataset are passed on to the control connected to the actionlink. If it is set to False, then no events are passed between control and dataset. It is set to whenever the DataSource property is set. Currently active record ActiveRecord returns the index of the active record in the dataset's record buffer for this datalink. Is the dataset at the first record BOF returns if the dataset is available, True otherwise. Set to the number of record buffers this datalink needs. BufferCount can be set to the number of buffers that the dataset should manage on behalf of the control connected to this datalink. By default, this is 1. Controls that must display more than 1 buffer (such as grids) can set this to a higher value. Dataset this datalink is connected to Dataset equals Datasource.Dataset if the datasource is set, or Nil otherwise. Datasource this datalink is connected to Datasource should be set to a instance to get access to the dataset it is connected to. A datalink never points directly to a instance, always to a datasource. When the datasource is enabled or disabled, all TDatalink instances connected to it are enabld or disabled at once. Can the datasource be changed DatasourceFixed can be set to True to prevent changing of the DataSource property. When lengthy operations are in progress, this can be done to prevent user code (e.g. event handlers) from changing the datasource property which might interfere with the operation in progress. Is the dataset in edit mode Editing determines whether the dataset is in one of the edit states (dsEdit,dsInsert). It can be set into this mode by calling the method. Never attempt to set the dataset in editing mode directly. The Edit method will perform the needed checks prior to setting the dataset in edit mode and will return True if the dataset was succesfully set in the editing state. EOF returns if the dataset is available, True otherwise. Is the link readonly ReadOnly can be set to True to indicate that the link is read-only, i.e. the connected control will not modify the dataset. Methods as will check this property and fail if the link is read-only. This setting has no effect on the communication of dataset events to the datalink: the property can be used to disable delivey of events to the datalink. Number of records in the buffer of the dataset RecordCount returns the number of records in the dataset's buffer. It is limited by the property: RecordCount i s always less than Buffercount. Detail dataset in Master-detail relation DetailDataset is the detail dataset in a master-detail relationship between 2 datasets. DetailDataset is always Nil in TDetailDatalink and is only filled in in descendent classes like . The master dataset is available through the regular property. Datalink for Master-Detail relationships between datasets.

TMasterDataLink is a TDatalink descendent which handles master-detail relations. It can be used in descendents that must have master-detail functionality: the detail dataset creates an instance of TMasterDataLink to point to the master dataset, which is subsequently available through the property.

The class also provides functionailty for keeping a list of fields that make up the master-detail functionality, in the and properties.

This class should never be used in application code.

Create a new instance of TMasterDataLink Create initializes a new instance of TMasterDataLink. The ADataset parameter is the detail dataset in the master-detail relation: it is saved in the DetailDataset property. The master dataset must be set through the DataSource property, and is usually set by the applictaion programmer. Detail dataset of the master-detail relation. Free the datalink instance from memory Destroy cleans up the resources used by TMasterDatalink and then calls the inherited destructor. List of fieldnames that make up the master-detail relationship FieldNames is a semicolon-separated list of fieldnames in the master dataset () on which the master-detail relationship is based. Setting this property will fill the property with the field instances of the master dataset. List of fields as specified in FieldNames Fields is filled with the instances from the master dataset () when the FieldNames property is set, and when the master dataset opens. Called whenever the master dataset data changes OnMasterChange is called whenever the field values in the master dataset changes, i.e. when it becomes active, or when the current record changes. If the list is empty, is called instead. Called whenever the master dataset is disabled OnMasterDisable is called whenever the master dataset is disabled, or when it is active and the field list is empty. Event handler prototype when a field's data has changed. TDataChangeEvent is the event handler prototype for the event. The sender parameter is the TDatasource instance that triggered the event, and the Field parameter is the field whose data has changed. If the dataset has scrolled, then the Field parameter is Nil. Datasource that triggered the event Field that changed, or Nil if record changed. Create a new instance of TDatasource Create initializes a new instance of TDatasource. It simply allocates some resources and then calls the inherited constructor. Owner for the new TDatasource instance. Remove a TDatasource instance from memory Destroy notifies all instances connected to it that the dataset is no loner available, and then removes itself from the TDatalink instance. It then cleans up all resources and calls the inherited constructor. Put the dataset in edit mode, if needed Edit will check AutoEdit: if it is True, then it puts the Dataset it is connected to in edit mode, if it was in browse mode. If AutoEdit is False, then nothing happens. Application or component code that deals with GUI development should always attempt to set a dataset in edit mode through this method instead of calling directly. An exception can occur if the dataset is read-only or fails to set itself in edit mode. (e.g. unidirectional datasets). Check if a dataset is linked to a certain dataset IsLinkedTo checks if it is somehow linked to ADataset: it checks the Dataset property, and returns True if it is the same. If not, it continues by checking any detail dataset fields that the dataset posesses (recursively). This function can be used to detect circular links in e.g. master-detail relationships. True if the datasource is linked to ADataset Dataset to check State of the dataset State contains the State of the dataset it is connected to, or dsInactive if the dataset property is not set or the datasource is not enabled. Components connected to a dataset through a datasource property should always check TDatasource.State instead of checking directly, to take into account the effect of the Enabled property. Should the dataset be put in edit mode automatically AutoEdit can be set to True to prevent visual controls from putting the dataset in edit mode. Visual controls use the method to attempt to put the dataset in edit mode as soon as the user changes something. If AutoEdit is set to False then the Edit method does nothing. The effect is that the user must explicitly set the dataset in edit mode (by clicking some button or some other action) before the fields can be edited. Dataset this datasource is connected to Dataset must be set by the applictaion programmer to the instance for which this datasource is handling events. Setting it to Nil will disable all controls that are connected to this datasource instance. Once it is set and the datasource is enabled, the datasource will start sending data events to the controls or components connected to it. Enable or disable sending of events Enabled is by default set to True: the datasource instance communicates events from the dataset to components connected to the datasource, and vice versa: components can interact with the dataset. If the Enabled property is set to False then no events are communicated to connected components: it is as if the dataset property was set to Nil. Reversely, the components cannot interact with the dataset if the Enabled property is set to False. Called whenever the state of the dataset changes OnStateChange is called whenever the property changes, and the datasource is enabled. It can be used in application code to react to state changes: enabling or disabling non-DB-Aware controls, setting empty values etc. Called whenever data changes in the current record OnDatachange is called whenever a field value changes: if the Field parameter is set, a single field value changed. If the Field parameter is Nil, then the whole record changed: when the dataset is opened, when the user scrolls to a new record. This event handler can be set to react to data changes: to update the contents of non-DB-aware controls for instance. The event is not called when the datasource is not enabled. Called whenever the data in the dataset must be updated OnUpdateData is called whenever the dataset needs the latest data from the controls: usually just before a operation. It can be used to copy data from non-db-aware controls to the dataset just before the dataset is posting the changes to the underlying database. Class of TDBDataset TDBDatasetClass is the class pointer for Dataset connected to a database.

TDBDataset is a TDataset descendent which introduces the concept of a database: a central component () which represents a connection to a database. This central component is exposed in the property. When the database is no longer connected, or is no longer in memory, all TDBDataset instances connected to it are disabled.

TDBDataset also introduces the notion of a transaction, exposed in the Transaction property.

TDBDataset is an abstract class, it should never be used directly.

Dataset component writers should descend their component from TDBDataset if they wish to introduce a central database connection component. The database connection logic will be handled automatically by TDBDataset.

Remove the TDBDataset instance from memory. Destroy will disconnect the TDBDataset from its Database and Transaction. After this it calls the inherited destructor. Database this dataset is connected to

Database should be set to the instance this dataset is connected to. It can only be set when the dataset is closed.

Descendent classes should check in the property setter whether the database instance is of the correct class.

If the property is set when the dataset is active, an exception will be raised.
Transaction in which this dataset is running.

Transaction points to a component that represents the transaction this dataset is active in. This property should only be used for databases that support transactions.

The property can only be set when the dataset is disabled.

Class of TDBTransaction TDBTransactionClass is the class pointer for the class. Transaction property Create initializes a new TDBTransaction instance. It sets up the necessary resources, after having called the inherited constructor. Owner for the new TDBTransaction instance. Remove a TDBTransaction instance from memory. Destroy first disconnects all connected instances and then cleans up the resources allocated in the Create constructor. After that it calls the inherited destructor. Close all connected datasets CloseDatasets closes all connected datasets (All instances whose Transaction property points to this TDBTransaction instance). Database this transaction is connected to Database points to the database that this transaction is part of. This property can be set only when the transaction is not active. Setting this property to a new value when the transaction is active will result in an exception. Is the transaction active or not Active is True if a transaction was started using . Reversely, setting Active to True will call StartTransaction, setting it to False will call . Login event handler TLoginEvent is the prototype for a the the event handler. It gets passed the TCustomConnection instance that is trying to login, and the initial username and password. TCustomConnection that is attempting a login Username used to log in Password used to log in. Abstract class for connections to a server TCustomConnection must be used for all database classes that need a connection to a server. The class introduces some methods and classes to activate the connection (Open) and to deactivate the connection (), plus a property to inspect the state (Connected) of the connected. Close the connection

Close closes the connection with the server if it was connected. Calling this method first triggers the BeforeDisconnect event. If an exception is raised during the execution of that event handler, the disconnect process is aborted. After calling this event, the connection is actually closed. After the connection was closed, the AfterDisconnect event is triggered.

Calling the Close method is equivalent to setting the Connected property to False.

If ForceClose is True then the descendent should ignore errors from the underlying connection, allowing all datasets to be closed properly.

If the connection cannot be broken for some reason, an exception will be raised.
Remove the TCustomconnection instance from memory Destroy closes the connection, and then calls the inherited destructor. If an exception is raised during the disconnect process, an exception will be raise, and the instance is not removed from memory. Makes the connection to the server

Open establishes the connection with the server if it was not yet connected. Calling this method first triggers the BeforeConnect event. If an exception is raised during the execution of that event handler, the connect process is aborted. If LoginPrompt is True, the OnLogin event handler is called. Only after this event, the connection is actually established. After the connection was established, the AfterConnect event is triggered.

Calling the Open method is equivalent to setting the Connected property to True.

If an exception is raised during the BeforeConnect or OnLogin handlers, the connection is not actually established.
Number of datasets connected to this connection DatasetCount is the number of datasets connected to this connection component. The actual datasets are available through the Datasets array property. As implemented in TCustomConnection, this property is always zero. Descendent classes implement the actual count. Datasets linked to this connection Datasets allows indexed access to the datasets connected to this connection. Index is a zero-based indexed, it's maximum value is DatasetCount-1. DatasetCount Zero based index, upper bound equals DatasetCount-1 Is the connection established or not Connected is True if the connection to the server is established, False if it is disconnected. The property can be set to True to establish a connection (equivalent to calling , or to False to break it (equivalent to calling . Should the OnLogin be triggered LoginPrompt can be set to True if the OnLogin handler should be called when the Open method is called. If it is not True, then the event handler is not called. Event triggered after a connection is made. AfterConnect is called after a connection is succesfully established in . It can be used to open datasets, or indicate a connection status change. Event triggered after a connection is closed AfterDisConnect is called after a connection is succesfully closed in . It can be used for instance to indicate a connection status change. Event triggered before a connection is made. BeforeConnect is called before a connection is attempted in . It can be used to set connection parameters, or to abort the establishing of the connection: if an exception is raised during this event, the connection attempt is aborted. Event triggered before a connection is closed BeforeDisConnect is called before a connection is closed in . It can be used for instance to check for unsaved changes, to save thise changes, or to abort the disconnect operation: if an exception is raised during the event handler, the disconnect operation is aborted entirely. Event triggered when a login prompt is shown. OnLogin is triggered when the connection needs a login prompt during the call: it is triggered when the LoginPrompt property is True, after the event, but before the connection is actually established. Class pointer for TDatabase. TDatabaseClass is the class pointer for the class. Initialize a new TDatabase class instance. Create initializes a new instance of the TDatabase class. It allocates some resources and then calls the inherited constructor. Owner for the new TDatabase instance. Remove a TDatabase instance from memory. Destroy starts by disconnecting the database (thus closing all datasets and ending all transactions), then notifies all connected datasets and transactions that it is about to be released. After this, it releases all resources used by the TDatabase instance Close all connected datasets CloseDatasets closes all connected datasets. It is called automatically when the connection is closed. End all transactions CloseTransaction calls on all connected transactions. It is called automatically when the connection is closed, after all datasets are closed. Start a new transaction. StartTransaction must be implemented by descendent classes to start a new transaction. This method is provided for Delphi compatibility: new applications shoud use a component instead and invoke the method. End an active transaction. EndTransaction must be implemented by descendent classes to end an active transaction. This method is provided for Delphi compatibility: new applications shoud use a component instead and invoke the method. Number of transaction components connected to this database. TransactionCount is the number of transaction components which are connected to this database instance. It is the upper bound for the array property. Indexed access to all transaction components connected to this database. Transactions provides indexed access to the transaction components connected to this database. The Index is zero based: it runs from 0 to TransactionCount-1. Zero based array index Directory for the database Directory is provided for Delphi compatibility: it indicates (for Paradox and dBase based databases) the directory where the database files are located. It is not used in the Free Pascal implementation of . Is the database SQL based. IsSQLbased is a read-only property which indicates whether a property is SQL-Based, i.e. whether the database engine accepts SQL commands. Is the datbase connected Connected is simply promoted to published property from . Database name or path DatabaseName specifies the path of the database. For directory-based databases this will be the same as the Directory property. For other databases this will be the name of a known pre-configured connection, or the location of the database file. Should the connection be kept active KeepConnection is provided for Delphi compatibility, and is not used in the Free Pascal implementation of TDatabase. Connection parameters Params is a catch-all storage mechanism for database connection parameters. It is a list of strings in the form of Name=Value pairs. Which name/value pairs are supported depends on the TDatabase descendent, but the user_name and password parameters are commonly used to store the login credentials for the database. Alias type to store blob data TBlobData should never be used directly in application code. Auxiliary type, used when binding parameters. TParamBinding is an axuiliary type used when parsing and binding parameters in SQL statements. It should never be used directly in application code. Parameter type

TParamType indicates the kind of parameter represented by a instance. it has one of the following values:

ptUnknown
ptInput
ptOutput
ptInputOutput
ptResult
Unknown type Input parameter Output paramete, filled on result Input/output parameter Result parameter Set of TParamType TParamTypes is defined for completeness: a set of values. Style of parameter

TParamStyle denotes the style in which parameters are specified in a query. It is used in the method, and can have the following values:

psInterbase
psPostgreSQL
psSimulated
Parameters are specified by a ? character Parameters are specified by a $N character. Parameters are specified by a $N character. A collection of parameter values for SQL-based datasets

TParams is a collection of values. It is used to specify parameter values for parametrized SQL statemens, but is also used to specify parameter values for stored procedures. Its default property is an array of values. The class also offers a method to scan a SQL statement for parameter names and replace them with placeholders understood by the SQL engine: .

itself does not use TParams. The class is provided in the DB unit, so all TDataset descendents that need some kind of parametrization make use of the same interface. The class can be used to establish a master-detail relationship between a parameter-aware TDataset instance and another dataset; it will automatically refresh parameter values when the fields in the master dataset change. To this end, the method exists.

Parameter description class TParam is one item in a collection. It describes the name (), type (ParamType) and value () of a parameter in a parametrized query or stored procedure. Under normal circumstances, it should never be necessary to create a TParam instance manually; the descendent that owns the parameters should have created all necessary TParam instances. Create a new parameter value Create first calls the inherited create, and then initializes the parameter properties. The first form creates a default parameter, the second form is a convenience function and initializes a parameter of a certain kind (AParamType), in which case the owning TParams collection must be specified in AParams Collection this parameter is part of TParams instance this parameter is part of Parameter type for the new parameter instance Assign one parameter instance to another Assign copies the Name, ParamType, Bound, Value, Size Precision and NumericScale properties from ASource if it is of type TParam. If Source is of type , then it is passed to . If Source is of type TStrings, then it is assigned to . If Source is not of type TParam, TField or TStrings, an exception will be raised. Source object to copy value from Copy value from field instance AssignField copies the Field, FieldName and Value to the parameter instance. The parameter is bound after this operation. If Field is Nil then the parameter name and value are cleared. Field instance to copy field name and value from. Assign parameter value to field AssignToField copies the parameter value to the field instance. If Field is Nil, nothing happens. An exception is raised if the field has an unsupported field type (for types ftCursor, ftArray, ftDataset,ftReference). Field instance to assign value to. Assign field value to the parameter. AssignFieldValue copies only the field type from Field and the value from the AValue parameter. It sets the bound parameter to True. This method is called from . Field to copy parameter type from. Value to assign to parameter. Copy field type and value AssignFromField copies the field value and data type () to the parameter instance. If Field is Nil, nothing happens. This is the reverse operation of . An exception is raised if the field has an unsupported field type (for types ftCursor, ftArray, ftDataset,ftReference). Field to copy type and value from. Clear the parameter value Clear clears the parameter value, it is set to UnAssigned. The Datatype, parameter type or name are not touched. Get the parameter value from a memory buffer GetData retrieves the parameter value and stores it in buffer It uses the same data layout as , and can be used to copy the parameter value to a record buffer. Only basic field types are supported. Using an unsupported field type will result in an exception. Buffer to copy parameter value to. Return the size of the data. GetDataSize returns the size (in bytes) needed to store the current value of the parameter. For an unsupported data type, an exception is raised when this function is called. Size (in bytes) for the current value Load a parameter value from file LoadFromFile can be used to load a BLOB-type parameter from a file named FileName. The BlobType parameter can be used to set the exact data type of the parameter: it must be one of the BLOB data types. This function simply creates a TFileStream instance and passes it to . If the specified FileName is not a valid file, or the file is not readable, an exception will occur. Name of existing file to load blob data from. New value for DataType Load a parameter value from stream LoadFromStream can be used to load a BLOB-type parameter from a stream. The BlobType parameter can be used to set the exact data type of the parameter: it must be one of the BLOB data types. If the stream does not support taking the Size of the stream, an exception will be raised. Stream to load BLOB data from. Data type for the parameter Set BLOB data SetBlobData reads the value of a BLOB type parameter from a memory buffer: the data is read from the memory buffer Buffer and is assumed to be Size bytes long. No checking is performed on the validity of the data buffer. If the data buffer is invalid or the size is wrong, an exception may occur. Memory buffer to load data from Size of memory buffer to load data from Set the parameter value from a buffer SetData performs the rever operation of : it reads the parameter value from the memory area pointed to by Buffer. The size of the data read is determined by and the type of data by : it is the same storage mechanism used by , and so can be used to copy the value from a record buffer. Not all field types are supported. If an unsupported field type is encountered, an exception is raised. Buffer to read data from Return parameter value as a blob AsBlob returns the parameter value as a blob: currently this is a string. It can be set to set the parameter value. Get/Set parameter value as a boolean value AsBoolean will return the parameter value as a boolean value. If it is written, the value is set to the specified value and the data type is set to ftBoolean. Get/Set parameter value as a currency value AsCurrency will return the parameter value as a currency value. If it is written, the value is set to the specified value and the data type is set to ftCurrency. Get/Set parameter value as a date (TDateTime) value AsDate will return the parameter value as a date value. If it is written, the value is set to the specified value and the data type is set to ftDate. Get/Set parameter value as a date/time (TDateTime) value AsDateTime will return the parameter value as a TDateTime value. If it is written, the value is set to the specified value and the data type is set to ftDateTime. Get/Set parameter value as a floating-point value AsFLoat will return the parameter value as a double floating-point value. If it is written, the value is set to the specified value and the data type is set to ftFloat. Get/Set parameter value as an integer (32-bit) value AsInteger will return the parameter value as a 32-bit signed integer value. If it is written, the value is set to the specified value and the data type is set to ftInteger. Get/Set parameter value as a 64-bit integer value AsLargeInt will return the parameter value as a 64-bit signed integer value. If it is written, the value is set to the specified value and the data type is set to ftLargeInt. Get/Set parameter value as a memo (string) value AsMemo will return the parameter value as a memo (string) value. If it is written, the value is set to the specified value and the data type is set to ftMemo. Get/Set parameter value as a smallint value AsSmallint will return the parameter value as a 16-bit signed integer value. If it is written, the value is set to the specified value and the data type is set to ftSmallint. Get/Set parameter value as a string value AsString will return the parameter value as a string value. If it is written, the value is set to the specified value and the data type is set to ftString. Get/Set parameter value as a time (TDateTime) value AsTime will return the parameter value as a time (TDateTime) value. If it is written, the value is set to the specified value and the data type is set to ftTime. Get/Set parameter value as a word value AsWord will return the parameter value as an integer. If it is written, the value is set to the specified value and the data type is set to ftWord. Is the parameter value bound (set to fixed value) Bound indicates whether a parameter has received a fixed value: setting the parameter value will set Bound to True. When creating master-detail relationships, parameters with their Bound property set to True will not receive a value from the master dataset: their value will be kept. Only parameters where Bound is False will receive a new value from the master dataset. Dataset to which this parameter belongs Dataset is the dataset that owns the instance of which this TParam instance is a part. It is Nil if the collection is not set, or is not a TParams instance. Is the parameter empty IsNull is True is the value is empty or not set (Null or UnAssigned). No description available No description available Read or write the value of the parameter as a string AsText returns the same value as , but, when written, does not set the data type: instead, it attempts to convert the value to the type specified in . Value as a variant Value returns (or sets) the value as a variant value. Get/Set the value as a widestring AsWideString returns the parameter value as a widestring value. Setting the property will set the value of the parameter and will also set the DataType to ftWideString. Data type of the parameter DataType is the current data type of the parameter value. It is set automatically when one of the various AsXYZ properties is written, or when the value is copied from a field value. Name of the parameter Name is the name of the parameter. The name is usually determined automatically from the SQL statement the parameter is part of. Each parameter name should appear only once in the collection. Numeric scale NumericScale can be used to store the numerical scale for BCD values. It is currently unused. Type of parameter

ParamTyp specifies the type of parameter: is the parameter value written to the database engine, or is it received from the database engine, or both ? It can have the following value:

ptUnknown
ptInput
ptOutput
ptInputOutput
ptResult

The ParamType property is usually set by the database engine that creates the parameter instances.

Precision of the BCD value Precision can be used to store the numerical precision for BCD values. It is currently unused. Size of the parameter Size is the declared size of the parameter. In the current implementation, this parameter is ignored other than copying it from in the method. The actual size can be retrieved through the property. Create a new instance of TParams Create initializes a new instance of TParams. It calls the inherited constructor with as the collection's item class, and sets AOwner as the owner of the collection. Usually, AOwner will be the dataset that needs parameters. Owner of the collection. Add a parameter to the collection AddParam adds Value to the collection. No checks are done on the TParam instance. If it is Nil, an exception will be raised. TParam instance to add to the collection. Copy values from another collection AssignValues examines all instances in Value, and looks in its own items for a TParam instance with the same name. If it is found, then the value and type of the parameter are copied (using ). If it is not found, nothing is done. Set of parameters to copy values from. Create and add a new parameter to the collection CreateParam creates a new instance with datatype equal to fldType, Name equal to ParamName and sets its ParamType property to ParamType. The parameter is then added to the collection. Newly added TParam instance. Value for the DataType property of the new instance. Value for the Name property of the new instance. Value for the ParamType property of the new instance. Find a parameter with given name

FindParam searches the collection for the instance with property Name equal to Value. It will return the last instance with the given name, and will only return one instance. If no match is found, Nil is returned.

A TParams collection can have 2 TParam instances with the same name: no checking for duplicates is done.
TParam instance with Name equal to Value or Nil. Parameter name to search for. Fetch a list of TParam instances GetParamList examines the parameter names in the semicolon-separated list ParamNames. It searches each TParam instance from the names in the list and adds it to List. If the ParamNames list contains an unknown parameter name, then an exception is raised. Whitespace is not discarded. List to add TParam instances to. Semicolon-separated list of parameter names. Is the list of parameters equal IsEqual compares the parameter count of Value and if it matches, it compares all TParam items of Value with the items it owns. If all items are equal (all properties match), then True is returned. The items are compared on index, so the order is important. True if all items in Value match the own items Collection of TParam values. Return a parameter by name

ParamByName searches the collection for the instance with property Name equal to Value. It will return the last instance with the given name, and will only return one instance. If no match is found, an exception is raised.

A TParams collection can have 2 TParam instances with the same name: no checking for duplicates is done.
TParam instance with Name equal to Value. Name to search for. Parse SQL statement, replacing parameter names with SQL parameter placeholders

ParseSQl parses the SQL statement for parameter names in the form :ParamName. It replaces them with a SQL parameter placeholder. If DoCreate is True then a TParam instance is added to the collection with the found parameter name.

The parameter placeholder is determined by the ParameterStyle property, which can have the following values:

psInterbase
psPostgreSQL
psSimulated

psInterbase is the default.

If the EscapeSlash parameter is True, then backslash characters are used to quote the next character in the SQL statement. If it is False, the backslash character is regarded as a normal character.

If the EscapeRepeat parameter is True (the default) then embedded quotes in string literals are escaped by repeating themselves. If it is false then they should be quoted with backslashes.

ParamBinding, if specified, is filled with the indexes of the parameter instances in the parameter collection: for each SQL parameter placeholder, the index of the corresponding TParam instance is returned in the array.

ReplaceString, if specified, contains the placeholder used for the parameter names (by default, $). It has effect only when ParameterStyle equals psSimulated.

The function returns the SQL statement with the parameter names replaced by placeholders.

SQL statement with parameter names replaced with placeholders SQL statement to scan for parameter names Set to True if TParam instances must be created for the found parameters. True if the backslash character acts as an escape token. True if quotes are escaped by specifying them two times. SQL Placeholder style On return, filled with indexes of TParam instances corresponding to the placeholders Placeholder string. Remove a parameter from the collection RemoveParam removes the parameter Value from the collection, but does not free the instance. Value must be a valid instance, or an exception will be raised. Parameter to remove from the collection. Copy parameter values from a the fields in a dataset. CopyParamValuesFromDataset assigns values to all parameters in the collection by searching in ADataset for fields with the same name, and assigning the value of the field to the Tparam instances using . By default, this operation is only performed on TParam instances with their Bound property set to False. If CopyBound is true, then the operation is performed on all TParam instances in the collection. If, for some TParam instance, ADataset misses a field with the same name, an EDatabaseError exception will be raised. Dataset to copy values from Copy value also for bound parameters ? Dataset that owns the TParams instance Dataset is the instance that was specified when the TParams instance was created. Indexed access to TParams instances in the collection Items is overridden by TParams so it has the proper type (TParam). The Index runs from 0 to Count-1. Zero-based index to the array Named access to the parameter values.

ParamValues provides access to the parameter values () by name. It is equivalent to reading and writing

ParamByName(ParamName).Value
Parameter name to read/write Class to establish a master-detail relationship between dataset, based on parameters TMasterParamsDataLink is a descendent that can be used to establish a master-detail relationship between 2 TDataset instances where the detail dataset is parametrized using a TParams instance. It takes care of closing and opening the detail dataset and copying the parameter values from the master dataset whenever the data in the master dataset changes. Initialize a new TMasterParamsDataLink instance Create first calls the inherited constructor using ADataset, and then looks for a property named Params of type in the published properties of ADataset and assigns it to the Params property. Detail dataset Refresh the list of parameter names RefreshParamNames scans the Params property and sets the FieldNames property to the list of parameter names. Copy parameter values from master dataset. CopyParamsFromMaster calls , passing it the master dataset: it provides the parameters of the detail dataset with their new values. If CopyBound is false, then only parameters with their Bound property set to False are copied. If it is True then the value is set for all parameters. If the master dataset does not have a corresponding field for each parameter, then an exception will be raised. Should Bound parameters also get a new value ? Parameters of detail dataset. Params is the TParams instance of the detail dataset. If the detail dataset contains a property named Params of type TParams, then it will be set when the TMasterParamsDataLink instance was created. If the property is not published, or has another name, then the Params property must be set in code. Map field types on variant types FieldTypetoVariantMap contains for each field datatype the variant value type that corresponds to it. If a field type cannot be expressed by a variant type, then varError is stored in the variant value. Human-readable names of field types FieldTypeNames contains the names (in english) for the various field data types. Default field classes to use when creating a new TField instance. DefaultFieldClasses contains the descendent class to use when a TDataset instance needs to create fields based on the field definitions when opening the dataset. The entries can be set to create customized TField descendents for certain field datatypes in all datasets. Edit modes dsEditModes contains the various values of for which the dataset is in edit mode, i.e. states in which it is possible to set field values for that dataset. Field write modes dsWriteModes contains the various values of for which data can be written to the dataset buffer. Raise an EDatabaseError exception. DatabaseError raises an exception, passing it Msg. If Comp is specified, the name of the component is prepended to the message. Message to specify for the exception Prepend the name of this Component to the message Raise an EDatabaseError exception with a formatted message DatabaseErrorFmt raises an exception, passing it a message made by calling with the fmt and Args arguments. If Comp is specified, the name of the component is prepended to the message. Formatting string Formatting arguments Prepend the name of this Component to the message Extract the field name at position ExtractFieldName returns the string starting at position Pos till the next semicolon (;) character or the end of the string. On return, Pos contains the position of the first character after the semicolon character (or one more than the length of the string). Name of the field Semicolon-separated list of field names Position to start copying. Convert TDateTimeRec record to a TDateTime value. DateTimeRecToDateTime examines Data and Dt and uses dt to convert the timestamp in Data to a TDateTime value. TDateTime value corresponding to timestamp in Data. Datatype of Data. Timestamp specification in TDateTimeRec formar. Convert TDateTime value to a TDateTimeRec record. DateTimeToDateTimeRec examines Data and Dt and uses dt to convert the date/time valuein Data to a TDateTimeRec record. TDateTimeRec record corresponding to timestamp in Data. Datatype for result Timestam specification in TDateTime format. Dispose of a heap memory block and Nil the pointer (deprecated) DisposeMem disposes of the heap memory area pointed to by Buffer (Buffer must be of type Pointer). The Size parameter indicates the size of the memory area (it is, in fact, ignored by the heap manager). The pointer Buffer is set to Nil. If Buffer is Nil, then nothing happens. Do not use DisposeMem on objects, because their destructor will not be called. If Buffer is not pointing to a valid heap memory block, then memory corruption may occur. Pointer to memory area Size of the memory block Check whether 2 memory buffers are equal BuffersEqual compares the memory areas pointed to by the Buf1 and Buf2 pointers and returns True if the contents are equal. The memory areas are compared for the first Size bytes. If all bytes in the indicated areas are equal, then True is returned, otherwise False is returned. If Buf1 or Buf2 do not point to a valid memory area or Size is too large, then an exception may occur True if the memory areas have the same content. Pointer to first memory area. Pointer to second memory area Number of bytes to compare. Skip SQL comments

SkipComments examines the null-terminated string in P and skips any SQL comment or string literal found at the start. It returns P the first non-comment or non-string literal position. The EscapeSlash parameter determines whether the backslash character (\) functions as an escape character (i.e. the following character is not considered a delimiter). EscapeRepeat must be set to True if the quote character is repeated to indicate itself.

The function returns True if a comment was found and skipped, False otherwise.

No checks are done on the validity of P.
True if a comment was skipped. Pointer to null-terminated string containing a SQL statement. Is a backslash an escape character Are repeated quotes considered a single character Specify an edit mask for an edit control

EditMask can be used to specify an edit mask for controls that allow to edit this field. It has no effect on the field value, and serves only to ensure that the user can enter only correct data for this field.

For more information on valid edit masks, see the documentation of the GUI controls.

Alias for EditMask EditMaskPtr is a read-only alias for the EditMask property. It is not used. Specify an edit mask for an edit control

EditMask can be used to specify an edit mask for controls that allow to edit this field. It has no effect on the field value, and serves only to ensure that the user can enter only correct data for this field.

TDateTimeField just changes the visibility of the EditMark property, it is introduced in TField.

For more information on valid edit masks, see the documentation of the GUI controls.

Specify an edit mask for an edit control

EditMask can be used to specify an edit mask for controls that allow to edit this field. It has no effect on the field value, and serves only to ensure that the user can enter only correct data for this field.

TStringField just changes the visibility of the EditMark property, it is introduced in TField.

For more information on valid edit masks, see the documentation of the GUI controls.

Set the field type SetFieldType is overridden in to check the data type more accurately (ftString and ftFixedChar). No extra functionality is added. Set the field type SetFieldType is overridden in to check the data type more accurately (ftWideString and ftFixedWideChar). No extra functionality is added. Return an enumerator for the for..in construct GetEnumerator is the implementation of IEnumerable and returns an instance of Default enumerator for the fields collection of a dataset.

TFieldsEnumerator implements all the methods of IEnumerator so a instance can be used in a for..in construct. TFieldsEnumerator returns all the fields in the TFields collection. Therefor the following construct is possible:

Var F : TField; begin // ... For F in MyDataset.Fields do begin // F is of type TField. end; // ...

Do not create an instance of TFieldsEnumerator manually. The compiler will do all that is needed when it encounters the for..in construct.

Create a new instance of TFieldsEnumerator. Create instantiates a new instance of TFieldsEnumerator. It stores the AFields reference, pointing to the instance that created the enumerator. It initializes the enumerator position. Move the current field to the next field in the collection. MoveNext moves the internal pointer to the next field in the fields collection, and returns True if the operation was a success. If no more fields are available, then False is returned. Return the current field Current returns the current field. It will return a non-nil value only after MoveNext returned True. Originally raised exception OriginalException is the originally raised exception that is transformed to an EUpdateError exception. Retrieve the contents of the field as an array of bytes AsBytes returns the contents of the field as an array of bytes. For blob data this is the actual blob content. Value to set the field type to. Value to set the field type to. Fixed precision floating point data field TFMTBCDField is the field created when a data type of ftFMTBCD is encountered. It represents usually a fixed-precision floating point data type (BCD : Binary Coded Decimal data) such as the DECIMAL or NUMERIC field types in an SQL database. Create a new instance of the TFMTBCDField class. Create initializes a new instance of the TFMTBCDField class: it sets the , , Size (15) and (2) fields to their default values. Size Owner of the field, usually the dataset. Check value if it is in the range defined by MinValue and MaxValue CheckRange checks whether AValue is between and if they are both nonzero. If either of them is zero, then True is returned. The MinValue and MaxValue values themselves are also valid values. True if AValue is in the range [MinValue,MaxValue] Value to check The value of the field as a BCD value Value is the value of the field as a BCD (Binary Coded Decimal) value. Total number of digits in the BCD data Precision is the total number of digits in the BCD data. The maximum precision is 32. Does the field contain currency data ? Currency determines how the textual representation of the data is formatted. It has no influence on the actual data itself. If True it is represented as a currency (monetary value). If DisplayFormat or EditFormat are set, these values are used instead to format the value. Maximum value for the field MaxValue can be set to a nonzero value to indicate the maximum value the field may contain. It must be set together with or it will not have any effect. Minimum value for the field MinValue can be set to a nonzero value to indicate the maximum value the field may contain. It must be set together with or it will not have any effect. Number of digits after the decimal point Size is the maximum number of digits allowed after the decimal point. Together with the property it determines the maximum allowed range of values for the field. This range can be restricted using the and properties. TFields instance for which the enumerator is created True if there is a next value, false otherwise. TFieldsEnumerator instance used in enumerator. Parameter value as a BCD value AsFMTBCD can be used to get or set the parameter's value as a BCD typed value. Opaque base type for TRecordBuffer TRecordBufferBaseType should not be used directly. It just serves as an (opaque) base type to Pointer type for record data buffer TRecordBuffer is the type used by to point to a record's data buffer. It is used in several internal TDataset routines. Type of SQL command TPSCommandType is used in the call to determine the type of SQL command that the provider is exposing. It is meaningless for datasets that are not SQL based. Unknown SQL type or not SQL based General SQL statement Table contents (select * from table) Stored procedure statement SQL SELECT Statement SQL INSERT Statement SQL UPDATE statement SQL DELETE Statement SQL DDL statement Interface for Provider support IProviderSupport is an interface used by Delphi's TProvider (datasnap) technology. It is currently not used in Free Pascal, but is provided for Delphi compatibility. The class implements all the methods of this interface for the benefit of descendent classes, but does not publish the interface in it's declaration. End an active transaction PSEndTransaction ends an active transaction if an transaction is active. ( returns True). If ACommit is True then the transaction is committed, else it is rollbacked. Should the transaction be committed or rollbacked? Execute the current command-text. PSExecute executes the current SQL statement: the command as it is returned by . Execute a SQL statement.

PSExecuteStatement will execute the ASQL SQL statement in the current transaction. The SQL statement can have parameters embedded in it (in the form :ParamName), values for these parameters will be taken from AParams. If the SQL statement returns a result-set, then the result set can be returned in ResultSet. The function returns True if the statement was executed succefully.

PSExecuteStatement does not modify the content of CommandText: returns the same value before and after a call to PSExecuteStatement.

True if the statement ASQL was executed succesfully. SQL statement to execute (may contain parameters) Parameter values to substitute when executing ASQL Pointer to resultset (if any) Get a list of attributes (metadata) PSGetAttributes returns a set of name=value pairs which is included in the data packet sent to a client. List of attributes Return the SQL command executed for getting data. PSGetCommandText returns the SQL command that is executed when the function is called (for a TSQLQuery this would be the SQL property) or when the dataset is opened. SQL statement Return SQL command type PSGetCommandType should return the kind of SQL statement that is executed by the command (as returned by ). The list of possible command types is enumerated in . The kind of SQL command. Default order index definition PSGetDefaultOrder should return the index definition from the list of indexes (as returned by ) that represents the default sort order. Index definition for default order Return a list of index definitions PSGetIndexDefs should return a list of index definitions, limited to the types of indexes in IndexTypes. The collection of index definitions. Types of indexes that should be included in the result. Return a list of key fields in the dataset PSGetKeyFields returns a semicolon-separated list of fieldnames that make up the unique key for a record. Normally, these are the names of the fields that have pfInKey in their ProviderOptions property. Semicolon separated list of fieldnames which form the unique key for a record. Get the parameters in the commandtext PSGetParams returns the list of parameters in the command-text (as returned by ). This is usually the Params property of a descendant. The list of parameters in the SQL statement Quote character for quoted strings PSGetQuoteChar returns the quote character needed to enclose string literals in an SQL statement for the underlying database. The actual quote character Name of database table which must be updated PSGetTableName returns the name of the table for which update SQL statements must be constructed. The provider can create and execute SQL statements to update the underlying database by itself. For this, it uses PSGetTableName as the name of the table to update. Name of database table to update Transform exception to UpdateError PSGetUpdateException is called to transform and chain exceptions that occur during an ApplyUpdates operation. The exception E must be transformed to an exception. The previous EUpdateError exception in the update batch is passed in Prev. The new EUpdateErrorexception The originally raised excepion The previous exception in the applyupdates batch (can be nil). Is the dataset in an active transaction. PSInTransaction returns True if the dataset is in an active transaction or False if no transaction is active. True if a transaction is currently active Is the dataset SQL based PSIsSQLBased returns True if the dataset is SQL based or not. Note that this is different from which indicates whether SQL statements can be executed using True if the dataset is based on an SQL statement Can the dataset support SQL statements PSIsSQLSupported returns True if can be used to execute SQL statements on the underlying database. Can SQL statements be executed or not Position the dataset on the first record PSReset repositions the dataset on the first record. For bi-directional datasets, this usually means that first is called, but for unidirectional datasets this may result in re-fetching the data from the underlying database. Set the command-text of the dataset PSSetCommandText sets the commandtext (SQL) statement that is executed by PSExecute or that is used to open the dataset. New SQL command to be used Set the parameters for the command text PSSetParams sets the values of the parameters that should be used when executing the commandtext SQL statement. Value for the parameters Start a new transaction PSStartTransaction is used by the provider to start a new transaction. It will only be called if no transaction was active yet (i.e. returned False). Update a record

PSUpdateRecord is called before attempting to update the records through generated SQL statements. The update to be performed is passed in UpdateKind parameter. The Delta Dataset's current record contains all data for the record that must be updated.

The function returns True if the update was succesfully applied, False if not. In that case the provider will attempt to update the record using SQL statements if the dataset allows it.

True if the record was succesfully updated. Type of update to perform. Data for the record that must be updated. Number of records to read BlockReadSize can be set to a positive number to prevent the dataset from sending notifications to DB-Aware controls while scrolling through the data. Setting it to zero will re-enable sending of notifications, as will putting the dataset in another state (edit etc.). Ignore errors when closing the connection.