array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'function.odbc-tables.php', 1 => 'odbc_tables', ), 'up' => array ( 0 => 'ref.uodbc.php', 1 => 'ODBC Funções', ), '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', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc_tables — Get the list of table names stored in a specific data source
$odbc
,$catalog
= null
,$schema
= null
,$table
= null
,$types
= null
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:
catalog
is a single percent
character (%) and schema
and
table
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.)
schema
is a single percent character
(%) and catalog
and
table
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.)
table_type
is a single percent
character (%) and catalog
,
schema
and table
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.)
odbc
O identificador da conexão ODBC. Consulte odbc_connect() para obter detalhes.
catalog
O catálogo ('qualifier' na linguagem ODBC 2).
schema
O esquema ('owner' na linguagem ODBC 2).
Este parâmetro aceita os seguintes padrões de pesquisa:
%
para corresponder a zero ou mais caracteres
e _
para corresponder a um único caractere.
table
The name.
Este parâmetro aceita os seguintes padrões de pesquisa:
%
para corresponder a zero ou mais caracteres
e _
para corresponder a um único caractere.
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.
Returns an ODBC result identifier containing the information
ou false
em caso de falha.
The result set has the following columns:
TABLE_CAT
TABLE_SCHEM
TABLE_NAME
TABLE_TYPE
REMARKS
The result set is ordered by TABLE_TYPE
, TABLE_CAT
,
TABLE_SCHEM
and TABLE_NAME
.
Versão | Descrição |
---|---|
8.0.0 |
schema , table and types
are now nullable.
|
Exemplo #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
}
?>
O exemplo acima produzirá algo semelhante a:
Array ( [TABLE_CAT] => SalesOrders [TABLE_SCHEM] => dbo [TABLE_NAME] => Orders [TABLE_TYPE] => TABLE [REMARKS] => )