Copy link to clipboard
Copied
My application has a Coldfusion component(cfc), CFM file and a lot of Flex source files.
I tried using <cftry>, <cfcatch>, <cfdump> to find the errors in the cfc, but still cannot trace the issue.
The code in CFC file is somewhat like
<cfcomponent>
<cffunction name="edit" access="remote" returntype="any">
<cfargument name="form_data" type="struct">
<cftry>
<cftransaction>
<!--- Update Record --->
<cfquery datasource="#Application.ds#">
some SQL here
</cfquery>
<!--- Remove all previous outcomes --->
<cfquery datasource="#Application.ds#">
some SQL here
</cfquery>
<!--- Log Update --->
<cfquery datasource="#Application.ds#">
some SQL here
</cfquery>
<!--- Get Last Logged Record --->
<cfquery datasource="#Application.ds#" name="getLogLastRecord">
some SQL here
</cfquery>
<cfloop index="arr_index" from="1" to="#ArrayLen(form_data.num)#">
<!--- Update Record --->
<cfquery datasource="#Application.ds#" >
some SQL here
</cfquery>
<!--- Log Update --->
<cfquery datasource="#Application.ds#" >
some SQL here
</cfquery>
</cfloop>
</cftransaction>
<cfset result['statMsg']= "The record was saved successfully!">
<cfset result['status']= true>
<cfcatch><!--- Catch error --->
<cfsavecontent variable="contentSaver">
<cfdump var="#form_data#">
<cfdump var="#cfcatch#">
</cfsavecontent>
<cffile action="write" file="#ExpandPath('.')#\debug.html" output="#contentSaver#">
<cfset result['statMsg'] = cfcatch.Message>
<cfset result['status']= false>
</cfcatch>
</cftry>
<cfreturn result>
</cffunction>
</cfcomponent>
Issue: 1 My understanding is if the transaction is successful I should get the message "The record was saved successfully!" which I don't get, though the transaction is successful as the data is saved in the MySQL backend.
Even if the transaction failed, I should get a message due to the catch block.
What could be the reason I am not getting the message? The users of the application need to get this so that they know that the changes they did are saved.
Issue 2: For another transaction, I get the below message at run time.
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@domain.com' at line 3"
The transaction goes through fine and changes are saved to the back end database which means nothing is wrong in my SQL syntax.
I don't see anything wrong on line 3 of the cfc file, nor the third line of the SQL statement has anything missing. Why am I getting that message?
Why am I not getting a message when I should for Issue 1 when the transaction is successful and why am I getting a strange error message for Issue 2 though the transaction is successful?
Can I do a run time debugging of the CFC using Coldfusion Builder as I can for Flex source files using Flexbuilder?
Any advice would be welcome.
Copy link to clipboard
Copied
Just to add, I checked the log files of Coldfusion in C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\logs
Copy link to clipboard
Copied
Yes, you can use debugger in ColdFusion Builder. Check http://help.adobe.com/en_US/ColdFusionBuilder/Using/WS0ef8c004658c1089-31c11ef1121cdfd6aa0-7fff.html for some details.
There are some interesting link around builder available on CF builder team blog - blogs.adobe.com/cfbuilder. [image links are not working becuase of admin issues]
Copy link to clipboard
Copied
hemant_k wrote:
Yes, you can use debugger in ColdFusion Builder. Check http://help.adobe.com/en_US/ColdFusionBuilder/Using/WS0ef8c004658c1089 -31c11ef1121cdfd6aa0-7fff.htm... for some details.
There are some interesting link around builder available on CF builder team blog - blogs.adobe.com/cfbuilder. [image links are not working becuase of admin issues]
Thanks, that link is helpful.
Copy link to clipboard
Copied
Can you cfoutput the path? That will help you know the exact location.
Copy link to clipboard
Copied
hemant_k wrote:
Can you cfoutput the path? That will help you know the exact location.
I used the cfoutput, but I cannot see it in the Flexbuilder or CFbuilder console. Where should I expect the output of cfoutput? I have marked your answers as helpful for your suggestions and time.
Thanks for your advice.