I also used to think that cfinsert and cfupdate were rubbish, then when I
actually used them properly one day I came to a similar conclusion as your
friend.
They certainly can be very handy and time saving tags when working with
simple update/insert from forms as they directly convert form field names
into column names and do everything for you.
Where they obviously fall down is where you need to use conditional logic in
your query to determine what values may or may not be used or where you may
be using values that didn't come from the form.

So I'd say he is right in the broadest sense, and these tags are especially
good for newbies and developers who just learn a small set of CFML tags or
use the dreamweaver builders and tools to generate code and probably never
going to get into OOP or ORM.


Regards
--
Russ Michaels
my blog: http://russ.michaels.me.uk/
skype: russmichaels
MSM: [email protected]



-----Original Message-----
From: Rick Root [mailto:[email protected]] 
Sent: 23 September 2010 16:09
To: cf-talk
Subject: cfinsert/cfupdate


I've been trying to convince one of my friends that using cfinsert and
cfupdate is a bad idea.

I recently told him that real CF programmers don't use cfinsert and
cfupdate :)  He responded with this:

CF8 uses cfqueryparam inside all cfinsert/cfupdate statements, making
it just as safe as a regular cfquery, but minus all the clunky code
needed to create the query.  Actually, scratch that, both queries,
since without them you have to maintain both the insert and update
statements separately if you add a new form field to a form.  cfinsert
can do in one line of code what otherwise could be hundreds, not to
mention saving you all the ridiculous potential errors from not having
commas in the correct place, accidentally using or not using quotes,
or mis-matching insert values since the syntax of inserts is different
from updates and the two lines you need to add can often be quite far
apart.  Call me proud to not be a real cf programmer.

I just don't know how to respond to this.

Rick



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337385
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to