AnyDAC
ContentsIndexHome
PreviousUpNext
Setting Options

Describes why the set of options makes AnyDAC a flexible database framework and how to use the options. AnyDAC offers the wide range of the options organized into an hierarchical options system. Most of the options may be leaved with their default values.

Group
Topics
Topic 
Description 
AnyDAC offers flexible adjustable data type mapping system, allowing to simplify migration to AnyDAC or optimize data representation. 
Links

The AnyDAC options are organized into five groups:

  • FetchOptions - Fetch options control, how the components and Phys layer commands fetch data from a DBMS. For example, it is possible to fetch all records at once, or fetch records on demand.
  • FormatOptions - Format options control, how DBMS data types will be mapped to the AnyDAC data types and backward. For example, a programmer may setup a mapping for Oracle NUMBER (38) onto dtBCD or onto dtInt64. Read Data Type Mapping for more details.
  • UpdateOptions - Update options control, how AnyDAC will post updates to DBMS. For example, during an update AnyDAC can update all fields in a table or only the changed ones.
  • ResourceOptions - Resource options control, how system resources are used, dataset persistence and other. For example, an AnyDAC Phys layer command can be performed asynchronously or blocked.
  • TxOptions - Transaction options control, how transactions are performed. For example, perform them in a ReadCommitted isolation mode. Note, that TxOptions does not use option value inheritance.

Because AnyDAC introduces a lot of options, setting up each dataset or command may do the programming complex and error prone. AnyDAC solves this issue by introducing a parent-child option values inheritance model. The option values are propagated from a parent to a child (top-down). If a lower level has no option value assigned explicitly, a value will be taken from a higher level, where a value is assigned or from the top-most level. The AnyDAC has levels:

A Manager is the top-most level, a Connection is the intermediate and a Command / Dataset is the bottom level. So, by setting any particular Manager or Connection option, all Datasets will inherit its value. This is true as long as a programmer has not explicitly assigned a value to the Dataset option. 

The TxxxOptions.AssignedValues flags controls the inheritance. If some option is changed at this level, then corresponding flag is included into AssignedValues. If flag is not included, then an option value is inherited from the more high level. Excluding flag from AssignedValues makes option inheriting its value from the more high level again. 

The options may be setup for a persistent connection definition using ADExplorer. After connection establishment, the options setup will be applied to the TADCustomConnection options.

Data Type Mapping, uADStanOptions

The mapping of data types from the DBMS types to the client types defined in FormatOptions is inherited by all Commands from their Connection.

with oConnection.Options.FormatOptions do begin
  OwnMapRules := True;
  MapRules.Clear;
  with MapRules.Add do begin
    PrecMax := 19;
    PrecMin := 4;
    SourceDataType := dtFmtBCD;
    TargetDataType := dtCurrency;
  end;
end;

A Data Warehouse application may setup high-speed fetching mode, using FetchOptions of the Manager level. So, all connection and all their commands will inherit these options.

with ADManager.FetchOptions do begin
  Items := [];
  Cache := [];
  RowsetSize := 1000;
end;
What do you think about this topic? Send feedback!