Database Engines:ads

Configuration of the ADSDBE Professional

The Xbase++ function DbeInfo() is used to retrieve and/or configure the current DatabaseEngine set with DbeSetDefault(). For example, the file extension for database files can be specified, or the operating mode for record locks can be set. The following table gives an overview of the #define constants that can be passed to the function DbeInfo() for the ADSDBE:

Constants for DbeInfo() with the ADSDBE
Constant *) Value Data type Description
ADSDBE_TBL_MODE rw Switches between Clipper and
FoxPro compatible file formats
ADSDBE_INDEX_EXT rw NTX C Extension for index files
ADSDBE_MEMOFILE_EXT ro DBT C Extension for memo files
ADSDBE_MEMOBLOCKSIZE rw 512 N Block size for memo fields
ADSDBE_LOCK_MODE rw N Selects compatible or ADS
N specific mode for record locks
ADSDBE_RIGHTS_MODE rw N Defines if user rights defined
for network are used for file access
ADSDBE_PASSWORD rw Defines encryption password
ADSDBE_FREETABLE rw .F. L Enforce DbUseArea() to treat
the table as free
ADSDBE_TABLENAME_IS_ALIAS rw .F. L Use Tablename as alias
ADSDBE_DELETEOBJECT rw .F. L Delete dictionary object on disk
ADSDBE_DICTIONARY_DATA rw .T. L Load dictionary meta data
  1. ro=READONLY , rw=READ/WRITEABLE

In its default configuration, the ADSDBE uses Clipper compatible file formats for memo (DBT) and index (NTX) files, compatible record locking schemes and checks file access rights defined for a user on the file server. These default settings can be overridden using DbeInfo().

ADSDBE_TBL_MODE

There are two constants defined in ADSDBE.CH that allow for selecting the file formats used by the ADS:

A) DbeInfo( COMPONENT_DATA , ADSDBE_TBL_MODE, ADSDBE_NTX ) 
   DbeInfo( COMPONENT_ORDER, ADSDBE_TBL_MODE, ADSDBE_NTX ) 

B) DbeInfo( COMPONENT_DATA , ADSDBE_TBL_MODE, ADSDBE_CDX ) 
   DbeInfo( COMPONENT_ORDER, ADSDBE_TBL_MODE, ADSDBE_CDX ) 

C) DbeInfo( COMPONENT_DATA , ADSDBE_TBL_MODE, ADSDBE_ADT ) 
   DbeInfo( COMPONENT_ORDER, ADSDBE_TBL_MODE, ADSDBE_ADT ) 

The first (variant A) is the default setting and selects the Clipper compatible file formats for index (NTX) and memo (DBT) files. This complies with the file specifications for the Xbase++ Database Engines DBFDBE and NTXDBE.

The second (variant B) selects FoxPro compatible file formats. The ADS uses CDX index files and FPT memo files in this case. They are compliant with the file specifications for the CDXDBE and FOXDBE of Xbase++.

The third (variant C) selects Advantage properitary file formats. The ADS uses ADI index files and ADM memo files in this case. For more information please be referred to the Advantage Database Server documentation.

ADSDBE_INDEX_EXT

This constant allows for defining the extension for the index files created by the ADS:

DbeInfo( COMPONENT_ORDER, ADSDBE_INDEX_EXT, "IND" ) 

Note that the first parameter passed to DbeInfo() must be the constant COMPONENT_ORDER when redefining the extension of the files managed by the order component of the ADSDBE.

ADSDBE_MEMOFILE_EXT

The extension for memo files cannot be changed, but only retrieved:

cExtension := DbeInfo( COMPONENT_DATA, ADSDBE_MEMOFILE_EXT ) 

ADSDBE_MEMOBLOCKSIZE

The size for a single block in a memo file can only be changed for FPT memo files in the range between 33 and 1024 bytes. The default is 64 bytes. For DBT memo files, the block size is always 512 bytes.

DbeInfo( COMPONENT_DATA, ADSDBE_TBL_MODE, ADSDBE_CDX ) 
DbeInfo( COMPONENT_DATA, ADSDBE_MEMOBLOCKSIZE, 128 ) 

