Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Call function with long process

Advisor ,
Jun 17, 2015 Jun 17, 2015

Hi All,

How can I define a function that call a Oracle sp but right away return something?

The sp is a long process, I can check if the process finish later with another function.

<cffunction name="callFunctionCC" access="remote" output="false" returnformat="any">

     <cfargument name="myID" type="numeric" required="true">

     <cfset var myResult = "The process start" />

     <cfset var qryData = "" />

     <cfstoredproc procedure="TT.CALCS.getLongProcess" datasource="#application.str_dsn#">

         <cfprocparam value="#arguments.myID#" cfsqltype="cf_SQL_NUMERIC">

         <cfprocresult name="qryData">

     </cfstoredproc>

     <cfreturn myResult/>

</cffunction>

Thanks,

320
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 17, 2015 Jun 17, 2015
LATEST

You could wrap the process in a CFThread.  Your long process will start "behind the scenes" in a new thread and your function can return whatever.

<cffunction name="callFunctionCC" access="remote" output="false" returnformat="any">

     <cfargument name="myID" type="numeric" required="true">

     <cfset var myResult = "The process start" />

     <cfset var qryData = "" />

<cfthread name="theLongRoad">

     <cfstoredproc procedure="TT.CALCS.getLongProcess" datasource="#application.str_dsn#">

         <cfprocparam value="#arguments.myID#" cfsqltype="cf_SQL_NUMERIC">

         <cfprocresult name="qryData">

     </cfstoredproc>

</cfthread>

     <cfreturn myResult/>

</cffunction>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources