Specifications

Database operations 17
QueryColumn object
The QueryColumn object is even more like an array than in ColdFusion 5, as shown by
the following examples:
The QueryColumn object is derived by referencing a query using associative array
notation; for example:
query1['firstName']
You can set a query column to an array element; for example:
<cfset query1['col'] = array2['moo']>
The following code returns True in ColdFusion MX, and False in ColdFusion 5:
#isArray(query1['firstName'])#
The following code works in ColdFusion MX, and produces an error in
ColdFusion 5:
<cfset joeArray[1] = query1['firstName']
Data type of query results
ColdFusion 5 stores data in the query object as a string, regardless of how the data is
stored in the database. When it outputs a piece of data, it just writes out the string.
ColdFusion MX stores data in the query object differently, depending on its database
type (for example, it may store a number as a Java Double). ColdFusion MX outputs the
data by converting the stored type to a string, which might differ from the string that
ColdFusion 5 outputs. If you need your output to be in a particular format, use the
number and/or date format functions.
Appearance of query results
Certain database and operating system combinations can lead to query data being
returned with space characters appended to the end. If you encounter this whitespace
padding, you can remove it using the SQL command
rtrim(), if your database supports
the SQL
rtrim function. For example, if SELECT ColA, ColB FROM TableA returns
results for
ColB with whitespace padding, you can rewrite the query as follows:
SELECT ColA, rtrim(ColB) AS ColB FROM TableA