This example sets the memo block size for FPT files to 128 bytes.

ADSDBE_LOCK_MODE

There are two modes for file and record locking: a compatible mode allows for concurrent locking of files by ADS and non-ADS applications, and an ADS proprietary locking mode that requires files to be accessed only by ADS applications:

DbeInfo( COMPONENT_DATA, ADSDBE_LOCK_MODE, ADSDBE_COMPATIBLE_LOCKING  ) 
DbeInfo( COMPONENT_DATA, ADSDBE_LOCK_MODE, ADSDBE_PROPRIETARY_LOCKING ) 

ADSDBE_RIGHTS_MODE

The ADS supports two modes for file access: checking the access rights defined for a user on the server, or using "hidden" files that can only be accessed by the ADS.

DbeInfo( COMPONENT_DATA, ADSDBE_RIGHTS_MODE, ADSDBE_CHECKRIGHTS  ) 
DbeInfo( COMPONENT_DATA, ADSDBE_RIGHTS_MODE, ADSDBE_IGNORERIGHTS ) 

In the "check rights" mode, sufficient file access rights must be defined for a user on the server. When the ADS proprietary "ignore rights" mode is selected, an application can access files only via the ADS.

ADSDBE_PASSWORD

The ADS allows for data encryption using a password. The password can be defined as follows:

DbeInfo( COMPONENT_DATA, ADSDBE_PASSWORD, "KLINGON" ) 

ADSDBE_FREETABLE

Depending on the connection type, the Advantage Database Server treats DbUseArea() operations differently. If the connection was made to a dictionary, DbUseArea() can only open tables which are part of that dictionary. If one wants to open DBF Tables which are not part of a dictionary - so called free tables - a runtime errors occurs. To force the DbUseArea() operation to open a free table and not use the dictionary, free-table access must be enabled as follows:

DbeInfo( COMPONENT_DATA, ADSDBE_FREETABLE, .T. ) 

In case your application depends largely on dictionary bound and free tables it makes sense to establish two different connections. One connection is to the dictionary and the other connection is to the share of the ADS server. Using the DacSession object as the 2.nd parameter when performing a DbUseArea() operation allows opening bound and free tables without any need to reconfigure the freetable behaviour of the ADS server.

ADSDBE_TABLENAME_IS_ALIAS

By default the ADS DatabaseEngine forwards any specified alias-name to the database-server. However the Advantage Database Server supports alias-names only up to a length of 10 characters. Whenever the filename is larger than 10 characters and no alias-name was specified the ADS Server calculates the alias-name out of the filename which in turn results in a alias-name longer than 10 characters. To ensure that Xbase++ does not specify the alias-name whether explicitly nor implicitly the ADSDBE_TABLENAME_IS_ALIAS can be set to .T. which forces the DatabaseEngine to ignore any alias-settings and strictly uses the alias-names as calculated by the Advantage Database Server.

ADSDBE_DELETEOBJECT

This constant allows to define the behaviour of the ADS server if data objects are removed from the dictionary. If ADSDBE_DELETEOBJECT is .T. the ADS server automatically removes the file related to an object stored in the dictionary. For example, removal of an index/order from the dictionary leads to a phyiscal deletion of the associated file or tag. By default ADSDBE_DELETEOBJECT is .F., which ensures that a index file, if removed from the dictionary, is still existing on the hardisk and can be manually opened using SET INDEX TO or OrdListAdd().

ADSDBE_DICTIONARY_DATA

This constant allows to define the behaviour of the ADS DatabaseEngine when opening tables. By default (.T.), the ADSDBE loads field-related metadata from the dictionary so the client application is aware of default values, validation rules, null-value behaviour and other details. However, querying this information from the ADS Dictionary is very time-consuming and may lead to performance problems in WAN environments, or when having tables with hundreds of fields. To increase the performance of table-use operations in the previous scenarios, the ADSDBE_DICTIONARY_DATA setting can be used to disable dictionary data retrieval.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.