Question
cffunction returntype question
I've got a function (below) in a CFC that executes a stored
procedure. The procedure has 2 input parameters and a single output
parameter. I want to cfoutput the value of the output parameter in
the procedure. The procedure does it's job in CF if I don't return
the output parameter. I keep having problems with the
returnvariable type. I've output returntypes of query in the past
without any problem, but never a single calculated value. The value
being output by the procedure is a long integer.
<!--- FUNCTION --->
<cffunction name="myFunctTest" hint="ProcedureTest" returntype="??????">
<cftry>
<cfstoredproc procedure="myProc" username='#this.user#' password='#this.pass#' datasource='#this.dSource#'>
<cfprocparam type="Out" cfsqltype="cf_sql_integer" variable="OutputID"><!--- Output variable I want to return --->
<cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" value='#this.par1#' dbvarname="myPar1">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" value='#this.par2#'dbvarname="myPar2">
</cfstoredproc>
<cfcatch type="any">
<cfreturn "Error in Function...">
</cfcatch>
</cftry>
<cfreturn ??????>
</cffunction>
<!--- FUNCTION CALL --->
<cfinvoke component="cfc.myCFC" method="myFunctTest" returnvariable="??????">
<cfinvokeargument name="user" value="#myUser#">
<cfinvokeargument name="pass" value="#MyPass#">
<cfinvokeargument name="dSource" value="#myDSource#">
<cfinvokeargument name="par1" value="#Form.MyPar1#">
<cfinvokeargument name="par2" value="#Form.MyPar2#">
</cfinvoke>
Thanks in advance
Roy.
<!--- FUNCTION --->
<cffunction name="myFunctTest" hint="ProcedureTest" returntype="??????">
<cftry>
<cfstoredproc procedure="myProc" username='#this.user#' password='#this.pass#' datasource='#this.dSource#'>
<cfprocparam type="Out" cfsqltype="cf_sql_integer" variable="OutputID"><!--- Output variable I want to return --->
<cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" value='#this.par1#' dbvarname="myPar1">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" value='#this.par2#'dbvarname="myPar2">
</cfstoredproc>
<cfcatch type="any">
<cfreturn "Error in Function...">
</cfcatch>
</cftry>
<cfreturn ??????>
</cffunction>
<!--- FUNCTION CALL --->
<cfinvoke component="cfc.myCFC" method="myFunctTest" returnvariable="??????">
<cfinvokeargument name="user" value="#myUser#">
<cfinvokeargument name="pass" value="#MyPass#">
<cfinvokeargument name="dSource" value="#myDSource#">
<cfinvokeargument name="par1" value="#Form.MyPar1#">
<cfinvokeargument name="par2" value="#Form.MyPar2#">
</cfinvoke>
Thanks in advance
Roy.
