Some ColdFusion tags return data as variables. For example, the cffile
tag returns file size information in the FileSize variable, referenced as CFFILE.FileSize.
The following tags return data that can be referenced in variables:
cfcatch cfdirectory cferror cffile cfftp cfhttp cfindex cfldap cfpop cfquery cfregistry cfsearch cfstoredproc
This section describes the following topics:
A ColdFusion tag that returns a query object supports the following variables, where queryname is the value of the name
attribute:
queryname
.CurrentRowqueryname
.RecordCountqueryname
.ColumnList
Within a cfcatch
block, the active exception properties can be accessed as the following variables:
CFCATCH.Type CFCATCH.Message CFCATCH.Detail CFCATCH.ErrNumber CFCATCH.NativeErrorCode CFCATCH.SQLState CFCATCH.LockName CFCATCH.LockOperation CFCATCH.MissingFileName CFCATCH.TagContext CFCATCH.ErrorCode CFCATCH.ExtendedInfo
Within a cfcatch
block, database exception properties can be accessed as the following variables:
CFCATCH.QueryError CFCATCH.SQL CFCATCH.Where CFCATCH.Datasource
Within a cfcatch
block, undefined variable exception properties can be accessed as the following variable:
CFCATCH.Name
Within a cfcatch
block, syntax and parsing exception properties can be accessed as the following variables:
CFCATCH.TokenText CFCATCH.Snippet CFCATCH.Column CFCATCH.KnownColumn CFCATCH.Line CFCATCH.KnownLine
The cfdirectory
tag, with action=list
, returns a query object as follows, where queryname is the name
attribute value:
queryname
.Namequeryname
.Sizequeryname
.Typequeryname
.DateLastModifiedqueryname
.Attributesqueryname
.Mode
When cferror
generates an error page, the following error variables are available if type="request"
or "exception"
.
Error.Diagnostics Error.MailTo Error.DateTime Error.Browser Error.GeneratedContent Error.RemoteAddress Error.HTTPReferer Error.Template Error.QueryString
The following error variables are available if type="validation"
.
Error.ValidationHeader Error.InvalidFields Error.ValidationFooter
Any cfcatch
variable that applies to exception type can be accessed within the Error scope, as follows:
Error.Type Error.Message Error.Detail Error.ErrNumber Error.NativeErrorCode Error.SQLState Error.LockName Error.LockOperation Error.MissingFileName Error.TagContext Error.ErrorCode Error.ExtendedInfo
Note: You can substitute the prefix CFERROR
for Error
, if type
=
"Exception"
; for example, CFERROR.Diagnostics
, CFERROR.Mailto
, or CFERROR.DateTime
.
File variables are read-only. Use the CFFILE
prefix to reference file variables; for example, CFFILE.ClientDirectory
. The File
prefix is deprecated in favor of the CFFILE
prefix.
CFFILE.AttemptedServerFile CFFILE.ClientDirectory CFFILE.ClientFile CFFILE.ClientFileExt CFFILE.ClientFileName CFFILE.ContentSubType CFFILE.ContentType CFFILE.DateLastAccessed CFFILE.FileExisted CFFILE.FileSize CFFILE.FileWasAppended CFFILE.FileWasOverwritten CFFILE.FileWasRenamed CFFILE.FileWasSaved CFFILE.OldFileSize CFFILE.ServerDirectory CFFILE.ServerFile CFFILE.ServerFileExt CFFILE.ServerFileName CFFILE.TimeCreated CFFILE.TimeLastModified
When you use the cfftp stoponerror
attribute, these variables are populated:
CFFTP.Succeeded CFFTP.ErrorCode CFFTP.ErrorText
Some cfftp
file and directory operations provide a return value, in the variable CFFTP.ReturnValue. Its value is determined by the results of the action
attribute. When you specify any of the following actions, cfftp
returns a value:
GetCurrentDir GetCurrentURL ExistsDir ExistsFile Exists
When you use the cfftp
tag with the listdir
action, cfftp
returns a query object, where queryname
is the name
attribute value, and row
is the row number of each file or directory entry:
queryname
.Name[row
]queryname
.Path[row
]queryname
.URL[row
]queryname
.Length[row
]queryname
.LastModified[row
]queryname
.Attributesqueryname
.IsDirectoryqueryname
.Mode
A cfhttp get
operation can return text and binary files. Files are downloaded and the contents stored in a variable or file, depending on the MIME type, as follows:
CFHTTP.FileContent CFHTTP.MimeTypeCFHTTP.Header
CFHTTP.ResponseHeader
[http_hd_key] CFHTTP.StatusCode
The cfldap
action=query
tag returns information about the LDAP query, as follows:
queryname
.CurrentRowqueryname
.RecordCountqueryname
.ColumnList
The cfpop
tag returns the following result columns, depending on the action
attribute value and the use of other attributes, such as attachmentpath
, where queryname is the name
attribute value:
queryname
.Datequeryname
.Fromqueryname
.Bodyqueryname
.Headerqueryname
.MessageNumberqueryname
.ReplyToqueryname
.Subjectqueryname
.CCqueryname
.Toqueryname
.CurrentRowqueryname
.RecordCountqueryname
.ColumnListqueryname
.Attachmentsqueryname
.AttachmentFiles
The cfquery
tag returns information about the query in this variable:
CFQUERY.ExecutionTime
The cfquery
tag uses the query name to scope the following data about the query:
queryname
.CurrentRowqueryname
.RecordCountqueryname
.ColumnList
The cfstoredproc
tag returns the following variables:
CFSTOREDPROC.ExecutionTime CFSTOREDPROC.StatusCode
The cfregistry
tag returns a query record set that you can reference after executing the GetAll
action, as follows, where queryname is the name
attribute value:
queryname.Entry queryname.Type queryname.Value
A cfsearch
operation returns the following variables, where searchname is the name
attribute value:
searchname
.URLsearchname
.Keysearchname
.Titlesearchname
.Scoresearchname
.Custom1 and Custom2searchname
.Summarysearchname
.RecordCountsearchname
.CurrentRowsearchname
.RecordsSearchedsearchname
.ColumnList