Well technically, returntype doesn't have anything to do with cfquery... 

Whatever you return from your function with cfreturn has to match what
you put in your cfreturn tag, so lets say for example that you put
returntype="query", then whatever's in your cfreturn tag has to be a
query, whether it's created with cfquery or with cfdirectory, cfftp,
cfldap, QueryNew(), etc. 

<cffunction name="getusername" retuntype="query">
        <cfargument name="email" type="string" required="true" />
        <cfset var thing = QueryNew("") />
        <cfquery name="thing" ...>
                select username from mytable
                where email = <cfqueryparam value="#email#" />
        </cfquery>
        <cfreturn thing />
</cffunction>

Conversely if you put returntype="string" then whatever's in your
returntag has to be a string. 

<cffunction name="getusername" retuntype="string">
        <cfargument name="email" type="string" required="true" />
        <cfset var thing = QueryNew("") />
        <cfquery name="thing" ...>
                select username from mytable
                where email = <cfqueryparam value="#email#" />
        </cfquery>
        <cfreturn thing.username />
</cffunction>

Or you can just skip the whole thing, omit the returntype attribute and
not worry about what is being returned. 

<cffunction name="getstuff" returntype="any">
        ...
        <cfreturn myquery.username />

        <!--- or --->

        <cfreturn myquery />
</cffunction>

-- 
s. isaac dealey  ^  new epoch
 isn't it time for a change? 
     ph: 617.365.5732

http://onTap.riaforge.org/blog



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307510
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to