To make sure I'm getting the basics down right, Let's say I build this
simple cfc.
My goal is to take two variables, domain, subFolder, and apply them as
arguments to a function that will run a query and return either a 0/1
result (yes, no)
<cfcomponent displayname="dns" hint="component for domain names">
<cffunction name="dnsLookup" hint="looks up a requested url" returntype="query">
<cfargument name="domain" type="string" required="true" default=""
hint="root domain" />
<cfargument name="subFolder" type="string" required="true" default=""
hint="subFolder" />
<cfquery name="dnsLookup" datasource="dbDNS" maxRows=1 >
SELECT dnsID
FROM tbl_dns
WHERE (dnsDomain = <cfqueryparam value="#arguments.domain#">)
and
(dnsSubFolder = <cfqueryparam value="#arguments.subFolder#">)
</cfquery>
<cfreturn dnsLookup>
</cffunction>
</cfcomponent>
Now, if I want to use that function, can I run it directly in an
if/then statement? Or do I need to invoke it first, then use the
results in an if/then statement?
<cfinvoke component="dns" method="dnsLookupRecordCount"
returnvariable="dnsRecordCount" domain="#domain#"
subFolder="#subFolder#" />
<cfif dnsLookupRecordCount gte 1> do work </cfif>
Thanks!
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en