odbc_tables
(PHP 4, PHP 5, PHP 7)
odbc_tables — Get the list of table names stored in a specific data source
Описание
$odbc
, string|null $catalog = null
, string|null $schema = null
, string|null $table = null
, string|null $types = null
) : resource|falseLists all tables in the requested range.
To support enumeration of qualifiers, owners, and table types,
the following special semantics for the
catalog, schema,
table, and
table_type are available:
-
If
catalogis a single percent character (%) andschemaandtableare empty strings, then the result set contains a list of valid qualifiers for the data source. (All columns except the TABLE_QUALIFIER column contain NULLs.) -
If
schemais a single percent character (%) andcatalogandtableare empty strings, then the result set contains a list of valid owners for the data source. (All columns except the TABLE_OWNER column contain NULLs.) -
If
table_typeis a single percent character (%) andcatalog,schemaandtableare empty strings, then the result set contains a list of valid table types for the data source. (All columns except the TABLE_TYPE column contain NULLs.)
Список параметров
-
odbc -
Идентификатор соединения ODBC, за подробностями обращайтесь к odbc_connect().
-
catalog -
Каталог ('qualifier' на языке ODBC 2).
-
schema -
Схема ('owner' на языке ODBC 2). Этот параметр принимает следующие шаблоны поиска:
%соответствующий нулю или более символам, и_соответствующий ровно одному символу. -
table -
The name. Этот параметр принимает следующие шаблоны поиска:
%соответствующий нулю или более символам, и_соответствующий ровно одному символу. -
types -
If
table_typeis not an empty string, it must contain a list of comma-separated values for the types of interest; each value may be enclosed in single quotes (') or unquoted. For example,'TABLE','VIEW'orTABLE, VIEW. If the data source does not support a specified table type, odbc_tables() does not return any results for that type.
Возвращаемые значения
Returns an ODBC result identifier containing the information
или false в случае возникновения ошибки.
The result set has the following columns:
TABLE_CATTABLE_SCHEMTABLE_NAMETABLE_TYPEREMARKS
The result set is ordered by TABLE_TYPE, TABLE_CAT,
TABLE_SCHEM and TABLE_NAME.
Список изменений
| Версия | Описание |
|---|---|
| 8.0.0 |
schema, table and types
are now nullable.
|
Примеры
Пример #1 List Tables in a Catalog
<?php
$conn = odbc_connect($dsn, $user, $pass);
$tables = odbc_tables($conn, 'SalesOrders', 'dbo', '%', 'TABLE');
while (($row = odbc_fetch_array($tables))) {
print_r($row);
break; // further rows omitted for brevity
}
?>
Результатом выполнения данного примера будет что-то подобное:
Array
(
[TABLE_CAT] => SalesOrders
[TABLE_SCHEM] => dbo
[TABLE_NAME] => Orders
[TABLE_TYPE] => TABLE
[REMARKS] =>
)
Смотрите также
- odbc_tableprivileges() - Lists tables and the privileges associated with each table
- odbc_columns() - Lists the column names in specified tables
- odbc_specialcolumns() - Retrieves special columns
- odbc_statistics() - Retrieve statistics about a table
- odbc_procedures() - Get the list of procedures stored in a specific data source