AdsDDFindFirstObject

Advantage Client Engine

Retrieves the name of the first object of the specified type from the data dictionary.

Syntax

UNSIGNED32 AdsDDFindFirstObject( ADSHANDLE hDBConn,

UNSIGNED16 usFindObjectType,

UNSIGNED8 *pucParentName,

UNSIGNED8 *pucObjectName,

UNSIGNED16 *pusObjectNameLen,

ADSHANDLE *phFindHandle );

Parameters

hDBConn (I)

Handle of a database connection.

usFindObjectType (I)

Type of objects to search for. See Remarks below for allowed values.

pucParentName (I)

Name of the object that is the parent or owner of the object searched for. This parameter is ignored when searching for table, view, user group or referential integrity objects. When searching for an index file, an index order or a field object, this parameter should supply the name of the associated table object. When searching for a user, this parameter can optionally supply the name of the user group to limit the search result to users who are members of the user group.

pucObjectName (O)

Returns the name of first object in the data dictionary matching the search condition. The length of the object name has a maximum length of ADS_MAX_OBJECT_NAME_LEN.

pusObjectNameLen (I/O)

On input, specifies the size of the buffer pointed to by the pucObjectName. On output, returns the length of the object name returned in pucObjectName. The maximum size of the object name in the data dictionary is defined by the constant ADS_DD_MAX_OBJECT_NAME_LEN.

phFindHandle (O)

Returns a find handle that must be used in subsequent calls to AdsDDFindNextObject to iterate the list of objects. The find handle is valid until it is closed by AdsDDFindClose or until the data dictionary handle is closed.

Special Return Codes

AE_INVALID_OBJECT_NAME

The name specified by pucParentName is not a valid object in the data dictionary.

AE_NO_OBJECT_FOUND

No object matching the specified condition was found in the data dictionary.

Remarks

AdsDDFindFirstObject finds an object in the data dictionary matching the specified condition and returns the name of the object. After calling this function, AdsDDFindNext can be called to iterate through all objects that match the specified search condition.

usFindObjectType

Description

ADS_DD_TABLE_OBJECT

Retrieves the name of a table object. The pucParentName is ignored and assumed to be the database.

ADS_DD_VIEW_OBJECT

Retrieves the name of a view object. The pucParentName is ignored and assumed to be the database.

ADS_DD_VIEW_OR_TABLE_OBJECT

Retrieves the name of either a view or a table object. The pucParentName is ignored and assumed to be the database.

ADS_DD_RELATION_OBJECT

Retrieves the name of a referential integrity definition. The pucParentName is ignored and assumed to be the database.

ADS_DD_INDEX_FILE_OBJECT

Retrieves the name of an index file object that is associated with the table object specified by the pucParentName.

ADS_DD_INDEX_OBJECT

Retrieves the name of an index order that has been defined in any index file associated with the table specified by the pucParentName.

ADS_DD_FIELD_OBJECT

Retrieves the name of the first field in the table specified by the pucParentName. The order of the returned field name is the order that the fields appear in the table.

ADS_DD_USER_OBJECT

Retrieves the name of a user object. If pucParentName is NULL or empty string, this function, together with AdsDDFindNextObject, will iterate through all users in the database. If the pucParentName is no NULL or empty string, it must specify a user group name. In such case, this function, together with AdsDDFindNextObject, will iterate through all users who are members of the specified user group.

ADS_DD_USER_GROUP_OBJECT

Retrieves the name of a user group. The pucParentName is ignored and assumed to be the database.

ADS_DD_PROCEDURE_OBJECT

Retrieves the name of a stored procedure. The pucParentName is ignored and assumed to be the database.

ADS_DD_LINK_OBJECT

Retrieves the name of a link object. The pucParentName is ignored and assumed to be the database.

ADS_DD_TRIGGER_OBJECT

Retrieves the name of a trigger object.

ADS_DD_QUALIFIED_TRIGGER_OBJ

Retrieves the qualified name of a trigger object. The qualified name includes the table name prefix, followed by two colon characters ( :: ), followed by the trigger name.

ADS_DD_PUBLICATION_OBJECT

Retrieves the name of a publication object. The pucParentName is currently ignored and assumed to be the database.

ADS_DD_ARTICLE_OBJECT

Retrieves the name of a published article associated with the publication specified by pucParentName.

ADS_DD_SUBSCRIPTION_OBJECT

Retrieves the name of a subscription object. The pucParentName is currently ignored and assumed to be the database.

Example

Find all index files that are associated with the "Customer Information" table.

AdsConnect60( "n:\\MyData\\myData.ADD", ADS_REMOTE_SERVER, "ADSSYS", NULL, ADS_DEFAULT, &hDD );

usBufferSize = (UNSIGNED16)sizeof( aucFileName );

if ( AE_SUCCESS == AdsDDFindFirstObject( hDD, ADS_DD_INDEX_FILE_OBJECT,

"Customer Information", aucFileName,

&usBufferSize, &hFindHandle ))

{

do

{

printf( "%s\n", aucFileName );

usBufferSize = (UNSIGNED16)sizeof( aucFileName );

}

while ( AE_SUCCESS == AdsDDFindNextObject( hDD, hFindHandle, aucFileName, &usBufferSize ));

}

 

/* No need to call AdsDDFindClose since we are closing the DD. */

AdsDisconnect( hDD );

See Also

AdsDDFindNextObject

AdsDDFindClose

AdsConnect60