Skip to main content
Participating Frequently
November 9, 2009
Question

Invoke Method Within Another Method

  • November 9, 2009
  • 2 replies
  • 764 views

Hi,

I have a question regarding invoking a method within a another method. That is, returning a resultset to another function.

For example:

<cffunction name="test" returnType="query">

     <cfquery name="something" cachewithin="0,0,3,0">

          blah...blah...

     </cfquery>

</cffunction>

<cffunction>

     <cfinvoke method="test" returnvariable="something" argumentcollection="#ARGUMENTS#">

      followed by some additional Q of Q.

</cffunction>

Essentially, I am trying to reuse a central query process as much as possible.  This works great until I move it to a production environment.  It seems the production server is hanging and is prone to crashing. Initially, I was thinking it may be a server leak or memory issue.  I do not have access to this server for monitoring/testing.  The development and production environments are not the same.  I know the production database has more data.  I went ahead and changed the above code where I am not returning a resultset from another function, but generating it within the same function and am getting much better performance.  Is the above method just slow...and not the best way to do things or do you think there are memory issues with the production server?

Thanks

    This topic has been closed for replies.

    2 replies

    Inspiring
    November 9, 2009

    Can you pls post the actual code for both functions, as well as the code

    that calls the first function.

    Cheers.

    --

    Adam

    jcaleyAuthor
    Participating Frequently
    November 10, 2009

    Sorry, I am unable to do so for security reasons.  The general layout of the code is represented in my first post.  The query that resides in the first function is pretty large w/many joins...criteria.  However, if I paste this query in the second function I get improved performance.  The bottle neck appears to reside in calling the first function and returning a resultset in the second.

    Thanks

    Inspiring
    November 10, 2009

    Enabling debugging and using gettickcount() and cfdump could help you find out exactly where the holdup is taking place.

    Inspiring
    November 9, 2009

    I think it's related to the amount of data in the production db.  Q of Q is really slow with large query objects.

    jcaleyAuthor
    Participating Frequently
    November 9, 2009

    Yeah...but if I move the query in same function, I get a big improvement in performance:

    <cffunction>

         <cfquery name="something" cachewithin="0,0,3,0">

              blah...blah...

         </cfquery>

          followed by some additional Q of Q.

    </cffunction>