Skip to main content
Participating Frequently
May 14, 2010
Question

Function not returning value

  • May 14, 2010
  • 1 reply
  • 643 views

I have a function that should be returning a simple string value, but instead is returning the following:

     cfutilities2ecfc1535299900$funcSQLNOLOCK@1ddbc34

The function is called 'sqlNoLock' and it resides in a cfc called 'utilities'.  I have no idea why it's behaving this way.  Any ideas?

    This topic has been closed for replies.

    1 reply

    Inspiring
    May 14, 2010

    Without seeing your function and your calling code, no.  No idea at all.  It looks to me like you're outputting the function, not the return value from the function.  Impossible to know without seeing the code though.

    --

    Adam

    Participating Frequently
    May 14, 2010

    Sorry, I couldn't see anything in the function that was complicated enough to warrant me including it.  It doesn't do anything other than return a string value based on another string value (which I can independently confirm is returned correctly).

    The function is as follows:

    <cffunction name="sqlNoLock" access="public" output="true" returntype="string" hint="Function to disable row locking in Sql Server">
            <cfswitch expression="#Variables.str_dbType#">
                <cfcase value="oracle8i">
                    <cfset lockText = "">
                </cfcase>
                <cfcase value="sqlServer">
                    <cfset lockText = " (NOLOCK) ">
                </cfcase>
                <cfcase value="accessDB">
                    <cfset lockText = "">
                </cfcase>
                <cfdefaultcase>
                    <cfset lockText = "">
                </cfdefaultcase>
            </cfswitch>
           
            <cfreturn lockText >
        </cffunction>

    and I'm testing it by using the following:

    <cfoutput>Lock: #Request.utilities.sqlNoLock#</cfoutput>

    Inspiring
    May 14, 2010

    and I'm testing it by using the following:

    <cfoutput>Lock: #Request.utilities.sqlNoLock#</cfoutput>

    Right.  So you're outputting the function, not calling the function.

    You need parentheses, even if you're not passing in any args.

    --

    Adam