DF_REPORT_UNSUPPORTED_ATTRIBUTES
See Also: Get_Attribute, Set_Attribute, DF_STRICT_ATTRIBUTES
Controls how unsupported attributes are handled by database drivers.
Level
Global
Type
Boolean, temporary
Access
Read / Write
Values
- True
- False
Remarks
If the value of DF_REPORT_UNSUPPORTED_ATTRIBUTES is False, database drivers will not generate an error when an attribute that is unsupported by that driver is set or retrieved. When getting an unsupported attribute, its value will be returned as 0 for numeric attributes and an empty string for string attributes.
If the value of DF_REPORT_UNSUPPORTED_ATTRIBUTES is True, the DFERR_UNSUPPORTED_FUNCTION error will be generated when a driver is requested to get or set an unsupported attribute.
DF_REPORT_UNSUPPORTED_ATTRIBUTES is used in cases where one or more attributes are used that are not supported by all the used drivers, and the value of the attribute is of no interest for the logic. In these cases, it is set to False, the logic is performed, and then the attribute is set back to True. Alternatively, one could test for the driver and decide not to get the attribute if it is not supported.
Sample Procedures
ShowIndices
Procedure ShowIndices Handle hTable
Integer iLastIndex
Integer iIndex
String sIndex
String sName
Integer iNumSegments
Integer iSegment
Integer iColumn
String sColumn
Integer iCase
Integer iDirection
Get_Attribute DF_FILE_LAST_INDEX_NUMBER Of hTable To iLastIndex
For iIndex From 1 To iLastIndex
Get_Attribute DF_INDEX_NUMBER_SEGMENTS Of hTable iIndex To iNumSegments
If (iNumSegments > 0) Begin
Get_Attribute DF_INDEX_NAME Of hTable iIndex To sName
Move "" To sIndex
For iSegment From 1 To iNumSegments
Get_Attribute DF_INDEX_SEGMENT_FIELD Of hTable iIndex iSegment To iColumn
Get_Attribute DF_FIELD_NAME Of hTable iColumn To sColumn
Get_Attribute DF_INDEX_SEGMENT_CASE Of hTable iIndex iSegment To iCase
If (iCase = DF_CASE_IGNORED) ;
Move (sColumn * "uppercased") To sColumn
Get_Attribute DF_INDEX_SEGMENT_DIRECTION Of hTable iIndex iSegment To iDirection
If (iDirection = DF_DESCENDING) ;
Move (sColumn * "descending") To sColumn
If (iSegment > 1) ;
Move (sIndex + ",") To sIndex
Move (sIndex * sColumn) To sIndex
Loop
Showln " Index " sName " (" sIndex ")"
End
Loop
If (iLastIndex = 0) ;
Showln " NO index defined."
End_Procedure // ShowIndices
ShowAllSQLIndices
Procedure ShowAllSQLIndices
Handle hTable
String sTable
String sDriver
Move 0 To hTable
Repeat
Get_Attribute DF_FILE_NEXT_USED Of hTable To hTable
If (hTable > 0) Begin
Open hTable
Get_Attribute DF_FILE_DRIVER Of hTable To sDriver
If (sDriver = "MSSQLDRV" Or sDriver = "DB2_DRV" Or sDriver = "ODBC_DRV") Begin
Get_Attribute DF_FILE_LOGICAL_NAME Of hTable To sTable
Showln "Indexes for " sTable
Send ShowIndices hTable
End
Close hTable
End
Until (hTable = 0)
End_Procedure // ShowAllSQLIndices
ShowAllIndices
Procedure ShowAllIndices
Handle hTable
String sTable
String sDriver
Boolean bUnSupported
Get_Attribute DF_REPORT_UNSUPPORTED_ATTRIBUTES To bUnSupported
Set_Attribute DF_REPORT_UNSUPPORTED_ATTRIBUTES To False
Move 0 To hTable
Repeat
Get_Attribute DF_FILE_NEXT_USED Of hTable To hTable
If (hTable > 0) Begin
Open hTable
Get_Attribute DF_FILE_DRIVER Of hTable To sDriver
Get_Attribute DF_FILE_LOGICAL_NAME Of hTable To sTable
Showln "Indexes for " sTable
Send ShowIndices hTable
Close hTable
End
Until (hTable = 0)
Set_Attribute DF_REPORT_UNSUPPORTED_ATTRIBUTES To bUnSupported
End_Procedure // ShowAllIndices
The sample procedure ShowIndices above uses the DF_INDEX_NAME attribute, which is only supported by DataFlex SQL Drivers. The sample procedure ShowAllSQLIndices above only calls the ShowIndices procedure if the table is accessed through a SQL Database Driver. The sample procedure ShowAllIndices above turns off reporting unsupported attributes and then calls the ShowIndices procedure regardless of the driver.