cfdbinfo

Lets 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

  <cfdbinfo type="Columns" name="">

 cfdbinfo(type="Columns", name="");

Attribute Reference

type string
Required
Default: Tables

Type of information to get:

* dbnames: database name and type
* tables: name, type, and remarks
* columns: name, SQL data type, size, decimal precision, default value, maximum length in bytes of a character or integer data type column, whether nulls are allowed, ordinal position, remarks, whether the column is a primary key, whether the column is a foreign key, the table that the foreign key refers to, the key name the foreign key refers to
* version: database product name and version, driver name and version, JDBC major and minor version
* procedures: name, type, and remarks
* foreignkeys: foreign key name and table, primary key name, delete and update rules
* index: name, column on which the index is applied, ordinal position, cardinality, whether the row represents a table statistic or an index, number of pages used by the table or index, whether the index values are unique
Values:
  • Columns
  • DBNames
  • Tables
  • Foreignkeys
  • Index
  • Procedures
  • Version

datasource string

Datasource to use to connect to the database.

name string
Required

Name to use to refer to the result.

dbname string

Name of the database.

username string

User name to connect to the database.

password string

Password to connect to the database.

pattern string

Used only if type = "tables" ,type = "columns" , or type = "procedures"
. Specifies a filter to retrieve information about specific tables, columns, or stored procedures. Use an underline (_) to represent a single wildcard character and a percent sign (%) to represent a wildcard of zero or more characters.

table string

Name of the table from which you retrieve information.

Examples
Sample code using the cfdbinfo tag

Along with the data type and size

<cfdbinfo type="columns" name="cols" table="tester">
<cfoutput query="cols">
        #cols.column_name# #cols.type_name#(#cols.column_size#)<br>
</cfoutput>

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub