The Database API Attributes are used in combination with the Get_Attribute, Set_Attribute, Structure_Start and Structure_End commands to query and manipulate the structure of databases and tables.
Attributes are defined at different levels. The supported levels are: Global, Driver, Database, Table, Column, Index and Index_Segment. Depending on the attribute’s level, the number of arguments of the Set_Attribute and Get_Attribute commands vary.
Some API attributes can only be used when using a specific database driver. Global attributes are global and thus do not rely on a driver. All other attribute levels do rely on a driver. The basic set of attributes can be used for any driver, but some of these attributes do not make sense for the back end in use. The DF_FILE_MAX_RECORDS attribute for example, only makes sense when used with the Embedded Database.
The DataFlex SQL Drivers define driver and database level attributes. Some of the attributes are defined on both driver and database level. For these attributes the value on driver level acts as a default value. To get the actual value of such an attribute, always get the database level attribute.
This section describes each API basic and driver specific attribute. They are listed alphabetically. It also describes the basic techniques for using the attributes in a DataFlex program. Each attribute is described using the following topics: Level, Supported by, Type, Values and Remarks.
See Also: Creating and Modifying Table Structures in the Database Essentials section of the Developing Database Applications book.
All of the examples in this section of the documentation are designed to work with the data files provided with the Order Entry Sample Application workspace. Due to this, any of the example code provided here can easily be copied and pasted into the Studio and tested.
Note: You may want to back up the tables for the Order Entry Sample Application workspace before testing any example code that modifies the data file structure of these tables. To do so, you can simply back up the Data subfolder of this workspace.
For example, to test the example code for the DF_DATE_FORMAT API attribute, you can use the following code:
Object oButton1 is a Button
Set Location to 73 106
Set Label to "oButton1"
Procedure OnClick
Send ShowFormats
End_Procedure // OnClick
Procedure ShowFormats
Integer iDateFormat iDateSep iDecimalSep iThousandSep
String sDateFormat
Get_Attribute DF_DATE_FORMAT to iDateFormat
Get_Attribute DF_DATE_SEPARATOR to iDateSep
Get_Attribute DF_DECIMAL_SEPARATOR to iDecimalSep
Get_Attribute DF_THOUSANDS_SEPARATOR to iThousandSep
If (iDateFormat = DF_DATE_USA) Move "USA" to sDateFormat
Else If (iDateFormat = DF_DATE_EUROPEAN) Move "European" to sDateFormat
Else If (iDateFormat = DF_DATE_MILITARY) Move "Military" to sDateFormat
Else Move "Unknown" to sDateFormat
Send Info_Box ("Formats:\nDate:" * sDateFormat + ;
"\nDate separator:" * Character(iDateSep) + ;
"\nDecimal separator:" * Character(iDecimalSep) + ;
"\nThousand separator:" * Character(iThousandSep))
End_Procedure // ShowFormats
End_Object