PHP - Manual: odbc_foreignkeys
2025-10-25
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc_foreignkeys — Retrieves a list of foreign keys
$odbc,$pk_catalog,$pk_schema,$pk_table,$fk_catalog,$fk_schema,$fk_tableRetrieves 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
odbcODBC 连接对象,详见 odbc_connect()。
pk_catalogThe catalog ('qualifier' in ODBC 2 parlance) of the primary key table.
pk_schemaThe schema ('owner' in ODBC 2 parlance) of the primary key table.
pk_tableThe primary key table.
fk_catalogThe catalog ('qualifier' in ODBC 2 parlance) of the foreign key table.
fk_schemaThe schema ('owner' in ODBC 2 parlance) of the foreign key table.
fk_tableThe foreign key table.
返回 ODBC 结果对象 或者在失败时返回 false。
The result set has the following columns:
PKTABLE_CATPKTABLE_SCHEMPKTABLE_NAMEPKCOLUMN_NAMEFKTABLE_CATFKTABLE_SCHEMFKTABLE_NAMEFKCOLUMN_NAMEKEY_SEQUPDATE_RULEDELETE_RULEFK_NAMEPK_NAMEDEFERRABILITY
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 现在需要 Odbc\Connection
实例;之前需要 resource。
|
| 8.4.0 | 此函数现在返回 Odbc\Result 实例;之前返回 resource。 |
官方地址:https://www.php.net/manual/en/function.odbc-foreignkeys.php