AdsDDGetIndexProperty

Advantage Client Engine

Retrieves a property of an index of a database table from the data dictionary.

Syntax

UNSIGNED32 AdsDDGetIndexProperty( ADSHANDLE hDBConn,

UNSIGNED8 *pucTableName,

UNSIGNED8 *pucIndexName,

UNSIGNED16 usPropertyID,

VOID *pvProperty,

UNSIGNED16 *pusPropertyLen );

Parameters

hDBConn (I)

Handle of a database connection.

pucTableName (I)

Name of the table in the database with the specified index.

pucIndexName (I)

Name of the index associated with the table to retrieve the specified property.

usPropertyID (I)

Index of the property to retrieve. See Remarks for allowed values.

pvProperty (O)

Pointer to the buffer where the property is to be copied into.

pusPropertyLen (I/O)

On input, specifies the size of the buffer pointed to by pvProperty. On output, returns the length of the property copied into the buffer.

Special Return Codes

AE_INVALID_PROPERTY_ID

Either the value supplied in usPropertyID is not a valid index property, or the specified property cannot be retrieved.

AE_INSUFFICIENT_BUFFER

The size of the property to be copied into pvProperty is larger than the buffer size specified by *pusPropertyLen. The required buffer length is returned in *pusPropertyLen when this error occurs.

AE_PROPERTY_NOT_SET

The requested property is not set in the data dictionary. No data is returned in pvProperty and *pusPropertyLen.

Remarks

AdsDDGetIndexProperty retrieves a property of the specified index associated with the specified table from the data dictionary. The following are the valid values of usPropertyID and the expected return value in pvProperty and *pusPropertyLen.

usPropertyID

Description

ADS_DD_COMMENT

The function returns the index description as a NULL terminated string in pvProperty.

ADS_DD_INDEX_FILE_NAME

The function returns the name of the index file where the specified index is located. The name is returned as a NULL terminated string in pvProperty. The returned index file name can be used to locate the index file object in the data dictionary.

ADS_DD_INDEX_EXPRESSION

The function returns the index expression of the specified index. The expression is returned as a NULL terminated string in pvProperty. This property can only be retrieved by users with administrative permissions. See Advantage Data Dictionary User Permissions for more information.

ADS_DD_INDEX_CONDITION

The function returns the conditional expression of the specified index. The expression is returned as a NULL terminated string in pvProperty. A conditional expression is a logical expression that filters the records placed in an index. Only records that pass the conditional expression are in the index. This property can only be retrieved by users with administrative permissions. See Advantage Data Dictionary User Permissions for more information.

ADS_DD_INDEX_OPTIONS

The function returns a bit field of the optional property of the specified index. This property is returned as a 4-byte integer in the buffer pointed to by pvProperty. *pusPropertyLen must be 4 on input when calling this function with this property id. The index options are ORed together into the bit field. The possible options in the bit field are ADS_COMPOUND, ADS_DESCENDING, and ADS_UNIQUE. See AdsCreateIndex for additional information on the index options. This property can only be retrieved by users with administrative permissions. See Advantage Data Dictionary User Permissions for more information.

ADS_DD_INDEX_KEY_LENGTH

The function returns the length of the keys in the specified index. The key length is returned as a 2-byte integer in the buffer pointed to by pvProperty. *pusPropertyLen must be 2 on input when calling this function with this property id.

ADS_DD_INDEX_KEY_TYPE

The function returns the type of the keys of the specified index. The key type is returned as a 2-byte integer in the buffer pointed to by pvProperty. *pusPropertyLen must be 2 on input when calling this function with this property id. Possible key types are ADS_STRING, ADS_NUMERIC, ADS_DATE, ADS_LOGICAL, and ADS_RAW. See AdsGetKeyType for additional information.

Example

After making a connection to the database, find out the key type of the "Company Name" index in the "Customer Information" table.

AdsConnect60( "n:\\MyData\\myData.ADD", ADS_REMOTE_SERVER, "ADSSYS",

NULL, ADS_DEFAULT, &hDD );

usBufferSize = (UNSIGNED16)sizeof( usKeyType );

AdsDDGetIndexProperty( hDD, "Customer Information", "Company Name",

ADS_DD_INDEX_KEY_TYPE, &usKeyTypel,

&usBuffSize );

AdsDisconnect( hDD );

See Also

AdsConnect60

AdsDDAddIndexFile

AdsDDAddTable

AdsDDFindFirstObject

AdsDDFindNextObject

system_indexes