Other MetaFunctions
metaTables()
The method metaTables() returns a list of the tables in the database. In some databases, the values returned by the method may be restricted based on built-in security in the DBMS.
$ar = $db->metaTables('TABLES'); /* * $ar returns: [0] => DEPT [1] => EMP [2] => EMPACT [3] => EMP_ACT [4] => PROJ [5] => ADEFUSR ......
metaIndexes()
The method metaIndexes() returns an array of data containing index information about a requested table
print_r($db->metaIndexes('test')); /* * Prints Array( [index_name] => Array ( [unique] => 0 [columns] => Array ( [0] => Column 1 [1] => Column 2 [2] => etc........ ) ) */
metaPrimaryKeys()
The metaPrimaryKeys() method returns a list of Primary Keys associated with a table
$mpk = $db->metaPrimaryKeys('ACT'); print_r($mpk); /* * Prints Array ( [0] => ACTNO ) */
metaProcedures()
The method metaProcedures() returns a list of stored procedures in a database. Some databases do not support stored procedures. The format of the data returned is as follows:
Array( [name_of_procedure] => Array( [type] => PROCEDURE or FUNCTION or METHOD [catalog] => Catalog (or owner) name [schema] => Schema name [remarks] => explanatory comment on the procedure ) )
metaForeignKeys()
The metaForeignKeys() method returns a list of Foreign Keys (sometimes called Constraints) associated with a requested table. Each array entry shows the foreign table, and the fields that are related.
$p = $db->metaForeignKeys('dept_emp'); print_r($p); /* * prints Array ( [employees] => Array ( [0] => emp_no=emp_no ) [departments] => Array ( [0] => dept_no=dept_no ) ) */
End Of Lesson