Determining if a variable is a query object in ColdFusion

The following example shows how you can determine whether a value is a query object by using the isQuery() method in ColdFusion.

<cfquery name="getArt" datasource="cfartgallery">
    SELECT a.ARTID, a.ARTNAME, a.DESCRIPTION, a.ISSOLD, a.LARGEIMAGE, m.MEDIATYPE, a.PRICE
    FROM ART a, MEDIA m
    WHERE a.MEDIAID = m.MEDIAID
        AND a.ISSOLD = 0
    ORDER BY a.PRICE DESC
</cfquery>
 
<cfoutput>#isQuery(getArt)#</cfoutput>

The preceding code produces the following output:

YES

Leave a Reply

Your email address will not be published.