metaTables
Syntax
string[] metaTables( optional string $tableType=false, optional bool $showSchema=false optional string $mask=false, optional string $schemaMask=false )
Description
The function metaTables()
returns a list of tables and views in the currently attached database. The function does not return system tables.
Casing
The table name is returned in the natural casing of the database. Case-insensitive matches should be used when matching with table names.
Parameters
$tableType
There are 2 available options to this parameter:
Option | Description |
---|---|
TABLES | Only show tables in current schema |
VIEWS | Only show views in current schema |
Many databases support 'T' and 'V' as these options
Support for this option is limited to the IBM DB2 driver
$showSchema
This parameter attaches the schema name to the table
Support for this option is limited. Check the database driver documentation.
$mask
This option define a mask for matching tables . For example, setting $mask = 'TMP%' will match all tables that begin with 'TMP'.
Support for this option is limited to the deprecated ODBC driver for IBM and may be removed in future releases . Check the database driver documentation.
$schemaMask
This option define a mask for matching schemas . For example, setting $mask = 'SYS%' will match all schemas that begin with 'SYS'.
Usage
/* * Assume connection to DB2 database 'sample' */ $ar = $db->metaTables('TABLES'); /* * $ar returns: [0] => DEPT [1] => EMP [2] => EMPACT [3] => EMP_ACT [4] => PROJ [5] => ADEFUSR ......