PHP Conference Nagoya 2025

odbc_foreignkeys

(PHP 4, PHP 5, PHP 7, PHP 8)

odbc_foreignkeysRetrieves a list of foreign keys

Опис

odbc_foreignkeys(
    Odbc\Connection $odbc,
    ?string $pk_catalog,
    string $pk_schema,
    string $pk_table,
    string $fk_catalog,
    string $fk_schema,
    string $fk_table
): Odbc\Result|false

Retrieves a list of foreign keys in the specified table or a list of foreign keys in other tables that refer to the primary key in the specified table

Параметри

odbc

Ідентифікатор з'єднання ODBC. Докладніше: odbc_connect().

pk_catalog

The catalog ('qualifier' in ODBC 2 parlance) of the primary key table.

pk_schema

The schema ('owner' in ODBC 2 parlance) of the primary key table.

pk_table

The primary key table.

fk_catalog

The catalog ('qualifier' in ODBC 2 parlance) of the foreign key table.

fk_schema

The schema ('owner' in ODBC 2 parlance) of the foreign key table.

fk_table

The foreign key table.

Значення, що повертаються

Returns an ODBC result object або false в разі помилки.

The result set has the following columns:

  • PKTABLE_CAT
  • PKTABLE_SCHEM
  • PKTABLE_NAME
  • PKCOLUMN_NAME
  • FKTABLE_CAT
  • FKTABLE_SCHEM
  • FKTABLE_NAME
  • FKCOLUMN_NAME
  • KEY_SEQ
  • UPDATE_RULE
  • DELETE_RULE
  • FK_NAME
  • PK_NAME
  • DEFERRABILITY
Драйвер може оголошувати додаткові стовпці.

If the foreign keys associated with a primary key are requested, the result set is ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME and KEY_SEQ. If the primary keys associated with a foreign key are requested, the result set is ordered by PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME and KEY_SEQ.

If pk_table contains a table name, odbc_foreignkeys() returns a result set containing the primary key of the specified table and all of the foreign keys that refer to it.

If fk_table contains a table name, odbc_foreignkeys() returns a result set containing all of the foreign keys in the specified table and the primary keys (in other tables) to which they refer.

If both pk_table and fk_table contain table names, odbc_foreignkeys() returns the foreign keys in the table specified in fk_table that refer to the primary key of the table specified in pk_table. This should be one key at most.

Журнал змін

Версія Опис
8.4.0 odbc expects an Odbc\Connection instance now; previously, a resource was expected.
8.4.0 This function returns an Odbc\Result instance now; previously, a resource was returned.

Прогляньте також

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top