array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'function.odbc-tables.php', 1 => 'odbc_tables', 2 => 'Get the list of table names stored in a specific data source', ), 'up' => array ( 0 => 'ref.uodbc.php', 1 => 'ODBC Funktionen', ), 'prev' => array ( 0 => 'function.odbc-tableprivileges.php', 1 => 'odbc_tableprivileges', ), 'next' => array ( 0 => 'book.pdo.php', 1 => 'PDO', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/uodbc/functions/odbc-tables.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

odbc_tables

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

odbc_tablesGet the list of table names stored in a specific data source

Beschreibung

odbc_tables(
    Odbc\Connection $odbc,
    ?string $catalog = null,
    ?string $schema = null,
    ?string $table = null,
    ?string $types = null
): Odbc\Result|false

Lists 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:

Parameter-Liste

odbc

Das ODBC-Verbindungs-Objekt, siehe odbc_connect() für Details.

catalog

Der Katalog ('Kennzeichner' in ODBC 2 Terminologie).

schema

Das Schema ('Besitzer' in ODBC 2 Terminologie). Dieser Parameter akzeptiert die folgenden Suchmuster: % für 0 oder mehr Zeichen und _ für genau ein beliebiges Zeichen.

table

The name. Dieser Parameter akzeptiert die folgenden Suchmuster: % für 0 oder mehr Zeichen und _ für genau ein beliebiges Zeichen.

types

If table_type is 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' or TABLE, VIEW. If the data source does not support a specified table type, odbc_tables() does not return any results for that type.

Rückgabewerte

Gibt ein ODBC-Ergebnis-Objekt zurück containing the information Bei einem Fehler wird false zurückgegeben..

The result set has the following columns:

Treiber können zusätzliche Spalten melden.

The result set is ordered by TABLE_TYPE, TABLE_CAT, TABLE_SCHEM and TABLE_NAME.

Changelog

Version Beschreibung
8.4.0 odbc erwartet nun eine Instanz von Odbc\Connection; vorher wurde eine Ressource erwartet.
8.4.0 Diese Funktion gibt nun eine Instanz von Odbc\Result zurück; vorher wurde eine Ressource zurückgegeben.
8.0.0 schema, table and types are now nullable.

Beispiele

Beispiel #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
}
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

Array
(
    [TABLE_CAT] => SalesOrders
    [TABLE_SCHEM] => dbo
    [TABLE_NAME] => Orders
    [TABLE_TYPE] => TABLE
    [REMARKS] =>
)

Siehe auch