Functionality to display a data dictionary for any database on the server.
This defaults to displaying a webpage (index.php) and can also create
csv and xml files.
Developed and tested on a MySQL server; however, since it uses the PDO
library, this ought to be usable on any type of database server that a) is
supported by PDO, and b) uses the information_schema database as per the
ANSI standards.
This is for development use only. Do not use on a production server or
anywhere else publicly accessible. Like phpinfo(), this might give people
information that you don't want them to have. Use at your own risk.
files provided
index.php
displays information_schema's data dictionary as a webpage and
provides links to all the server's databases' data dictionaries and
provides functionality to convert displayed data dictionary to csv or xml
consider this as an example
schemas.css
colors used: blue, gray, #ddddff
DataDictionary.class.php
Class: DataDictionary
__construct($dsn, $host, $dbase, $user, $pass)
creates a database connection using the PDO library and
uses three sql statements to get database information
from the information_schema database
public functions:
getDBarray()
returns the names of all databases on the server as an array
getDBtablearray()
returns table information for the tables in a database as an array
getTablearray()
returns the names of all tables in a database as an array
getTabledetails()
returns column information for all the tables in a database as an array
getColarray($table)
returns column information for a specific table as an array
getColumnHeadings($array)
returns the array keys for an array
DDConverver.class.php
Class: DDConverter extends DataDictionary
__construct($type, $dsn, $host, $dbase, $user, $pass)
calls DataDictionary and
based on $type, returns a csv file or an xml document
no public functions
DDPresenter.class.php
Class: DDPresenter
html helper functions for index.php
public functions:
createDBNavbar($dbarray)
creates list of databases as GET links
createTablesNavbar($tablearray)
creates list of database tables as internal links
createTable($array, $headers)
creates a table to display information
|