Partager via


ADBOBJECTS( ) Function

Places the names of named connections, relations, tables, or SQL views in the current database into a variable array.

ADBOBJECTS(ArrayName, cSetting)

Return Values

Numeric

Parameters

  • ArrayName
    Specifies the name of the array in which the names are placed. If the array you specify doesn't exist, Visual FoxPro automatically creates the array. If the array exists and isn't large enough to contain all the names, Visual FoxPro automatically increases the size of the array to accommodate the names. If the array is larger than necessary, Visual FoxPro truncates the array. If the array exists and ADBOBJECTS( ) returns 0 because no names are found, the array remains unchanged. If the array doesn't exist, and ADBOBJECTS( ) returns 0, the array is not created.

    A one-dimensional array is created when you specify CONNECTION, TABLE, or VIEW for cSetting. Each row in the one-dimensional array contains the name of a connection, table, or view in the database.

    A two-dimensional array is created when you specify RELATION for cSetting. Each row in the two-dimensional array corresponds to a relationship in the database. The first column in an array row contains the name of the child table and the second column in an array row contains the name of the parent table. The third column contains the name of the index tag for the child table and the fourth column contains the name of the index tag for the parent table.

    The fifth column in an array row contains referential integrity information. This column is empty if the relation has no referential integrity rules. If the relationship does have referential integrity rules, the column contains characters corresponding to the type of referential integrity rules for updates, deletions, and insertions.

    The first character indicates the type of update rule, the second character indicates the type of deletion rule, and the third character indicates the type of insertion rule.

    Possible values for updates and deletions are "C" for cascade, "R" for restrict, and "I" for ignore. Possible values for insertions are "R" for restrict, and "I" for ignore. For example, if a relation has cascaded updates, restricted deletions, and ignores insertion referential integrity rules, the column contains "CRI".

  • cSetting
    Specifies the names to place in the variable array. The following table lists the values for cSetting and the corresponding names placed in the array:

    cSetting Names
    CONNECTION Connection names
    RELATION Table relationships
    TABLE Table names
    VIEW View names

    The CONNECTION, RELATION, TABLE, and VIEW settings cannot be abbreviated.

Remarks

A database must be open and current when ADBOBJECTS( ) is issued; otherwise Visual FoxPro generates an error message.

Example

The following example opens the testdata database and uses ADBOBJECTS( ) to create an array named gaTables containing names of tables in the database. The tables names are then displayed.

* Close any open databases
CLOSE DATABASES

* Clear desktop to prepare for displaying the array
CLEAR

* Open sample testdata database
OPEN DATABASE (HOME(2) + 'Data\testdata')

* Function call with cSetting for table names
=ADBOBJECTS(gaTables, "TABLE")

* Displays array gaTables created by ADBOBJECTS( ) function
DISPLAY MEMORY LIKE gaTables

See Also

ADATABASES( ) | CREATE | CREATE CONNECTION | CREATE DATABASE | CREATE SQL VIEW | CREATE TABLE - SQL | DISPLAY DATABASE | INDBC( ) | LIST DATABASE | MODIFY DATABASE | SET DATABASE