The other day my co-worker was showing me a tool that he has created to introspect a given database. So I went looking for an easier way to do it in ColdFusion and found cfdbinfo.
CFDBINFO allows you retrieve information about a data source, including details about the database, tables, queries, procedures, foreign keys, indexes, and version information about the database, driver, and JDBC.
The CFDBINFO tag returns a query object that contains information about a database. The query object varies, depending on the value that you specify in the type attribute. You can further filter information about specific tables, columns, or stored procedures by using the ‘pattern’ attribute.
Syntax:
<cfdbinfo
datasource="data source name"
name="result name"
dbname="database name"
type="dbnames|tables|columns|version|procedures|foreignkeys|index"
table="table name"
pattern="filter pattern"
password="password" username="username">
Examples:
Database product name and Version, driver name and version, JDBC major and minor version:
<cfdbinfo type="version" datasource="cfartgallery" name="dbdata">
All Databases for a given Datasource:
<cfdbinfo type="dbnames" datasource="cfartgallery" name="dbdata">
All Tables for a given Database:
<cfdbinfo type="tables" datasource="cfartgallery" name="dbdata">
All Columns for a given Table:
<cfdbinfo type="columns" table="artists" datasource="cfartgallery" name="dbdata">
All Foreign Keys for a given Table:
<cfdbinfo type="foreignkeys" table="orders" datasource="cfartgallery" name="dbdata">
All Index for a given Table:
<cfdbinfo type="index" table="artists" datasource="cfartgallery" name="dbdata">
All Stored Procedures for a given Database:
<cfdbinfo type="procedures" datasource="cfartgallery" name="dbdata">
Enjoy!