- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
The only thing this is faster at, is in filling a screen with one query.
Admin
It's a faster way to get your Lines of Code (LOC) metric up.
Admin
If Ted had just enough knowledge to be dangerous, given the outcome, I'm wondering what that knowledge is, and what its source is.
Admin
If column "updater" is not unique, Ted's code will update much more than only the row with change = @change.
Admin
In that case, your first task is to stop using silly prefixes.
Edit Admin
Given the naming conventions, I'm going to be generous and assume that
updater
is the primary key oftbl_updater
. Our submitter didn't have anything to say on the subject beyond, "This is what the query should be," so it's a good assumption.Edit Admin
Apparently Ted thinks it's faster to set the "date" column twice. Kudos for creativity!
Edit Admin
I don't say this often, but too bad they weren't using MySQL. It has a quirk where it doesn't allow using a subquery that references the same table in the WHERE clause of an UPDATE or DELETE query.
Edit Admin
I was going to say this. But the more I looked at this code, the more I believe there's a good possibility that updater is null.
Admin
Maybe Ted learned that from some Atari shareware database package back in the day.
Edit Admin
Oh, it's faster alright. In the future, anyone who looks at the code will instantly understand Ted's "value" to the project. Much time saved.