> What I am saying though is that the check and the insert can be the same
> thing - why use two uniqueness checkers when one is already written for you
> and is water tight? Loop until the db doesn't throw back a unique constraint
> error when you try and insert. Seems to me the most logical approach (and it
> doesn't require a lock).
I try not to rely too much on systems that expect errors to be thrown if
I can avoid it, partly for semantic reasons, i.e. hopefully errors
shouldn't be thrown during "standard operation", but also because the
trapping of errors is mechanically expensive.
That being said, before I had created the fairly detailed form
validation tools I use in my own work now, (or when they're not
available to me), I tend to use try-catch and manually thrown exceptions
as a quick and convenient method of form validation because it feels
semantically appropriate (an error is thrown because "there's something
wrong") and form validation is a lower-frequency activity where
mechanical performance isn't necessarily as important.
I guess ultimately my reasons for avoiding it here aren't entirely
rational, it just "feels bad" to me. Though as Jochem pointed out, I was
mistaken about cftransaction in spite of having checked the official
documentation (for CF7). So that being the case then I'd probably revert
back to the other solution I mentioned before using the result attribute
in cfquery and using query syntax to ensure it doesn't attempt to insert
the duplicate.
--
s. isaac dealey ^ new epoch
isn't it time for a change?
ph: 503.236.3691
http://onTap.riaforge.org/blog
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298834
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4