PHP.nl

odbc_tables

odbc_tables

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

 **odbc_tables** Odbc\Connection $odbc  $catalog  $schema  $table  $types

Lists all tables in the requested range.

To support enumeration of qualifiers, owners, and table types, the following special semantics for the , , , and are available:

catalog``schema``table``table_type- If is a single percent character (%) and and are 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.) catalog``schema``table

  • If is a single percent character (%) and and are 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.) schema``catalog``table

  • If is a single percent character (%) and , and are 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.) table_type``catalog``schema``table

    odbc``catalogodbc.parameter.catalog

schemaodbc.parameter.schema odbc.parameter.search

tableThe name. odbc.parameter.search

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

odbc.result.object-return containing the information return.falseforfailure.

The result set has the following columns:

odbc.result.driver-specific

  • TABLE_CAT

  • TABLE_SCHEM

  • TABLE_NAME

  • TABLE_TYPE

  • REMARKS

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

Voorbeeld: 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``odbc_columns``odbc_specialcolumns``odbc_statistics``odbc_procedures