|
cfdump
DescriptionUse
the cfdump tag to get the elements, variables,
and values of most kinds of ColdFusion objects. Useful for debugging.
You can display the contents of simple and complex variables, objects,
components, user-defined functions, and other elements. The cfdump now
shows component properties defined by cfproperty when
you dump a CFC. A new key called PROPERTIES has
been added in the component dump, which is expanded, by default.
The text format of cfdump also provides this information.
Syntax<cfdump
var = "#variable#"
expand = "yes|no"
format = "text|html"
hide = "columns|keys"
keys = "number of keys to display for structures"
label = "text"
metainfo = yes|no"
output = "browser|console|file"
show = "columns|keys"
showUDFs = "yes|no"
top = "number of rows|number of levels"
abort = "true|false">
Note: You can
specify this tag’s attributes in an attributeCollection attribute
whose value is a structure. Specify the structure name in the attributeCollection attribute
and use the tag’s attribute names as structure keys.
HistoryColdFusion 8: Added the show, format, hide, keys, metainfo, output, and showUDFs attributes.
ColdFusion MX 7: Added the top attribute.
ColdFusion MX 6.1: Added the ability to dump COM objects;
it displays the methods and Get and Put properties typeinfo information
for the object.
Attributes
Attribute
|
Req/Opt
|
Default
|
Description
|
var
|
Required
|
|
Variable to display. Enclose a variable
name in number signs.
These kinds of variables yield meaningful cfdump output:
array
CFC
COM object
file object
Java object
simple
query
structure
UDF
wddx
xml
|
expand
|
Optional
|
yes
|
|
format
|
Optional
|
text
|
Use with the output attribute
to specify whether to save the results of a cfdump to
a file in text or HTML format.
|
hide
|
Optional
|
all
|
For a query, this is a column name or a
comma-delimited list of column names. For a structure, this is a
key or a comma-delimited list of keys.
If you specify a structure
element that doesn’t exist, ColdFusion ignores it and does not generate
an error.
|
keys
|
Optional
|
9999
|
For a structure, the number of keys to display.
|
label
|
Optional
|
|
A string; header for the dump output. Ignored
if the value of the var attribute is a simple types.
|
metainfo
|
Optional
|
no
|
For use with queries only. Includes information
about the query in the cfdump results, including whether the query
was cached, the execution time, and the SQL. Specify metainfo="no" to
exclude this information from the query result.
|
output
|
Optional
|
browser
|
Where to send the results of cfdump.
The following values are valid:
The filename
must include the full pathname of the file. You can specify an absolute path,
or a path that is relative to the ColdFusion temporary directory.
You can use the GetTempDirectory() function to
determine the ColdFusion temporary directory.
|
show
|
Optional
|
all
|
For a query, this is a column name or a
comma-delimited list of column names. For a structure, this is a
key or a comma-delimited list of keys.
|
showUDFs
|
Optional
|
yes
|
|
top
|
Optional
|
9999
|
The number of rows to display. For a structure,
this is the number of nested levels to display.
|
abort
|
Optional
|
false
|
If this attribute is set to "true", it stops
processing the current page at the tag location.
|
UsageThe expand/contract
display capability is useful when working with large structures,
such as XML document objects, structures, and arrays.
To display
a construct, use code such as the following, in which myDoc is
a variable of type XmlDocument:
<cfif IsXmlDoc(mydoc) is "yes">
<cfdump var="#mydoc#">
</cfif>
The tag output is color-coded according
to data type.
If a table cell is empty, this tag displays
“[empty string]”.
Example<!--- This example shows how to use this tag to display the CGI scope as a structure: --->
<cfdump var="#cgi#"><!--- This displays information about file objects. --->
<cfscript>
myfile = FileOpen("c:\temp\test1.txt", "read");
</cfscript>
myfile refers to:
<cfdump var="#myfile.filepath#">
|