Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 52

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
The CFML Programming Language
For example, the following line creates a new variable, myStructure2, that is a reference to the same structure as the
myStructure variable:
<cfset myStructure2=myStructure>
When you change the contents of myStructure2, you also change the contents of myStructure. To copy the contents
of a structure, use the ColdFusion
data types.
Structure key names can be the names of complex data objects, including structures or arrays. This lets you create
arbitrarily complex structures.
For more information on using structures, see
Queries
A query object, sometimes referred to as a query, query result, or recordset, is a complex ColdFusion data type that
represents data in a set of named columns, like the columns of a database table. Many tags can return data as a query
object, including the following:
cfquery
cfdirectory
cfhttp
cfldap
cfpop
cfprocresult
In these tags, the
attribute specifies the query object's variable name. The
name
objects.
When you assign a query to a new variable, ColdFusion does not copy the query object. Instead, both names point to
the same recordset data. For example, the following line creates a new variable, myQuery2, that references the same
recordset as the myQuery variable:
<cfset myQuery2 = myQuery>
If you make changes to data in myQuery, myQuery2 also shows those changes.
You reference query columns by specifying the query name, a period, and the column name; for example:
myQuery.Dept_ID
When you reference query columns inside tags, such as
in a tag attribute, you do not have to specify the query name.
You can access query columns as if they are one-dimensional arrays. For example, the following line assigns the
contents of the Employee column in the second row of the myQuery query to the variable myVar:
<cfset myVar = myQuery.Employee[2]>
Note: You cannot use array notation to reference a row (of all columns) of a query. For example, myQuery[2] does not
reference the second row of the myQuery query object.
Working with structures and queries
Because structure variables and query variables are references to objects, the rules in the following sections apply to
both types of data.
function, which copies the contents of structures and other complex
Duplicate
"Using Arrays and
cfoutput
Last updated 1/20/2012
Structures" on page 82.
function also creates query
QueryNew
and
, in which you specify the query name
cfloop
47

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents