I've been to a seminar once where the speaker was pushing the idea of cfthrow/catch for most situations.
He suggested that instead of using cfparam, just cfcatch the exception and then create the variable. I thought that really must be a lot of overhead compared to cfparam. I didn't really care for that method myself. Marlon On Tue, 25 Mar 2003 04:26:12 -0500, Michael Dinowitz <[EMAIL PROTECTED]> wrote: > I've got some code here where the author set up a CFTRY block, did a > query in it > and then tested the query values. If it failed, he ran a CFTROW and > handled the > failure in a CFCATCH (the code is below). > Now can someone, anyone tell me why he didn't just put the two CFSETs > from the > CFCATCH into the CFELSE? Is there some best practice to use CFTHROW in > this > manner? It seems exceptionally wasteful especially as this will be > recorded as > an error in the logs. He doesn't seem focused on catching an error from > the > query, just from the query results. (the code is FULL of instances of > this and > is a reason I will never recomend this product to anyone) > > <cftry> > <cfquery username="#db_username#" password="#db_password#" name="getItem" > datasource="#Attributes.datasource#"> > SELECT COUNT(itemnum) AS found > FROM items > WHERE itemnum = #Attributes.itemnum# > </cfquery> > > <cfif getItem.found> > <cfset chkItemnum = "TRUE"> > <cfelse> > <cfthrow> > </cfif> > > <cfcatch> > <cfset chkItemnum = "FALSE"> > <cfset whyBadBid = ListAppend(whyBadBid, "Invalid item number.", ",")> > </cfcatch> > </cftry> > > Michael Dinowitz > Master of the House of Fusion > http://www.houseoffusion.com > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=5 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=5 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5
